如何在 solaris 10 sparc 上成功建構 gcc-4.9.0
我正在嘗試在 solaris 10 sparc 上建構 gcc-4.9.0。
gmp 已成功建構並安裝在
/application/gmp-6.0.0a
mpfr 也已成功建構並安裝在
/application/mpfr-3.1.2
mpc 安裝在
/application/mpc-1.0.2
然後在應用程序目錄中,我有一個名為 gcc-4.9.0 的子目錄,其中還包含 src 和 src 包含 objdir。提取的 gcc-4.9.0.tar.gz 被移動到 src 目錄。結構看起來像這樣
/application - /gcc-4.9.0 -/ src - /objdir - /gcc-4.9.0 // The extracted gcc-4.9.0.tar.gz
我是這樣配置的
cd /application/gcc-4.9.0/src/objdir # ../configure --build=sparc-sun-solaris2.10 --with-gmp=/application/gmp-6.0.0a --with-mpfr=/application/mpfr-3.1.2 --with-mpc=/application/mpc-1.0.2 --with-gnu-as --with-gnu-ld --enable-shared --disable-nls --enable-languages=c,c++,objc --prefix=/application/gcc-4.9.0
配置成功並創建了make文件
我跑了
gmake
不幸的是,這執行了幾分鐘,但因出現此錯誤而終止
configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details
不幸的是,config.log 不包含全面的消息。
我已經為此工作了好幾個星期。請問我該如何解決這個問題?
config.log 內容是:
This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU C Runtime Library configure 1.0, which was generated by GNU Autoconf 2.64. Invocation command line was $ /application/gcc-4.9.0/src/libgcc/configure --cache-file=./config.cache --enable-multilib --with-gmp=/application/gmp-6.0.0a --with-mpfr=/application/mpfr-3.1.2 --with-mpc=/application/mpc-1.0.2 --with-gnu-as --with-gnu-ld --enable-shared --disable-nls --prefix=/application/gcc-4.9.0 --enable-languages=c,c++,lto,objc --program-transform-name=s,y,y, --disable-option-checking --with-target-subdir=sparc-sun-solaris2.10 --build=sparc-sun-solaris2.10 --host=sparc-sun-solaris2.10 --target=sparc-sun-solaris2.10 --srcdir=../../../libgcc --disable-intermodule --enable-checking=yes,types --disable-coverage --enable-languages=c,c++,lto --disable-build-format-warnings ## --------- ## ## Platform. ## ## --------- ## hostname = XXXXXXX uname -m = sun4v uname -r = 5.10 uname -s = SunOS uname -v = Generic_150400-28 /usr/bin/uname -p = sparc /bin/uname -X = System = SunOS Node = XXXXXXXX Release = 5.10 KernelID = Generic_150400-28 Machine = sun4v BusType = <unknown> Serial = <unknown> Users = <unknown> OEM# = 0 Origin# = 1 NumCPU = 256 /bin/arch = sun4 /usr/bin/arch -k = sun4v /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/sbin PATH: /usr/bin PATH: /usr/ccs/bin PATH: /usr/openwin/bin PATH: /usr/dt/bin PATH: /usr/platform/sun4v/sbin PATH: /opt/sun/bin PATH: /opt/SUNWexplo/bin PATH: /opt/SUNWsneep/bin PATH: /opt/CTEact/bin PATH: /usr/local/bin PATH: /usr/sfw/bin ## ----------- ## ## Core tests. ## ## ----------- ## configure:1980: creating cache ./config.cache configure:2163: checking build system type configure:2177: result: sparc-sun-solaris2.10 configure:2197: checking host system type configure:2210: result: sparc-sun-solaris2.10 configure:2307: checking for --enable-version-specific-runtime-libs configure:2320: result: no configure:2368: checking for a BSD-compatible install configure:2436: result: /application/gcc-4.9.0/src/install-sh -c configure:2452: checking for gawk configure:2479: result: nawk configure:2579: checking for sparc-sun-solaris2.10-ar configure:2606: result: ar configure:2671: checking for sparc-sun-solaris2.10-lipo configure:2698: result: lipo configure:2763: checking for sparc-sun-solaris2.10-nm configure:2790: result: /application/gcc-4.9.0/src/objdir/./gcc/nm configure:2855: checking for sparc-sun-solaris2.10-ranlib configure:2882: result: ranlib configure:2947: checking for sparc-sun-solaris2.10-strip configure:2974: result: strip configure:3036: checking whether ln -s works configure:3040: result: yes configure:3057: checking for sparc-sun-solaris2.10-gcc configure:3084: result: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include configure:3353: checking for C compiler version configure:3362: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include --version >&5 xgcc (GCC) 4.9.0 Copyright (C) 2014 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. configure:3373: $? = 0 configure:3362: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include -v >&5 Reading specs from /application/gcc-4.9.0/src/objdir/./gcc/specs COLLECT_GCC=/application/gcc-4.9.0/src/objdir/./gcc/xgcc COLLECT_LTO_WRAPPER=/application/gcc-4.9.0/src/objdir/./gcc/lto-wrapper Target: sparc-sun-solaris2.10 Configured with: ../configure --build=sparc-sun-solaris2.10 --with-gmp=/application/gmp-6.0.0a --with-mpfr=/application/mpfr-3.1.2 --with-mpc=/application/mpc-1.0.2 --with-gnu-as --with-gnu-ld --enable-shared --disable-nls --enable-languages=c,c++,objc --prefix=/application/gcc-4.9.0 Thread model: posix gcc version 4.9.0 (GCC) configure:3373: $? = 0 configure:3362: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include -V >&5 xgcc: error: unrecognized command line option '-V' xgcc: fatal error: no input files compilation terminated. configure:3373: $? = 1 configure:3362: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include -qversion >&5 xgcc: error: unrecognized command line option '-qversion' xgcc: fatal error: no input files compilation terminated. configure:3373: $? = 1 configure:3389: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include -o conftest -g -O2 conftest.c >&5 ld.so.1: cc1: fatal: libmpc.so.3: open failed: No such file or directory xgcc: internal compiler error: Killed (program cc1) no stack trace because unwind library not available Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. configure:3392: $? = 4 configure:3580: checking for suffix of object files configure:3602: /application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include -c -g -O2 conftest.c >&5 ld.so.1: cc1: fatal: libmpc.so.3: open failed: No such file or directory xgcc: internal compiler error: Killed (program cc1) no stack trace because unwind library not available Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. configure:3606: $? = 4 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "GNU C Runtime Library" | #define PACKAGE_TARNAME "libgcc" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "GNU C Runtime Library 1.0" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "http://www.gnu.org/software/libgcc/" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:3620: error: in `/application/gcc-4.9.0/src/objdir/sparc-sun-solaris2.10/libgcc': configure:3623: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_build=sparc-sun-solaris2.10 ac_cv_env_CC_set=set ac_cv_env_CC_value='/application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include ' ac_cv_env_CFLAGS_set=set ac_cv_env_CFLAGS_value='-g -O2' ac_cv_env_CPPFLAGS_set=set ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_LDFLAGS_set=set ac_cv_env_LDFLAGS_value= ac_cv_env_LIBS_set= ac_cv_env_LIBS_value= ac_cv_env_build_alias_set=set ac_cv_env_build_alias_value=sparc-sun-solaris2.10 ac_cv_env_host_alias_set=set ac_cv_env_host_alias_value=sparc-sun-solaris2.10 ac_cv_env_target_alias_set=set ac_cv_env_target_alias_value=sparc-sun-solaris2.10 ac_cv_host=sparc-sun-solaris2.10 ac_cv_prog_AR=ar ac_cv_prog_AWK=nawk ac_cv_prog_CC='/application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include ' ac_cv_prog_LIPO=lipo ac_cv_prog_NM=/application/gcc-4.9.0/src/objdir/./gcc/nm ac_cv_prog_RANLIB=ranlib ac_cv_prog_STRIP=strip ## ----------------- ## ## Output variables. ## ## ----------------- ## AR='ar' AWK='nawk' CC='/application/gcc-4.9.0/src/objdir/./gcc/xgcc -B/application/gcc-4.9.0/src/objdir/./gcc/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/bin/ -B/application/gcc-4.9.0/sparc-sun-solaris2.10/lib/ -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/include -isystem /application/gcc-4.9.0/sparc-sun-solaris2.10/sys-include ' CFLAGS='-g -O2' CPP='' CPPFLAGS='' DEFS='' ECHO_C='' ECHO_N='-n' ECHO_T='' EXEEXT='' INSTALL_DATA='/application/gcc-4.9.0/src/install-sh -c -m 644' INSTALL_PROGRAM='/application/gcc-4.9.0/src/install-sh -c' INSTALL_SCRIPT='/application/gcc-4.9.0/src/install-sh -c' LDFLAGS='' LIBOBJS='' LIBS='' LIPO='lipo' LN_S='ln -s' LTLIBOBJS='' MAINT='#' NM='/application/gcc-4.9.0/src/objdir/./gcc/nm' OBJEXT='' PACKAGE_BUGREPORT='' PACKAGE_NAME='GNU C Runtime Library' PACKAGE_STRING='GNU C Runtime Library 1.0' PACKAGE_TARNAME='libgcc' PACKAGE_URL='http://www.gnu.org/software/libgcc/' PACKAGE_VERSION='1.0' PATH_SEPARATOR=':' PICFLAG='-fPIC' RANLIB='ranlib' SHELL='/bin/bash' STRIP='strip' ac_ct_CC='' asm_hidden_op='' bindir='${exec_prefix}/bin' build='sparc-sun-solaris2.10' build_alias='sparc-sun-solaris2.10' build_cpu='sparc' build_libsubdir='build-sparc-sun-solaris2.10' build_os='solaris2.10' build_subdir='build-sparc-sun-solaris2.10' build_vendor='sun' cpu_type='' datadir='${datarootdir}' datarootdir='${prefix}/share' decimal_float='' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' double_type_size='' dvidir='${docdir}' enable_decimal_float='' enable_shared='yes' enable_vtable_verify='no' exec_prefix='NONE' extra_parts='' fixed_point='' host='sparc-sun-solaris2.10' host_alias='sparc-sun-solaris2.10' host_cpu='sparc' host_noncanonical='sparc-sun-solaris2.10' host_os='solaris2.10' host_subdir='.' host_vendor='sun' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' libgcc_topdir='../../../libgcc/..' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' long_double_type_size='' mandir='${datarootdir}/man' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/application/gcc-4.9.0' program_transform_name='s,y,y,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' set_have_cc_tls='' set_use_emutls='' sfp_machine_header='' sharedstatedir='${prefix}/com' slibdir='$(libdir)' sysconfdir='${prefix}/etc' target_alias='sparc-sun-solaris2.10' target_noncanonical='sparc-sun-solaris2.10' target_subdir='sparc-sun-solaris2.10' thread_header='' tm_defines='' tm_file='' tmake_file='' toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' vis_hide='' ## ----------- ## ## confdefs.h. ## ## ----------- ## /* confdefs.h */ #define PACKAGE_NAME "GNU C Runtime Library" #define PACKAGE_TARNAME "libgcc" #define PACKAGE_VERSION "1.0" #define PACKAGE_STRING "GNU C Runtime Library 1.0" #define PACKAGE_BUGREPORT "" #define PACKAGE_URL "http://www.gnu.org/software/libgcc/" configure: exit 1
我能夠成功建構 gcc-4.9.0 。從這個問題:https ://stackoverflow.com/q/11502045/1363169 ;我看到了這個答案https://stackoverflow.com/a/16215539/1363169這對這個解決方案特別有用。
以下是採取的步驟
1.下載所需文件。 要建構 gcc,需要三個依賴項:
一種。GNU 多精度算術庫 (GMP) - 我使用 gmp-6.0.0
灣。可靠的 GNU 多精度浮點 (MPFR) - 我使用了 mpfr-3.1.2
C。使用了 GNU MPC - mpc-1.0.2。
所有這些都可以從這裡下載: https ://ftp.gnu.org/pub/gnu/ ,您也可以從這裡的鏡像站點之一下載 gcc https://gcc.gnu.org/mirrors.html
2. 聲明你的變數
gccver=4.9.0 gmpver=6.0.0 mpfrver=3.1.2 mpcver=1.0.2 # where you downloaded source packages pkgdir=$HOME # where gcc will be built rootdir=$HOME/gcc-tmp # where gcc will be installed prefix=/opt/gcc-${gccver} # the languages you want gcc to support langs=c,c++
3. 創建一個新目錄,您要在其中保留源並在其中提取源
mkdir ${rootdir} cd ${rootdir} gzip -dc ${pkgdir}/gcc-${gccver}.tar.gz | tar xvf - gzip -dc ${pkgdir}/gcc-${gmpver}.tar.gz | tar xvf - gzip -dc ${pkgdir}/gcc-${mpfrver}.tar.gz | tar xvf - gzip -dc ${pkgdir}/gcc-${mpcver}.tar.gz | tar xvf -
注意:如果您在提取文件時遇到校驗和錯誤等問題,請參閱:如何在 solaris 10 上使用 md5.sum 正確提取 .tar.gz 以獲得解決方案。
4. 現在,將提取的原始碼移動到 gcc 源目錄中
mv gmp-${gmpver} gcc-${gccver}/gmp mv mpfr-${mpfrver} gcc-${gccver}/mpfr mv mpc-${mpcver} gcc-${gccver}/mpc
5.創建一個建構目錄並切換到它
mkdir objdir cd objdir
6. 現在配置 gcc:
${rootdir}/gcc-${gccver}/configure --prefix=${prefix} --enable-languages=${langs}
7. 然後,建構 gcc
gmake
8. 最後,安裝 gcc:
gmake install
這就對了!
雖然建構了 gcc.4.9.0,但也可以按照該步驟建構其他版本。
您可能想測試新安裝的 gcc 以查看它是否有效,方法如下:
像這樣創建一個簡單的 hello.c 文件
#include <stdio.h> int main (void) { printf ("Hello, world!\n"); return 0; }
然後從終端使用
/opt//opt/gcc-4.9.0/bin/gcc hello.c -o hello You should see hello filed created in the same directory as hello.c