R-Perl安装GCC 4.0的问题:如何删除不必要的-arch标志

我想安装R-Perl模块以在Perl中使用R,但是没有成功使用命令sudo R CMD INSTALL --configure-args='--with-in-perl' RSPerl/如下所示: http ://www.omegahat.org/RSPerl/RFromPerl.html 。 我之前发布过有关此问题的信息,并确定我遇到了新的GCC 4.2问题。 但是,我现在正在使用GCC 4.0.1并且遇到了不同的问题。 以下是上述命令的输出:

 * installing to library '/Library/Frameworks/R.framework/Versions/2.13/Resources/library' * installing *source* package 'RSPerl' ... checking for perl... /usr/bin/perl No support for any of the Perl modules from calling Perl from R. ***************************************************** Set PERL5LIB to /Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl/perl ***************************************************** Testing: -F/Library/Frameworks/R.framework/.. -framework R Using '/usr/bin/perl' as the perl executable Perl modules (no): Adding R package to list of Perl modules to enable callbacks to R from Perl Creating the C code for dynamically loading modules with native code for Perl: R modules: R; linking: checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed Support R in Perl: yes configure: creating ./config.status config.status: creating src/Makevars config.status: creating inst/scripts/RSPerl.csh config.status: creating inst/scripts/RSPerl.bsh config.status: creating src/RinPerlMakefile config.status: creating src/Makefile.PL config.status: creating cleanup config.status: creating src/R.pm config.status: creating R/perl5lib.R making target all in RinPerlMakefile RinPerlMakefile:5: /Library/Frameworks/R.framework/Resources/etc/Makeconf: No such file or directory make: *** No rule to make target `/Library/Frameworks/R.framework/Resources/etc/Makeconf'. Stop. calling make -f Makefile.perl install make: Makefile.perl: No such file or directory make: *** No rule to make target `Makefile.perl'. Stop. chmod: blib/lib/R.pm: No such file or directory Finished configuration ** libs *** arch - x86_64 gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I. -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE -D_R_=1 -DUSE_R=1 -DUSE_TOPLEVEL_EXEC=1 -DWITH_R_IN_PERL=1 -I/usr/local/include -fPIC -g -O2 -c Converters.c -o Converters.o In file included from /Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:27, from /Library/Frameworks/R.framework/Resources/include/Rdefines.h:26, from RSCommon.h:55, from RSPerl.h:8, from Converters.h:4, from Converters.c:1: /Library/Frameworks/R.framework/Resources/include/Rconfig.h:5:25: error: ppc/Rconfig.h: No such file or directory In file included from RSCommon.h:72, from RSPerl.h:8, from Converters.h:4, from Converters.c:1: /Library/Frameworks/R.framework/Resources/include/Rversion.h:5:26: error: ppc/Rversion.h: No such file or directory In file included from RSPerl.h:8, from Converters.h:4, from Converters.c:1: RSCommon.h:73:28: error: missing binary operator before token "(" lipo: can't open input file: /var/tmp//ccd76npm.out (No such file or directory) make: *** [Converters.o] Error 1 ERROR: compilation failed for package 'RSPerl' * removing '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl' 

