brew install gcc46 fails with Clang/xcrun error - xcode

I'm trying to use RVM to install ruby 1.9.2 and 1.9.3. It fails because one of the dependencies seems to be gcc46, and rvm uses brew to install it.
rbanerjee:~ $ sudo brew install gcc46
==> Installing dependencies for gcc46: gmp4, mpfr2, libmpc08, ppl011, cloog-ppl015
==> Installing gcc46 dependency: gmp4
==> Downloading ftp://ftp.gmplib.org/pub/gmp-4.3.2/gmp-4.3.2.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gmp4-4.3.2.tar.bz2
==> Patching
==> ./configure --prefix=/usr/local/Cellar/gmp4/4.3.2 --enable-cxx --build=x86_64-apple-darwin
checking ABI=64
checking compiler clang ... no
checking ABI=32
checking compiler clang ... no
configure: error: could not find a working compiler, see config.log for details
but clang is there and working:
rbanerjee:~ $ which clang
/usr/bin/clang
rbanerjee:~ $ clang -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
Weird that the version is 4.2, since I have Xcode 4.6.3 and command line tools 4.6.3 installed. xcrun seems to be a problem too. Digging through the gcc46 logs leads to a failure to install gmp4:
in ~/Library/Logs/Homebrew/gmp4/config.log
/usr/local/Library/ENV/4.3/clang:338:in `exec': No such file or directory - xcrun (Errno::ENOENT)
from /usr/local/Library/ENV/4.3/clang:338
Any ideas? Thanks in advance. OSX Lion. Here's all my system info:
https://gist.github.com/anonymous/9e2cdb6c0d0ca0b29eba

Related

Error when installing Gem phashion: ld: library not found for -ljpeg

When I doing bundle install of my project with Pashion in my gemfile.
I encountered troubleshooting:
ld: library not found for -ljpeg.
Confirmed things are I have installed jpeg, libjpeg, libpng by following commands.
brew install jpeg and brew install libjpeg
brew install libpng
gem install phashion -v '1.2.0' will get the same error.
Machine: MacBook Air (M1, 2020)
Os: macOS BigSur 11.2 (20D64)
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Related:
I use homebrew, which has full support on NEW Mac(M1), to install pacakges.
I use rvm(1.29.12) to manage ruby(2.6.3 as default).
Most like the problem here https://github.com/westonplatter/phashion/issues/19
After lots of searching and tries, the solution is as follows:
gem install phashion -v '1.2.0'
You will get troubleshooting: ld: library not found for -ljpeg
install phashion with config
LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/libjpeg/lib gem install phashion -v '1.2.0'
Then you will get troubleshooting: fatal error: 'jpeglib.h' file not found
last troubleshooting is because of clang path error. So
Add export CPLUS_INCLUDE_PATH=/opt/homebrew/include into ~/.zshrc
Don't forget to source ~/.zshrc.
run LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/libjpeg/lib gem install phashion -v '1.2.0' once again.
Then You will get troubleshooting: ld: library not found for -lpng
run LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/libjpeg/lib:/opt/homebrew/opt/libpng/lib gem install phashion -v '1.2.0' once again.
Installation success!

homebrew can't install formula due to CC looking for not existing gcc version

I am runnng Mac OS 10.12 with Xcode 8.0.
I tried to install the FEM-package elmer from ElmerCSC/homebrew-elmerfem.
$ brew install elmer --with-elmergui --HEAD --with-elmerice --verbose
But building failed with:
...
CMake Error at /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/CMakeDetermineCCompiler.cmake:57 (message):
Could not find compiler set in environment variable CC:
/usr/local/opt/gcc/bin/gcc-7.
Call Stack (most recent call first):
CMakeLists.txt:17 (PROJECT)
...
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
...
CPU: quad-core 64-bit arrandale
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.8.4 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/bin/pytho$
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_101
macOS: 10.12-x86_64
Xcode: 8.0
CLT: N/A
X11: 2.7.9 => /opt/X11
==> ENV
CC: /usr/local/opt/gcc/bin/gcc-7
CXX: /usr/local/opt/gcc/bin/g++-7
OBJC: clang
OBJCXX: clang++
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
MAKEFLAGS: -j4
...
Here is the link to the full log file
One strange thing to me is that the script looks for gcc-7 and g++-7 which don't exist.
But I have version gcc-6 and g++-6 installed in the very same place.
I checked .bashrc and .bash_profile but couldn't find an entry setting CC or GCC to version 7.
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ gcc-6 --version
gcc-6 (Homebrew gcc 6.2.0) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I set CC and CXX in my .bash_profile:
$ echo $CC
/usr/local/bin/gcc-6
$ echo $CXX
/usr/local/bin/g++-6
This seems not to have any effect.
gcc is pointing to the Xcode version 4.2.1
$ which gcc
/usr/bin/gcc
Here is my PATH variable.
$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin
Is this a formula or a cmake problem? How can I find out?
What could I do to get formula elmer installed?
I appreciate your help!
Best regards.
To solve the wrong gcc version problem I created two symlinks.
$ ln -s /usr/local/opt/gcc/bin/gcc-6 /usr/local/opt/gcc/bin/gcc-7
$ ln-s /usr/local/opt/gcc/bin/g++-6 /usr/local/opt/gcc/bin/g++-7
I did
$ brew install elmer --HEAD --verbose
Now I get another error. stdlib.h is not found and compilation terminated.
Link to log file
As discussed here and here there are at the moment two methods for installing Elmer on macOS using HomeBrew:
method 1:
brew tap dpo/openblas
brew install mumps
brew tap elmercsc/homebrew-elmerfem
brew edit elmer
comment the depends_on "scalapack" line out
brew install elmer --HEAD --with-elmergui
method 2:
brew tap brewsci/science
brew install mumps
if that didn't work, download mumps.rb from here
brew install ./mumps.rb
brew tap elmercsc/homebrew-elmerfem
brew install elmer --HEAD --with-elmergui
I hope it helps.

brew install gcc49 on OS X 10.10 (Unable to find a usable ISL)

When I try to install gcc49, I receive an error
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/master/gcc49.rb
######################################################################## 100.0%
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.9.3/gcc-4.9.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc49-4.9.3.tar.bz2
==> ../configure --build=x86_64-apple-darwin14.5.0 --prefix=/usr/local/Cellar/gcc49/4.9.3 --libdir=/usr/local/Cellar/gcc49/4.9.3/lib/gcc/4.9 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --w
checking for version 0.10 of ISL... no
checking for version 0.11 of ISL... no
checking for version 0.12 of ISL... no
checking for version 0.14 of ISL... no
configure: error: Unable to find a usable ISL. See config.log for details.
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
READ THIS: https://git.io/brew-troubleshooting
However, I do have ISL:
$ brew info isl
isl: stable 0.14.1 (bottled), HEAD
Integer Set Library for the polyhedral model
http://freecode.com/projects/isl
/usr/local/Cellar/isl/0.14.1 (68 files, 3.2M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/isl.rb
==> Dependencies
Build: xz ✔
Required: gmp ✔
I do not know where is the config.log located.
The correct way to install GCC 4.9 is to use
$ brew install homebrew/versions/gcc49
This way Homebrew will correctly resolve the missing dependencies and install them for you. You can find this version of gcc (or any other) using
$ brew search gcc49
homebrew/versions/gcc49
or
$ brew search gcc
gcc homebrew/versions/gcc47
homebrew/dupes/apple-gcc42 homebrew/versions/gcc48
homebrew/versions/gcc43 homebrew/versions/gcc49
homebrew/versions/gcc44 homebrew/versions/gcc5
homebrew/versions/gcc45 homebrew/versions/llvm-gcc28
homebrew/versions/gcc46
However, the dependency you are missing is not isl but isl011. You can install it with
$ brew install isl011
We can see that this is a dependency of gcc49 with
$ brew info gcc49
==> Dependencies
Required: gmp4 ✔, libmpc08 ✔, mpfr2 ✔, cloog018 ✔, isl011 ✔
The problem is caused by updated Xcode. Need run : "$ xcode-select --install"

Cannot install gcc48 with homebrew

I cannot install gcc48 with homebrew. The install fails with
(starting from the last lines in configures output):
checking for version 0.10 of ISL... no
checking for version 0.11 of ISL... no
configure: error: Unable to find a usable ISL. See config.log for details.
==> Formula
Tap: homebrew/versions
Path: /usr/local/Library/Taps/homebrew-versions/gcc48.rb
==> Configuration
HOMEBREW_VERSION: 0.9.4
HEAD: e2b10438666f41366f596fe762b2455f5761bcd8
CPU: 8-core 64-bit sandybridge
OS X: 10.8.4-x86_64
Xcode: 4.6.3
CLT: 4.6.0.0.1.1365549073
X11: 2.7.4 => /opt/X11
==> ENV
HOMEBREW_CC: clang
MAKEFLAGS: -j1
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /opt/X11/include/freetype2:/usr/include/libxml2:/opt/X11/include
CMAKE_LIBRARY_PATH: /opt/X11/lib
PKG_CONFIG_PATH: /usr/local/opt/isl/lib/pkgconfig:/usr/local/opt/cloog/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.8:/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig
HOMEBREW_MAKE_JOBS: 1
ACLOCAL_PATH: /usr/local/share/aclocal:/opt/X11/share/aclocal
OBJC: cc
PATH: /usr/local/Library/ENV/4.3:/usr/local/opt/cloog/bin:/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin
Error: gcc48 did not build
I do have isl installed.
: brew info isl
isl: stable 0.12, HEAD
http://www.kotnet.org/~skimo/isl/
/usr/local/Cellar/isl/0.12 (55 files, 3.2M) *
Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/isl.rb
==> Dependencies
Required: gmp
GCC has imposed a strict requirement about ISL version. At the time being both 4.8 branch and trunk (4.9) requires ISL 0.10 or 0.11. Homebrew has temporarily reverted ISL to 0.11.2 so it should be fine now.
This isn't restricted to Homebrew. There's a problem with the configure script if cloog-0.18.0 uses the bundled sub-package of isl-0.11.1. The VERSION string is not correctly substituted, and is set to "UNKNOWN" in the isl_version() function call - the value that the gcc configure script is testing.
You might have to build (or install) ISL first, and then add --with-isl-prefix=$SOME_DIR to the cloog configure options, so it uses the external ISL installation. I built gcc-4.8.1 for AVR recently from source, and used:
## isl-0.11.1 # ftp://gcc.gnu.org/pub/gcc/infrastructure/
> ../configure --prefix=$CROSSDIR --with-gmp-prefix=$CROSSDIR
> make [check]; make install; rehash
and now build cloog-0.18.0 with the installed 'system' ISL:
> ../configure --prefix=$CROSSDIR --with-isl-prefix=$CROSSDIR \
--with-gmp-prefix=$CROSSDIR
> make [check]; make install; rehash
This also required adding: --with-isl=$CROSSDIR to the gcc configure options.

checking whether the C compiler works... no

I recently uninstalled Xcode 4.2 and re-installed Xcode 4.3.1. Installed Command Line Tools also. The error says 'C compiler doesn't work`. On searching for this error, it said that it happens when Xcode is not installed. What am I missing?
rvm install 1.9.3 --with-gcc=clang
Installing Ruby from source to: /Users/ava/.rvm/rubies/ruby-1.9.3-preview1, this may take a while depending on your cpu(s)...
ruby-1.9.3-preview1 - #fetching
ruby-1.9.3-preview1 - #extracting ruby-1.9.3-preview1 to /Users/ava/.rvm/src/ruby-1.9.3-preview1
ruby-1.9.3-preview1 - #extracted to /Users/ava/.rvm/src/ruby-1.9.3-preview1
Fetching yaml-0.1.4.tar.gz to /Users/ava/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/ava/.rvm/src
Configuring yaml in /Users/ava/.rvm/src/yaml-0.1.4.
ERROR: Error running ' ./configure --prefix="/Users/ava/.rvm/usr" --with-gcc=clang --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 ', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/yaml/configure.log
Compiling yaml in /Users/ava/.rvm/src/yaml-0.1.4.
ERROR: Error running '/usr/bin/make ', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/yaml/make.log
Installing yaml to /Users/ava/.rvm/usr
ERROR: Error running '/usr/bin/make install', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/yaml/make.install.log
ruby-1.9.3-preview1 - #configuring
ERROR: Error running ' ./configure --prefix=/Users/ava/.rvm/rubies/ruby-1.9.3-preview1 --enable-shared --disable-install-doc --with-gcc=clang --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --with-libyaml-dir=/Users/ava/.rvm/usr ', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/configure.log
ERROR: There has been an error while running configure. Halting the installation.
➜ yaml git:(master) ✗ vi configure.log
[2012-03-18 21:03:00] ./configure --prefix="/Users/ava/.rvm/usr" --with-gcc=clang --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0
configure: WARNING: unrecognized options: --with-gcc
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for x86_64-apple-darwin11.3.0-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/ava/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
➜ ~ git:(master) ✗ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
➜ ~ git:(master) ✗ which gcc
/usr/bin/gcc
In the Terminal:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Also, in Xcode, make sure the Command Line Tools are installed. Choose Xcode > Preferences, click on Downloads, and if necessary, click the Install button next to "Command Line Tools".
you use old RVM which does not know about latest ruby pathclevel, update with rvm get head
Ruby is not yet fully ready for LLVM, your get best chances for compilation using osx-gcc-installer and --with-gcc=gcc-4.2
I fixed it by running :
rvm install <ruby-version> --with-gcc=clang
Replace < ruby-version> with version you want to use
For those out there running into the same problem,
System (in order of installation)
OSX 10.7.3
RVM
XCode 4.3
Developer Tools (through XCode Preferences > Downloads)
OSX-GCC-Installer-10.7
I had set LDFLAGS and CPPFLAGS to point to Homebrew installations, this resulted in errors. I "unlinked" LDFLAGS and CPPFLAGS, ran 'rvm install 1.9.2' and everything worked fine.
rvm install 1.9.2
Try ./configure --without-gcc to use clang.
I'm on Mavericks and the provided answers didn't work for me. However, updating my version of Xcode and making sure Command Line Tools are installed did the trick.
It is a lot easier to install by using the compiler the system knows about
1. rvm install ruby-1.9.3-p547 --with-gcc=`echo which gcc`

Resources