如何在 Solaris 10 sparc 上成功构建 gcc-4.9.0

如何在 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

答案1

我能够成功构建 gcc-4.9.0 。从这个问题:https://stackoverflow.com/q/11502045/1363169;我看到了这个答案https://stackoverflow.com/a/16215539/1363169这对于这个解决方案特别有用。

以下是采取的步骤

1.下载所需文件。 要构建 gcc,需要三个依赖项:

A。 GNU 多精度算术库 (GMP) - 我使用 gmp-6.0.0

b. GNU 可靠的多精度浮点 (MPFR) - 我使用 mpfr-3.1.2

C。使用 GNU MPC - mpc-1.0.2。

所有这些都可以从这里下载: https://ftp.gnu.org/pub/gnu/,您还可以从此处的镜像站点之一下载 gcchttps://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

答案2

日志文件声称您使用configure绑定到 GNU mp 库的指令进行调用,该库是非标准的,因此不存在于您的系统上。

你到底这么做了吗?

你是故意这样做的吗?

相关内容