2013-03-26 36 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