2014-10-06 60 views
3

好吧,我在建立蘋果新OS X Yosemite上的gcc-4.9.2時遇到了麻煩。我不確定是否需要在OS X上構建gnu-gcc編譯器,因爲除了tesseract-3.0.1和我自己的一些wxWidgets應用程序之外,大多數其他軟件都編譯得很好。是否有鏗鏘聲無法編譯的某些程序/代碼功能?在OS X優勝美地上建造GCC-4.9.2

我的構建步驟如下:

cd build-gcc 
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++ 
make 

我的構建路徑和gcc源路徑不包含任何空白,我已經在/usr/local安裝GMP,MPFR和MPC。

我的生成輸出是:

clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \ 
    cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz 
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a 


ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a 
Undefined symbols for architecture x86_64: 
... (Lots of symbols) 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make[3]: *** [cc1] Error 1 
make[2]: *** [all-stage1-gcc] Error 2 
make[1]: *** [stage1-bubble] Error 2 
make: *** [all] Error 2 

配置輸出生成類型爲:x86_64-apple-darwin14.0.0,所以我不明白爲什麼會這樣。

非常感謝您的幫助。

+0

GCC 4.9.2剛剛發佈。你可以嘗試一下;但是當然你需要所有必需的依賴關係。 – 2014-11-01 13:04:04

+0

完全相同的錯誤,使用相同的庫,使用GCC 4.9.2 – 2014-11-01 13:42:17

+0

也許你需要一些'--with-zlib'在'configure'時間... – 2014-11-01 13:43:49

回答

0

原來,我在/usr/local/bin中破壞了ranlib - 也許GNU Binutils不能在OS X上工作?所有我需要做的來解決這個問題是:

sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old 

,然後make,現在我有一個工作GCC!

相關問題