ld: unknown option: -reexported_symbols_list when building libc++ on mac os x 10.6.8 - xcode

Any suggestions for resolving the following error (unknown option passed to ld) will be highly appreciated. The "buildit" script is the one from http://libcxx.llvm.org/ with the line
export TRIPLE=-apple-
added to it.
Thanks in advance
System Version: Mac OS X 10.6.8 (10K549)
$ clang++ -v
clang version 3.4 (trunk 192978) (llvm/trunk 192977)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
/usr/local/libcxx/lib: sudo ./buildit
for FILE in '../src/*.cpp'
clang++ -c -g -Os -arch i386 -arch x86_64 -nostdinc++ -std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 -U__STRICT_ANSI__ -I../include ../src/algorithm.cpp
for FILE in '../src/*.cpp'
...
clang algorithm.o bind.o chrono.o condition_variable.o debug.o exception.o future.o hash.o ios.o iostream.o locale.o memory.o mutex.o new.o optional.o random.o regex.o shared_mutex.o stdexcept.o string.o strstream.o system_error.o thread.o typeinfo.o utility.o valarray.o -arch i386 -arch x86_64 -o libc++.1.dylib -dynamiclib -nodefaultlibs -current_version 1 -compatibility_version 1 -install_name /usr/lib/libc++.1.dylib -lSystem -Wl,-unexported_symbols_list,libc++unexp.exp /usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp -Wl,-force_symbols_not_weak_list,notweak.exp -Wl,-force_symbols_weak_list,weak.exp -nostdinc++ -std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 -U__STRICT_ANSI__
clang: warning: argument unused during compilation: '-nostdinc++'
clang: warning: argument unused during compilation: '-std=c++11'
ld: unknown option: -reexported_symbols_list
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've been struggling for days with the same problem, but eventually got it compiled.
Before running the build script, try setting the following environment variables:
export TRIPLE=-apple-
export MACOSX_DEPLOYMENT_TARGET=10.6

Related

clang: error: unsupported option '-fopenmp'. Change default compiler?

I am on a Mac but I am not a Mac user. I need to run a make command (actually make makewisdom) to compile a software, but my compiler does not recognize some commands:
$ make makewisdom
gcc -I/Users/username/presto/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include -I -I/opt/local/include -DUSEFFTW -DUSEMMAP -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -Wall -W -fPIC -O3 -ffast-math -Wno-unused-result -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -fopenmp -o makewisdom makewisdom.c -L/opt/local/lib -lfftw3f
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [makewisdom] Error 1
I know the problem is with clang. I am reading lots of discussions (such this and this, and more), and trying to workaround the problem, but no luck yet. It maybe that I just need to set a different default compiler? (to, for example, gcc, whatever is the version I have installed):
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

compile rJava with jdk1.8.0_05

I am trying to compile rJava using on OSX 10.7.5
install.packages("rJava",type="source")
The motive is this. I am using code compiled with jdk1.8.0_05 and call it using rJava. When I do this there is a mismatch between the class file version of code compiled with jdk1.8.0_05 and the class files rJava recognizes.
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude -DRIF_HAS_CSTACK
-DRIF_HAS_RSIGHAND -mtune=core2 -g -O2 -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include/darwin -
fno-common -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include/darwin
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o
globals.o rjava.o -dynamiclib -framework JavaVM -F/Library/Frameworks/R.framework/.. -
framework R -llzma -licucore -lm -liconv
ld: library not found for -llzma
collect2: ld returned 1 exit status
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
I have installed xz using homebrew but that didn't help.
Can I not use rJava to call code compiled with jdk1.8.0_05 ?
rJava binaries are installed and working properly. It is the source compilation that causes this.
I have executed R CMD javareconf.
Java interpreter : /usr/bin/java
Java version : 1.8.0_05
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on OS X
trying to compile and link a JNI progam
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -
DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include/darwin -
I/usr/local/include -fPIC -mtune=core2 -g -O2 -c conftest.c -o conftest.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
You need a library: "library not found for -llzma"
Try download and install XZ 5.0.7: http://macpkg.sourceforge.net/

I am unable to build the couchbase ruby gem on os x 10.6.8

