问题
My environment: Mac OS X v10.7.2 with Xcode 4.2.1
I am trying to build ruby 1.9.3 on Lion with Xcode 4.2.1. I understand there's an issue with the llvm-based gcc compiler that comes with Xcode 4.2.1. But I'm trying to work around it by following these instructions, http://goo.gl/Sc39g. I was able to get a little farther along, but then ran into these 2 problems:
- #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
- fatal error: 'sys/statfs.h' file not found
The complete configure output is here: http://cl.ly/2q2G3p3r3S133i0U1i1e (the errors are all the way in the bottom)
Please advise. Thanks in advance.
P.S. I've read the list of similar/related questions, but none seem to address these 2 particular errors, or I missed them as my eyes are starting to glaze over from all the things I've tried to get this build to work. If this question has already been answered, please point me to the answer, and accept my apologies for the duplication.
回答1:
Have you tried to add the flag?
$ make clean
$ ./configure --with-gcc=clang --prefix=$HOME/.rbenv/versions/1.9.2-p290 CFLAGS=-D_FILE_OFFSET_BITS=64
Did you install macfuse? If yes is this thread useful?
Or if you don't mind installing gcc and brew, you should have more luck compiling ruby with rbenv or rvm. This article show you how to install 1.9.3 with gcc and rbenv.
回答2:
clang will probably break your gems down the line. Try with gcc like so:
$ CC=/usr/bin/gcc-4.2 rbenv install 1.9.3-p0
来源:https://stackoverflow.com/questions/8956320/building-ruby-1-9-3-on-lion-with-xcode-4-2-using-configure-with-gcc-clang