I have a very strange issue with clang. I'm running OSX 10.10.1 and have installed XCode 6.1.1 from here. For another project, I wanted to update Ruby from 2.1.2 to 2.2.0 via rbenv install 2.2.0. The command prints the following error:
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...
BUILD FAILED (OS X 10.10.1 using ruby-build 20141225)
Inspect or clean up the working tree at /var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502
Results logged to /var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502.log
Last 10 log lines:
Via: 1.1 2ce6276171358bf7d052aa190ed98f8d.cloudfront.net (CloudFront)
X-Amz-Cf-Id: 42q6Sa73ORpGbCgaHIpsBwTRP8ycUAhsdTolikEbyxqMrn9uePtfCA==
/var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502/ruby-2.2.0 /var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502 /usr/bin
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking target system type... x86_64-apple-darwin14.0.0
clang: error: invalid version number in '-mmacosx-version-min=10.10.0'
configure: error: clang version 3.0 or later is required
make: *** No targets specified and no makefile found. Stop.
Googled for invalid version number in '-mmacosx-version-min=10.10.0' but I did not find any helpful information. By running clang --version it turns out that my clang executable is version 1.6 (!):
Apple clang version 1.6 (tags/Apple/clang-70)
Target: x86_64-apple-darwin14
Thread model: posix
This seems very weird, because XCode is usually shipped with LLVM 6. I tried to (re)install the Command Line Tools (in which clang should be located), but XCode doesn't offer me the option to download/update them:
Trying to install them via xcode-select via the command line: xcode-select --install as suggested here results in showing the help message, indicating that the --install-command is unknown (xcode-select is version 895). I also tried to download and install it manually but it has absolutely no effect. The xcode-select-path is /Applications/Xcode.app/Contents/Developer but I also tried /Applications/Xcode.app.
I also tried to update clang via Homebrew:
$ brew install llvm --with-clang --with-asan
[...]
LLVM executables are installed in /usr/local/opt/llvm/bin.
Extra tools are installed in /usr/local/opt/llvm/share/llvm.
$ brew install llvm --with-clang --with-asan
Warning: llvm-3.5.0_2 already installed
but in none of the two paths is a clang executable.
So my question is: Is there a way to update clang? Or a workaround to install ruby 2.2.0 anyway? I'm stuck here for days, any help is greatly appreciated!
EDIT
I found out that newer XCode versions (I think from 5.0 upwards) come with LLVM/Clang inside the XCode.app-folder. A few months ago, I installed XCode 4.something for testing purposes - these versions overwrite system tools like clang and xcode-select. Reinstalling XCode 6 will not update them.
I fixed it by copying /usr/bin from another Mac, but there must be a way to fix it without this workaround.
Related
I am using Bellhop ray tracing algorithm for MacOS. I have downloaded the source code for MacOS without the binaries.
I want to change my gfortran version from 9.2.0 to 8.3.0.
I installed it using homebrew. I have version 9.2.0 installed. I have it installed at /usr/bin/
I cannot seem to find any commands online to change the version.
gfortran -dumpversion
This gave me my version number but I cannot seem to find a command to get a different version.
I am working on macOS (Mojave V 10.14.6). I installed it using homebrew in /usr/local/bin/gfortran. I have version 9.2.0 installed.
type gfortran
Gives me the output:
/usr/local/bin/gfortran
Update: I believe I have 8.3.0 now downloaded by erasing 9.2.0 and downloading gfortran-8. I needed to completely remove it from my system before downloading a different version.
So I just installed Xcode on my Mac and now I would like to install LLVM as well in order to play around a bit with LLVM itself. Currently the compiler can (obviously) not find the required header files. So what is the best way to install LLVM if you already have clang, packed with Xcode, on your system?
Thanks in advance.
If you do not need to read LLVM implementation source code(such as in lib/tools directories) and might only play with libclang, perhaps using homebrew is enough for you.
brew install --with-clang --with-lld --with-python --HEAD llvm
Next you need to set PATH, CPLUS_INCLUDE_PATH and LD_LIBRARY_PATH. For me,
# export PATH=/usr/local/opt/llvm/bin:$PATH
# export CPLUS_INCLUDE_PATH=$(llvm-config --includedir):$CPLUS_INCLUDE_PATH
# export LD_LIBRARY_PATH=$(llvm-config --libdir):$LD_LIBRARY_PATH
You might configure the above information in your LLVM derived project with XCode.
However if you are also interested in Compiler-RT, Clang-Tools-Extra(see LLVM Download Page) you probably have to make LLVM as your XCode project (download from that page or via SVN as said in Getting Started with the LLVM System). After putting the sub-projects in proper directories, you can use XCode generator from CMake, the typical usage is:
cd YOUR_LLVM_SRC_ROOT
mkdir build
cd build
cmake -G Xcode ..
Use XCode to open the project file XXX.xcodeproj and it should build the project.
I tried brew install --with-clang --with-lld --with-python --HEAD llvm as suggested in the other answer, but it gave me an error:
Error: invalid option: --with-clang
brew options llvm also showed nothing.
Then I found another page that suggests the simple
brew install llvm
This worked for me. It is with homebrew 2.4.0, on MacOS Mojave.
If you need to have llvm first in your PATH run (replace <your_username> with your username):
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/<your_username>/.bash_profile
For compilers to find llvm you may need to set:
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
I have a fresh installation of OsX 10.6.8
Yesterday I installed XCode 3.x and then homebrew.
brew doctor << was ok
brew update << updated ok
brew install python << gave an error similar to this one:
==> ./configure --prefix=/usr/local/Cellar/readline/6.2.4 --mandir=/usr/local/Ce
checking for gcc... llvm-gcc
checking for C compiler default output file name...
configure: error: in `/private/tmp/readline-lGgV/readline-6.2':
configure: error: C compiler cannot create executables
See `config.log' for more details.
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
I thought was a problem due to my old XCode, so I uninstalled it and then loaded GCC-10.6.pkg but the error was the same.
I thought that also osx-gcc could be outdate so I managed to find a XCode 4.2 and I installed it, but the error doesn't change
I found out that there is no "Command Line Tools for Xcode" for osX 10.6.8 so now I'm out of options.
There is a newer version of XCode (4.3.2) that is compatible with 10.6.8 but I wasn't able to get it, and sincerely, now I don't think that that could be the problem.
So, now, I'm out of options.
I can't upgrade to Lion, because my laptop doesn't support it.
The sad thing is that yesterday I decided to format my hd and reinstall OsX just to have a new, fresh, clean installation of homebrew!!!!!
Please.....help!!!!
I've just upgraded to osx mavericks, and I want to install ruby 2.0, but I'm getting configure: error: cannot run C compiled programs. errors.
I update rvm with rvm get stable and then type rvm install 2.0.0 and get an error directing me to a log file. The log file contains:
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin13.0.0
checking host system type... x86_64-apple-darwin13.0.0
checking target system type... x86_64-apple-darwin13.0.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/mattroberts/.rvm/src/ruby-2.0.0-p247':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
So, I tried listing the versions I do have. It tells me i have 1.9.3-p392 so I uninstall that one and re-install to see if that works - same error.
Do I need to re-install / update xcode, or is there another solution?
Thanks!
If you haven't upgraded Xcode after upgrading to Mavericks you should do so
After that, open a command prompt and type:
xcode-select --install
This will install xcode command tools that have been deleted by OSX update.
After that it should work okay.
The suggested solutions did not solve my issue (XCode at newest version, command line tools installed). I used rvm install ruby-1.9.3 --with-gcc=clang and that worked.
I thought rvm used to use clang for OSX by default. Not sure if I remember that wrong or something changed / this is no longer the best thing to do. Nevertheless it made the install work for me.
After Edu's comment, the github rvm issues page he referenced warns:
#marksands please be sure you know what you are duing, ruby 1.9.3
compiled with clang is not "safe", it can segfault, thread related
issues to be expected, consider reinstalling ruby --with-gcc=gcc42 or
just let rvm install gcc 4.6, only ruby 2.0.0 is fully compatible with
clang
This issue points out issue with gcc46 on Mavericks:
The gem in question uses different language - not C/C++, it uses
Objective-C - so it's not the compiler fault, you can build gcc-4.6
with support for Objective-C - it's just not done by default.
You have two options now, both start with uninstallig gcc-4.6 and
then:
• Install apple-gcc42
• Install gcc-4.6 with --enable-objc
this is supposed to be fixed, run:
rvm get head
rvm remove 1.9.3
rvm install 1.9.3
do not use extra flags
What ended up working for me was installing XCode then RUNNING Xcode then trying to reinstall.
Running
rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')
Corrected my compiler issue in Mavericks
Solution:
unset SDKROOT
This worked for me. I hope it would for you too.
I tried to reinstall xcode along with xcode developer tools. Didn’t work. The same error.
Try to run with env -i bash —noprofile —norc to see whether your env vars are causing the issue to further investigate.
Ran into the very same issue (on 10.8.5, all up to date). Ruby 2.0.0 installed fine, but not 1.9.3. This solution worked for me.
cd into the ruby path (found in config.log), then
issue .configure (with all options, as found in config.log)
make
make install
Then:
rvm use 1.9.3 --create
on my new macbook pro with osx lion and XCode 4.1 I have some problems with gcc.
In /usr/bin I cannot find gcc-4.2
I only have the following versions:
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2
As a result when I try to select gcc42 by means of port select --set gcc gcc42 it returns me the following error:
Selecting 'gcc42' for 'gcc' failed: could not create new link "/opt/local/bin/gcc": target "/usr/bin/gcc-4.2" doesn't exist
However port select gcc returns me the following versions:
apple-gcc42
gcc42
llvm-gcc42 (active)
mp-gcc44
How can I fix this problem?
Thanks!
I could manage to solve this issue in Mountain Lion with a symbolic link:
sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
Hope this help someone
There should be a /usr/bin/gcc-4.2 with Xcode 4.1 installed. However, with the recent Xcode 4.2 update, Apple has finally removed their modified standard gcc-4.2. What remains is either llvm-gcc42 (also symlinked to gcc) and clang, the newer non-gcc C compiler. Apple is making the transition to clang; the first step is using the hybrid llvm-gcc42. There have been some reported problems using either of the new compilers. You should be using this time to figure out if you have problems with them and, if so, fix your code and report bugs to Apple. In the meantime, if you absolutely have to have the old gcc-4.2, it is possible to build one similar to the previous Apple-modified one via MacPorts:
port install apple-gcc42
but you'll be swimming against the tide.
With Xcode 4.3, you need to install the Command Line Tools separately. XCode -> Preferences -> Downloads, Click the Components button, and then click Install next to the "Command Line Tools" option.
I had the same issue.
I fixed it by doing a symlink.
Like this :
cd /usr/bin
then :
sudo ln -s llvm-gcc-4.2 gcc-4.2
You might consider compiling a newer GCC (e.g. 4.6.2) from its source code. Apple does not care much any more about GCC, but GCC has made significant progress since 4.2
And you probably could use your llvm-gcc42 as a GCC compiler.
I tampered with the innards of the makefile and found out that one invoked option provided an argument too many; replaced the variable with the actual result of the function called on my machine (removing the excess argument) and did run make again it worked.