My goal is to install the couchbase ruby gem by building the native extensions, but I am having what seems like an architecture mismatch between the gem and the libcouchbase C library. Here is some background:
I am running OS X 10.6.8, using rvm, and ruby 1.9.2-p320 built from source
I was running OS X 10.6.7 and Xcode 3.2.5 up until yesterday but I was unable to build libcouchbase natively
I then installed brew which is known to help ease the libcouchbase install, and brew told me I needed to upgrade to at least Xcode 3.2.6
I downloaded the elusive Xcode 4.2 for Snow Leopard because it was over 2 gigs smaller than
Xcode 3.2.6 and I figured I would get the latest version.
Xcode wouldn't install due to certificate errors which I found were the result of a bug in the System Installer, and the fix was to upgrade to OS X 10.6.8 and then apply a System Update
A few hours and restarts later, I am running OS X 10.6.8 with XCode 4.2 installed and libcouchbase compiles via brew without any hiccups
I now attempt to install the couchbase gem but building native extensions fails. It says it is unable to find libcouchbase even when explicitly passing the location of the library
Inspecting mkmf.log shows the following (bold emphasis added, but I may be wrong about the problem!
"/usr/bin/gcc-4.2 -o conftest -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/universal-darwin10.8.0 -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -I/usr/local/Cellar/libevent/2.0.19/include -I/opt/local/include -I/usr/local/include -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include -I/usr/include -I/Users/emkman/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -arch i386 -arch x86_64 -fno-common -pipe -std=c99 -Wall -Wextra conftest.c -L. -L/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/Cellar/libevent/2.0.19/lib -L/opt/local/lib -L/usr/local/lib -L/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/lib -L/Users/emkman/.rvm/usr/lib -L. -arch i386 -arch x86_64 -L/usr/local/lib -arch i386 -arch x86_64 -lruby.1.9.1-static -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
"/usr/bin/gcc-4.2 -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/universal-darwin10.8.0 -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -I/usr/local/Cellar/libevent/2.0.19/include -I/opt/local/include -I/usr/local/include -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include -I/usr/include -I/Users/emkman/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -arch i386 -arch x86_64 -fno-common -pipe -std=c99 -Wall -Wextra -arch i386 -arch x86_64 -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <stdarg.h>
4: int foo(int x, ...) {
5: va_list va;
6: va_start(va, x);
7: va_arg(va, int);
8: va_arg(va, char *);
9: va_arg(va, double);
10: return 0;
11: }
12: int main() {
13: return foo(10, "", 3.14);
14: return 0;
15: }
/* end */
have_library: checking for libcouchbase_server_versions() in -lcouchbase... -------------------- no
"/usr/bin/gcc-4.2 -o conftest -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/universal-darwin10.8.0 -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -I/usr/local/Cellar/libevent/2.0.19/include -I/opt/local/include -I/usr/local/include -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include -I/usr/include -I/Users/emkman/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -arch i386 -arch x86_64 -fno-common -pipe -std=c99 -Wall -Wextra conftest.c -L. -L/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/Cellar/libevent/2.0.19/lib -L/opt/local/lib -L/usr/local/lib -L/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/lib -L/Users/emkman/.rvm/usr/lib -L. -arch i386 -arch x86_64 -L/usr/local/lib -arch i386 -arch x86_64 -lruby.1.9.1-static -lcouchbase -lpthread -ldl -lobjc "
ld: warning: ignoring file /usr/local/lib/libcouchbase.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_libcouchbase_server_versions", referenced from:
_t in cckhpWpO.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/AT/ATO2AJa-G3Ogm+J4qma1hE+++TI/-Tmp-/mkmf_20120724-40695-16d2a4n/ccAGPue9.out (No such file or directory)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libcouchbase/couchbase.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))libcouchbase_server_versions; return 0; }
/* end */
"/usr/bin/gcc-4.2 -o conftest -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/universal-darwin10.8.0 -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -I/usr/local/Cellar/libevent/2.0.19/include -I/opt/local/include -I/usr/local/include -I/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/include -I/usr/include -I/Users/emkman/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -arch i386 -arch x86_64 -fno-common -pipe -std=c99 -Wall -Wextra conftest.c -L. -L/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/Cellar/libevent/2.0.19/lib -L/opt/local/lib -L/usr/local/lib -L/Users/emkman/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/lib -L/Users/emkman/.rvm/usr/lib -L. -arch i386 -arch x86_64 -L/usr/local/lib -arch i386 -arch x86_64 -lruby.1.9.1-static -lcouchbase -lpthread -ldl -lobjc "
conftest.c: In function ‘t’:
conftest.c:7: error: too few arguments to function ‘libcouchbase_server_versions’
conftest.c: In function ‘t’:
conftest.c:7: error: too few arguments to function ‘libcouchbase_server_versions’
lipo: can't figure out the architecture type of: /var/folders/AT/ATO2AJa-G3Ogm+J4qma1hE+++TI/-Tmp-/mkmf_20120724-40695-cblicr/ccG9E6Cp.out
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libcouchbase/couchbase.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { libcouchbase_server_versions(); return 0; }
/* end */
So it seems to me that the problem is that gcc is looking for an i386 build of /usr/local/lib/libcouchbase.dylib and inspecting mine shows
/usr/local/lib/libcouchbase.dylib: Mach-O 64-bit dynamically linked shared library x86_64
So now to my question(s). Is this the problem or a red herring? Do I need to be building libcouchbase as i386 or universal, or is the problem on the gem side? I have been building native gem extensions on this system for many years without problem, including the sometimes nasty mysql gem, but now I have new versions of GCC/Xcode. The rvm release notes say that Xcode 4.2 only works with Ruby 1.9.3 and breaks lots of native extensions, so I completely uninstalled it and then installed GCC-10.6.pkg from https://github.com/kennethreitz/osx-gcc-installer/ which rvm recommends as a working, but I still have the same problem. Here is my brew --env dump:
CC: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CXX: /usr/bin/llvm-g++ => /usr/llvm-gcc-4.2/bin/llvm-g++-4.2
LD: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CFLAGS: -Os -w -pipe -march=core2 -msse4.1 -mmacosx-version-min=10.6
CXXFLAGS: -Os -w -pipe -march=core2 -msse4.1 -mmacosx-version-min=10.6
CPPFLAGS: -isystem /usr/local/include
LDFLAGS: -L/usr/local/lib
MACOSX_DEPLOYMENT_TARGET: 10.6
MAKEFLAGS: -j2
Both now and when I had Xcode 4.2 installed, my -march was set to core2. Should this be native instead? I rebuilt ruby 1.9.2-p320 from source, via rvm/JewelryBox after installing my latest osx-gcc toolchain, to ensure it was using the same flags. It is built as universal-darwin and seems correct:
interpreter: "ruby"
version: "1.9.2p320"
date: "2012-04-20"
platform: "universal.x86_64-darwin10.8.0"
patchlevel: "2012-04-20 revision 35421"
full_version: "ruby 1.9.2p320 (2012-04-20 revision 35421) [universal.x86_64-darwin10.8.0]"
I know this is a lot of info, but I just want to be thorough with the details and show that I have tried almost everything. I should also mention that I have tried the developer preview of the gem combined with the developer preview of libcouchbase, and the error is the same. The two things I haven't tried:
Installing XCode 4.1 for Snow Leopard - Apple no longer makes this file available for download even though it is theoretically supported.
Installing Xcode 3.2.6 for Snow Leopard - I was trying to avoid the 4gb download but I have just started it now and can try it later tonight
Any help is greatly appreciated, especially if you have built the couchbase gem on OS X before.
I think this is a good question, as I remember going through some similar pains trying to build the gem myself. However that was a while ago and I don't have the files etc handy to remember what I did or if my errors looked like yours.
I know it's not as good as a direct answer, but I think you should be able to get in touch with the gem author here: https://groups.google.com/forum/#!forum/couchbase or via #avsej on Twitter.
Try the following steps, this resolved the issue for me:
brew unlink libcouchbase
brew install libcouchbase#2
brew link --force --overwrite libcouchbase#2
brew update && brew upgrade
Then try the bundle install or gem install.
bundle install

