c - GCC 4.0 : How do you remove unnecessary -arch flags 的 R-Perl 安装问题

标签 c perl r gcc

我想安装 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

然后创建一个指向它的符号链接(symbolic link),称为 gcc-4.2。这做了两件事:它删除了不需要的标志,并且还确保正在使用 GCC 4.0。 (GCC 4.2 一直令人头疼。)

但是,现在我遇到了更多问题,但我相信它们与体系结构无关,当然与 arch 标志无关。因此,此解决方案确实解决了所提出的问题。

关于c - GCC 4.0 : How do you remove unnecessary -arch flags 的 R-Perl 安装问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7162811/

相关文章:

perl - 这样使用 'can'函数是什么意思?

将 dateRangeInput 恢复为空

c - 使文件在 Linux 上运行 - 如何忽略区分大小写?

c++ - pthread_key_t 与局部变量

c - 动态内存分配 C

r - 如何在 R 中从两个 data.frames 创建一个(不平衡)面板?

r - 如何处理时间、距离和速度?

C中的Python实例方法

linux - Linux 中 Perl 的系统读取开销

perl - 如何使用 Mojo::DOM 设置节点的属性?