这是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 configure, which was generated by GNU Autoconf 2.60. Invocation command line was $ ./configure --with-in-perl ## --------- ## ## Platform. ## ## --------- ## hostname = N01-0006-_MBP.local uname -m = x86_64 uname -r = 10.8.0 uname -s = Darwin uname -v = Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 /usr/bin/uname -p = i386 /bin/uname -X = unknown /bin/arch = unknown /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = Mach kernel version: Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 Kernel configured for up to 4 processors. 2 processors are physically available. 4 processors are logically available. Processor type: i486 (Intel 80486) Processors active: 0 1 2 3 Primary memory available: 4.00 gigabytes Default processor set: 79 tasks, 365 threads, 4 processors Load average: 0.52, Mach factor: 3.46 /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/local/bin PATH: /usr/local/sbin PATH: /usr/local/mysql/bin PATH: /opt/local/bin PATH: /opt/local/sbin PATH: /opt/local/bin PATH: /opt/local/sbin PATH: /usr/bin PATH: /bin PATH: /usr/sbin PATH: /sbin PATH: /usr/local/bin PATH: /usr/X11/bin ## ----------- ## ## Core tests. ## ## ----------- ## configure:1645: checking for perl configure:1663: found /usr/bin/perl configure:1675: result: /usr/bin/perl configure:2013: checking for gcc configure:2029: found /usr/bin/gcc configure:2040: result: gcc configure:2278: checking for C compiler version configure:2285: gcc --version >&5 i686-apple-darwin10-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5494) Copyright (C) 2005 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:2288: $? = 0 configure:2295: gcc -v >&5 Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc_40/gcc_40-5494~315/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-arch=apple --with-tune=generic --host=i686-apple-darwin10 --target=i686-apple-darwin10 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5494) configure:2298: $? = 0 configure:2305: gcc -V >&5 gcc-4.0: argument to `-V' is missing configure:2308: $? = 1 configure:2331: checking for C compiler default output file name configure:2358: gcc -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE conftest.c >&5 configure:2361: $? = 0 configure:2407: result: a.out configure:2412: checking whether the C compiler works configure:2422: ./a.out configure:2425: $? = 0 configure:2442: result: yes configure:2449: checking whether we are cross compiling configure:2451: result: no configure:2454: checking for suffix of executables configure:2461: gcc -o conftest -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE conftest.c >&5 configure:2464: $? = 0 configure:2488: result: configure:2494: checking for suffix of object files configure:2520: gcc -c -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE conftest.c >&5 configure:2523: $? = 0 configure:2546: result: o configure:2550: checking whether we are using the GNU C compiler configure:2579: gcc -c -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE conftest.c >&5 configure:2585: $? = 0 configure:2592: test -z "$ac_c_werror_flag" || test ! -s conftest.err configure:2595: $? = 0 configure:2602: test -s conftest.o configure:2605: $? = 0 configure:2619: result: yes configure:2624: checking whether gcc accepts -g configure:2654: gcc -c -g conftest.c >&5 configure:2660: $? = 0 configure:2667: test -z "$ac_c_werror_flag" || test ! -s conftest.err configure:2670: $? = 0 configure:2677: test -s conftest.o configure:2680: $? = 0 configure:2810: result: yes configure:2827: checking for gcc option to accept ISO C89 configure:2901: gcc -c -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE conftest.c >&5 configure:2907: $? = 0 configure:2914: test -z "$ac_c_werror_flag" || test ! -s conftest.err configure:2917: $? = 0 configure:2924: test -s conftest.o configure:2927: $? = 0 configure:2947: result: none needed configure:2988: gcc -c -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -DPERL_POLLUTE conftest.c >&5 configure:2994: $? = 0 configure:3001: test -z "$ac_c_werror_flag" || test ! -s conftest.err configure:3004: $? = 0 configure:3011: test -s conftest.o configure:3014: $? = 0 configure:3211: creating ./config.status ## ---------------------- ## ## Running config.status. ## ## ---------------------- ## This file was extended by config.status, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = CONFIG_HEADERS = CONFIG_LINKS = CONFIG_COMMANDS = $ ./config.status on N01-0006-_MBP.local config.status:584: creating src/Makevars config.status:584: creating inst/scripts/RSPerl.csh config.status:584: creating inst/scripts/RSPerl.bsh config.status:584: creating src/RinPerlMakefile config.status:584: creating src/Makefile.PL config.status:584: creating cleanup config.status:584: creating src/R.pm config.status:584: creating R/perl5lib.R ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_c_compiler_gnu=yes ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_objext=o ac_cv_path_PERL=/usr/bin/perl ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_cc_c89= ac_cv_prog_cc_g=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## CC='gcc' CFLAGS='' CPPFLAGS='' DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"' ECHO_C='ECHO_N='' ECHO_T='' EXEEXT='' LANGUAGE_DEFS=' -D_R_=1 -DUSE_R=1 -DUSE_TOPLEVEL_EXEC=1 -DWITH_R_IN_PERL=1' LDFLAGS='' LD_PATH='/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl/libs' LD_PATH_VAR='DYLD_LIBRARY_PATH' LIBOBJS='' LIBS='' LTLIBOBJS='' NO_SUPPORT_R_IN_PERL='0' OBJEXT='o' OTHERLDFLAGS='-F/Library/Frameworks/R.framework/.. -framework R' PACKAGE_BUGREPORT='' PACKAGE_NAME='' PACKAGE_STRING='' PACKAGE_TARNAME='' PACKAGE_VERSION='' PATH_SEPARATOR=':' PERL5_PATH='/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl/perl' PERL='/usr/bin/perl' PERL_INSTALL_PREFIX='PREFIX=/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl LIB=/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl/perl' PERL_LD_MAKE_ARG='LD=/usr/bin/gcc' PERL_MODULE_SO_DIRS='' R_HOME='/Library/Frameworks/R.framework/Resources' R_IN_PERL_DEFINES='-DWITH_R_IN_PERL=1' R_IN_PERL_LIBRARY='RinPerl' R_LIBRARY_DIR='/Library/Frameworks/R.framework/Versions/2.13/Resources/library' R_PACKAGE_DIR='/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RSPerl' R_PERL_MODULES='c("R")' R_SHLIB_CPPFLAGS='-I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64' R_SHLIB_LDFLAGS='-F/Library/Frameworks/R.framework/.. -framework R' R_SO_DIR='-F/Library/Frameworks/R.framework/.. -framework R' SHELL='/bin/sh' ac_ct_CC='gcc' bindir='${exec_prefix}/bin' build_alias='' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE}' dvidir='${docdir}' exec_prefix='${prefix}' host_alias='' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/usr/local' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' configure: exit 0 

根据我在http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/上读到的一些信息,我从gcc调用中删除了-arch ppc-arch i386标志,它没有错误地工作。 但是,我不知道如何编辑R-Perl的源代码以确保在运行此GCC调用时它运行时没有不必要的标志。 我尝试过sudo R --arch=x86_64 CMD INSTALL ...但是这并没有从GCC调用中移除其他架构。

任何有经验而不是我能给予的人都会非常感激。 谢谢!

在用户flolo的帮助下,我创建了以下shell脚本:

 #!/bin/bash COMMANDLINE=$@ COMMANDLINE=${COMMANDLINE/"-arch i386"} COMMANDLINE=${COMMANDLINE/"-arch ppc"} ECHO "--------------------------------------------" ECHO "/usr/bin/gcc-4.0 $COMMANDLINE" ECHO "--------------------------------------------" /usr/bin/gcc-4.0 $COMMANDLINE 

然后建立了一个名为gcc-4.2的符号链接。 这做了两件事:它删除了不需要的标志,并且还确保使用GCC 4.0。 (海湾合作委员会4.2一直是痛苦的。)

但是,现在我遇到了更多问题,但我认为它们与架构无关,当然还有拱旗。 因此,这个解决方案确实解决了问题。