Install fortran-based R package on Mac OS X

I'm attempting to install version 1.10 of the cts package from CRAN on OS X, and I'm running into some linker problems. I need to install from source, because I'm making a few changes to the source (actually Zhu Wang, the cts author, made the changes & sent me the new tarball - but the same issue happens with the stock sources of cts on CRAN).
It seems to compile all the sources fine, but then fails with the following errors during linking:
> install.packages('~/Downloads/cts_1.0-11.tar.gz', .libPaths()[1], repos=NULL, type='source')
* installing *source* package ‘cts’ ...
** libs
*** arch - i386
gfortran-4.2 -arch i386 -fPIC -g -O2 -c a9rntc.f -o a9rntc.o
gfortran-4.2 -arch i386 -fPIC -g -O2 -c a9rntd.f -o a9rntd.o
gfortran-4.2 -arch i386 -fPIC -g -O2 -c a9rnti.f -o a9rnti.o
[bunch of other compilation lines snipped ...]
gfortran-4.2 -arch i386 -fPIC -g -O2 -c u9dmp.f -o u9dmp.o
gfortran-4.2 -arch i386 -fPIC -g -O2 -c update.f -o update.o
gcc-4.2 -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o cts.so a9rntc.o a9rntd.o a9rnti.o a9rntl.o a9rntr.o balanc.o balinv.o cinvert.o complete.o cspec.o d1mach.o d1rply.o d2rply.o d3rply.o d4rply.o d5rply.o d6rply.o d7rply.o d8rply.o d9rply.o dgetrf.o dgetrs.o display.o dpca.o drpoly.o e9rint.o envirn.o eprint.o fdump.o forecast.o frmatd.o frmati.o frmatr.o getmin.o hqrort.o i0tk00.o i10wid.o i1mach.o i8save.o iceil.o iflr.o isamax.o istkgt.o istkqu.o istkrl.o kfilsm.o kfilsm1.o loop.o lybsc.o lycsr.o mepad.o mutil.o newline.o orthes.o ortran.o rejuce.o repar.o resg0.o resg0new.o resg1d.o resg1dpre.o resg1dpre1.o resgen.o revg1.o roots.o s88fmt.o saxpy.o sdata.o sdot.o sdump.o search.o setcom.o seterr.o setfor.o setkfilsm.o setup1.o setupdate.o simi.o sscal.o stkdmp.o store.o u9dmp.o update.o -L/Library/Frameworks/R.framework/Resources/lib/i386 -lRlapack -L/Library/Frameworks/R.framework/Resources/lib/i386 -lRblas -lgfortran -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: can't find atom for N_GSYM stabs mdeps:G(0,10)=s32base:(0,6),0,64;big:(0,6),64,64;small:(0,6),128,64;eps:(0,6),192,64;; in balanc.o
ld: warning: can't find atom for N_GSYM stabs base:G(0,6) in balanc.o
ld: warning: can't find atom for N_GSYM stabs setcon:G(0,3)=s252cso:(0,4)=r(0,2);8;0;,0,64;csz:(0,4),64,64;lam:(0,4),128,64;ssold:(0,4),192,64;gmold:(0,4),256,64;gmnew:(0,4),320,64;sigsq:(0,4),384,64;oldb:(0,5)=ar(0,2);0;21;(0,4),448,1408;conv:(0,6)=#s32;-16;,1856,32;fail:(0,6),1888,32;np:(0,2),1920,32;itct:(0,2),1952,32;ppind:(0,2),1984,32;; in cinvert.o
ld: warning: can't find atom for N_GSYM stabs cso:G(0,4) in cinvert.o
ld: warning: can't find atom for N_GSYM stabs resgn2:G(0,7)=s59364wk:(0,8)=ar(0,2);0;19;(0,4),0,1280;vt:(0,9)=ar(0,2);0;4999;(0,4),1280,320000;bi:(0,10)=ar(0,2);0;799;(0,4),321280,51200;r:(0,11)=ar(0,2);0;799;(0,4),372480,51200;ri:(0,12)=ar(0,2);0;799;(0,4),423680,51200;errno1:(0,2),474880,32;; in cinvert.o
ld: warning: can't find atom for N_GSYM stabs wk:G(0,8) in cinvert.o
ld: in cinvert.o, sectionForAddress(0xE7F0) address not in any section for architecture i386
collect2: ld returned 1 exit status
make: *** [cts.so] Error 1
ERROR: compilation failed for package ‘cts’
* removing ‘/Users/ken/R-dev/cts’
* restoring previous ‘/Users/ken/R-dev/cts’
Warning message:
In install.packages("~/Downloads/cts_1.0-11.tar.gz", .libPaths()[1], :
installation of package ‘/Users/ken/Downloads/cts_1.0-11.tar.gz’ had non-zero exit status
Are there any compile/link flags I should pass to install.packages(), maybe? What options are the CRAN binary build machines using?

Error running make when installing Ruby 1.8.7-p302 via RVM on Mac OS 10.5.8

Running "rvm install 1.8.7-p302" provides the following feedback:
rich-macbook:~ rich$ rvm install 1.8.7-p302
Installing Ruby from source to: /Users/rich/.rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...
ruby-1.8.7-p302 - #fetching
ruby-1.8.7-p302 - #extracted to /Users/rich/.rvm/src/ruby-1.8.7-p302 (already extracted)
Applying patch 'stdout-rouge-fix' (located at /Users/rich/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
ERROR: Error running 'patch -F 25 -p1 -N -f <"/Users/rich/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch"', please read /Users/rich/.rvm/log/ruby-1.8.7-p302/patch.apply.stdout-rouge-fix.log
ruby-1.8.7-p302 - #configuring
ruby-1.8.7-p302 - #compiling
ERROR: Error running 'make ', please read /Users/rich/.rvm/log/ruby-1.8.7-p302/make.log
ERROR: There has been an error while running make. Halting the installation.
This is the second attempt at installing it; the first time the patch installed fine, but Ruby itself failed running make. I have recently installed Ruby 1.9.3-p0 without problem.
Below is the output of the mentioned log files.
patch.apply.stdout-rouge-fix.log
[2011-12-01 08:06:45] patch -F 25 -p1 -N -f <"/Users/rich/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch"
patching file lib/mkmf.rb
Hunk #1 FAILED at 201.
1 out of 1 hunk FAILED -- saving rejects to file lib/mkmf.rb.rej
make.log:
[2011-12-01 08:07:04] make
/usr/bin/gcc-4.2 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -L. -arch x86_64 -bind_at_load main.o dmydln.o libruby-static.a -ldl -lobjc -o miniruby
rbconfig.rb unchanged
cc -dynamiclib -undefined suppress -flat_namespace -install_name /Users/rich/.rvm/rubies/ruby-1.8.7-p302/lib/libruby.dylib -current_version 1.8.7 -compatibility_version 1.8 array.o bignum.o class.o compar.o dir.o dln.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o prec.o random.o range.o re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o util.o variable.o version.o dmyext.o -o libruby.1.8.7.dylib
ld warning: in array.o, file is not of required architecture
ld warning: in bignum.o, file is not of required architecture
ld warning: in class.o, file is not of required architecture
ld warning: in compar.o, file is not of required architecture
ld warning: in dir.o, file is not of required architecture
ld warning: in dln.o, file is not of required architecture
ld warning: in enum.o, file is not of required architecture
ld warning: in enumerator.o, file is not of required architecture
ld warning: in error.o, file is not of required architecture
ld warning: in eval.o, file is not of required architecture
ld warning: in file.o, file is not of required architecture
ld warning: in gc.o, file is not of required architecture
ld warning: in hash.o, file is not of required architecture
ld warning: in inits.o, file is not of required architecture
ld warning: in io.o, file is not of required architecture
ld warning: in marshal.o, file is not of required architecture
ld warning: in math.o, file is not of required architecture
ld warning: in numeric.o, file is not of required architecture
ld warning: in object.o, file is not of required architecture
ld warning: in pack.o, file is not of required architecture
ld warning: in parse.o, file is not of required architecture
ld warning: in process.o, file is not of required architecture
ld warning: in prec.o, file is not of required architecture
ld warning: in random.o, file is not of required architecture
ld warning: in range.o, file is not of required architecture
ld warning: in re.o, file is not of required architecture
ld warning: in regex.o, file is not of required architecture
ld warning: in ruby.o, file is not of required architecture
ld warning: in signal.o, file is not of required architecture
ld warning: in sprintf.o, file is not of required architecture
ld warning: in st.o, file is not of required architecture
ld warning: in string.o, file is not of required architecture
ld warning: in struct.o, file is not of required architecture
ld warning: in time.o, file is not of required architecture
ld warning: in util.o, file is not of required architecture
ld warning: in variable.o, file is not of required architecture
ld warning: in version.o, file is not of required architecture
ld warning: in dmyext.o, file is not of required architecture
compiling Win32API
compiling bigdecimal
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/bigdecimal.bundle bigdecimal.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling curses
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/curses.bundle curses.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -lncurses -ltermcap -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling dbm
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/dbm.bundle dbm.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling digest
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/digest.bundle digest.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
cp ../.././ext/digest/digest.h ../../.ext/i686-darwin9.8.0
compiling digest/bubblebabble
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/digest/bubblebabble.bundle bubblebabble.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling digest/md5
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/digest/md5.bundle md5init.o md5ossl.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -lcrypto -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling digest/rmd160
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/digest/rmd160.bundle rmd160init.o rmd160ossl.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -lcrypto -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling digest/sha1
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/digest/sha1.bundle sha1init.o sha1ossl.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -lcrypto -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling digest/sha2
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/digest/sha2.bundle sha2.o sha2init.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling dl
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/dl.bundle dl.o handle.o ptr.o sym.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
cp dlconfig.h ../../.ext/i686-darwin9.8.0
cp ../.././ext/dl/dl.h ../../.ext/i686-darwin9.8.0
compiling etc
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/etc.bundle etc.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling fcntl
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/fcntl.bundle fcntl.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling gdbm
compiling iconv
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/iconv.bundle iconv.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -liconv -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling io/wait
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/io/wait.bundle wait.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling nkf
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/nkf.bundle nkf.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling openssl
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/openssl.bundle openssl_missing.o ossl.o ossl_asn1.o ossl_bio.o ossl_bn.o ossl_cipher.o ossl_config.o ossl_digest.o ossl_engine.o ossl_hmac.o ossl_ns_spki.o ossl_ocsp.o ossl_pkcs12.o ossl_pkcs5.o ossl_pkcs7.o ossl_pkey.o ossl_pkey_dh.o ossl_pkey_dsa.o ossl_pkey_ec.o ossl_pkey_rsa.o ossl_rand.o ossl_ssl.o ossl_ssl_session.o ossl_x509.o ossl_x509attr.o ossl_x509cert.o ossl_x509crl.o ossl_x509ext.o ossl_x509name.o ossl_x509req.o ossl_x509revoked.o ossl_x509store.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -lssl -lcrypto -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling pty
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/pty.bundle pty.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -lutil -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling racc/cparse
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin9.8.0/racc/cparse.bundle cparse.o -L. -L../../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../../libruby.dylib, file is not of required architecture
compiling readline
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/readline.bundle readline.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -lreadline -lncurses -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling sdbm
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/sdbm.bundle _sdbm.o init.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling socket
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/socket.bundle socket.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling stringio
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/stringio.bundle stringio.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling strscan
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/strscan.bundle strscan.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling syck
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/syck.bundle bytecode.o emitter.o gram.o handler.o implicit.o node.o rubyext.o syck.o token.o yaml2byte.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling syslog
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/syslog.bundle syslog.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling thread
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/thread.bundle thread.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
compiling tk
Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.
compiling tk/tkutil
compiling win32ole
compiling zlib
cc -arch x86_64 -dynamiclib -undefined suppress -flat_namespace -o ../../.ext/i686-darwin9.8.0/zlib.bundle zlib.o -L. -L../.. -L. -arch x86_64 -bind_at_load -lruby -lz -ldl -lobjc
ld warning: in ../../libruby.dylib, file is not of required architecture
making ruby
/usr/bin/gcc-4.2 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -L. -arch x86_64 -bind_at_load main.o -lruby -ldl -lobjc -o ruby
ld warning: in ./libruby.dylib, file is not of required architecture
Undefined symbols:
"_ruby_options", referenced from:
_main in main.o
"_ruby_run", referenced from:
_main in main.o
"_ruby_init", referenced from:
_main in main.o
"_ruby_init_stack", referenced from:
_main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [ruby] Error 1
make: *** [all] Error 2
If you need any more info, let me know.
EDIT: I performed the following steps after reading this thread: make error when installing `ruby-1.8.7-p334` with `rvm` on Snow Leopard
rvm pkg install readline
rvm remove 1.8.7
rvm cleanup all
rvm install ruby-1.8.7-p302
This successfully installed the patch, indicating it is installed first time so any subsequent errors can be ignored. It did still error when compiling Ruby. As the make log file exceeds this post's character count capacity, you can view the contents of the second makefile here: http://pastebin.com/MTZjXBdF
Did not work with the latest release. However could get it to work by forcing it to use the rvm installed readline.
rvm install 1.8.7 -C –with-readline-dir=$rvm_path/usr
So complete steps are:
rvm pkg install readline
rvm remove 1.8.7
rvm cleanup all
rvm install 1.8.7 -C –with-readline-dir=$rvm_path/usr
Thanks to Andrew at http://anlek.com/2011/01/rvm-install-1-8-7-p330-fails/ for the pointer.
I just tested it with both linux and OSX, it seems to be fixed already:
rvm get head
rvm install 1.8.7-p302 --autolibs=3
Also consider upgrading to ruby-2.0.0 - the 1.8 tree will be no more maintained in few months.

Resources