2013-03-26 53 views
0

我使用MacPorts来设置GCC 4.7.2的通用版本。它的一个依赖项是一个名为libstdcxx的子端口,它构建并删除。如何修改libstdC++ portfile来编译fat静态库?

我已编辑gcc47 portfile中的libstdcxx条目,以防止在重建后删除静态的libstdc++.a库。

但是,静态库是一个64位(x86_64)文件:

$ sudo port -n upgrade --force libstdcxx +universal 
---> Computing dependencies for libstdcxx 
... 
$ lipo -info /opt/local/lib/libstdc++.a 
input file /opt/local/lib/libstdc++.a is not a fat file 
Non-fat file: /opt/local/lib/libstdc++.a is architecture: x86_64 

我也想支持添加到该文件为i386架构。

我应该遵循什么额外的步骤来建立一个胖的,静态的libstdc++库?或者这对于MacPorts来说是不可能的?除了链接到我的应用程序的源代码之外,是否还有其他选项可以重新分配和编译整个GCC 4.7.2两次(同时获得i386x86_64体系结构支持)以及链接此静态库?

加法 - 2013年3月27日

布雷特·黑尔的建议似乎没有工作。构建过程失败。以下是错误日志的一个片段:

:notice:configure ---> Configuring libstdcxx 
:debug:configure Using compiler 'Mac OS X clang' 
:debug:configure Executing proc-pre-org.macports.configure-configure-0 
:debug:configure Executing org.macports.configure (libstdcxx) 
:debug:configure Environment: CPATH='/opt/local/include' CXXFLAGS='-pipe -O2' CPPFLAGS='-I/opt/local/include' CFLAGS='-pipe -O2' AS_FOR_TARGET='/opt/local/bin/as' LIBRARY_PATH='/opt/local/lib' MACOSX_DEPLOYMENT_TARGET='10.8' CXX='g++ -arch x86_64 i386' CPP='gcc -arch x86_64 i386 -E\ 
' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/.CC_PRINT_OPTIONS' F90FLAGS='-pipe -O2' LD_FOR_TARGET='/opt/local/bin/ld' RANLIB_FOR_TARGET='/opt/local/bin/ranlib' LDFLAGS='-L\ 
/opt/local/lib' OBJDUMP_FOR_TARGET='/opt/local/bin/objdump' OTOOL='/opt/local/bin/otool' FCFLAGS='-pipe -O2' OBJC='/usr/bin/clang' INSTALL='/usr/bin/install -c' AR_FOR_TARGET='/opt/local/bin/ar' NM_FOR_TARGET='/opt/local/bin/nm' FFLAGS='-pipe -O2' OBJCFLAGS='-pipe -O2' CC_PRINT_OPT\ 
IONS='YES' STRIP_FOR_TARGET='/opt/local/bin/strip' CC='gcc -arch x86_64 i386' OTOOL64='/opt/local/bin/otool' 
:debug:configure Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build" && ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --includedir=/opt/local/incl\ 
ude/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/\ 
c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/lo\ 
cal/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --enable-languages=c++ --disable-bootstrap --with-pkgversion="MacPorts gcc47 4.7.2_2+universal"' 
:debug:configure Executing command line: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build" && ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --includedir=/opt/local\ 
/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/g\ 
cc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/o\ 
pt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --enable-languages=c++ --disable-bootstrap --with-pkgversion="MacPorts gcc47 4.7.2_2+universal" 
:info:configure checking build system type... x86_64-apple-darwin12 
:info:configure checking host system type... x86_64-apple-darwin12 
:info:configure checking target system type... x86_64-apple-darwin12 
:info:configure checking for a BSD-compatible install... /usr/bin/install -c 
:info:configure checking whether ln works... yes 
:info:configure checking whether ln -s works... yes 
:info:configure checking for a sed that does not truncate output... /usr/bin/sed 
:info:configure checking for gawk... no 
:info:configure checking for mawk... no 
:info:configure checking for nawk... no 
:info:configure checking for awk... awk 
:info:configure checking for libitm support... yes 
:info:configure checking for gcc... gcc -arch x86_64 i386 
:info:configure checking for C compiler default output file name... 
:info:configure configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build': 
:info:configure configure: error: C compiler cannot create executables 
:info:configure See `config.log' for more details. 
:info:configure Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/work/build" && ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --includedir=/opt/local/include/\ 
gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/\ 
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/\ 
bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --enable-languages=c++ --disable-bootstrap --with-pkgversion="MacPorts gcc47 4.7.2_2+universal" 
:info:configure Exit code: 77 
:error:configure org.macports.configure for port libstdcxx returned: configure failure: command execution failed 
:debug:configure Error code: NONE 
:debug:configure Backtrace: configure failure: command execution failed 
    while executing 
"$procedure $targetname" 
:info:configure Warning: targets not executed for libstdcxx: org.macports.activate org.macports.configure org.macports.build org.macports.destroot org.macports.install 
:notice:configure Please see the log file for port libstdcxx for details: 
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/libstdcxx/main.log 

回答

0

如果你正在构建GCC与gcc编译器,你可以尝试生产通用对象/库与-arch选项:

sudo port -n upgrade --force libstdcxx +universal \ 
configure.cc="gcc -arch x86_64 i386" configure.cxx="g++ -arch x86_64 i386" 
+0

这引起了建立失败。我已将错误日志的相关部分添加到我的问题中。 – 2013-03-27 19:08:28