Install fortran-based R package on Mac OS X - macos

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?

Related

Building GCC-4.9.2 on OS X Yosemite

Ok, I'm having trouble building gcc-4.9.2 on Apple's new OS X Yosemite. I'm not sure if I need to be building a gnu-gcc compiler on OS X, as most other software has compiled fine, apart from tesseract-3.0.1 and some of my own wxWidgets applications. Are there certain programs/code features that clang can't compile?
My build steps are as follows:
cd build-gcc
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++
make
My build path and gcc source paths do not contain any whitespace, and I have installed GMP, MPFR and MPC in /usr/local.
My build outputs are:
clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \
cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a
ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a
Undefined symbols for architecture x86_64:
... (Lots of symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [cc1] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
Configure outputs the build type as: x86_64-apple-darwin14.0.0, so I don't understand why this is happening.
Thank You in advance for any help.
Turns out that I had a broken ranlib in /usr/local/bin - maybe GNU Binutils don't work on OS X? All I needed to do to fix the problem was to:
sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old
and then make, and now I have a working GCC!

CUDA, OSX, MPI symbol(s) not found for architecture x86_64

Helllo, I have some code, that I'm trying to compile. The code runs well on Linux but I can't compile it on OSX.
In the makefile I use for Linux:
LD_FLAGS = -lcudart -L$(CUDA_HOME)/lib64
For Mac I try to use these flags:
LD_FLAGS = -lcudart -L$(CUDA_HOME)/lib
LD_FLAGS = -lm -F/Library/Frameworks -framework CUDA
CXXFLAGS = -O3 -g -m32 -I$(CUDA_HOME)/include
NVCC_FLAGS = -O3 -g -G -I$(CUDA_HOME)/include -arch=sm_11
This is the make output file:
mpic++ -c -o main.o main.cpp -O3 -m32 -I/Developer/NVIDIA/CUDA-5.0/include
/Developer/NVIDIA/CUDA-5.0/bin/nvcc -c -o kernel.o kernel.cu -O3 -I/Developer/NVIDIA/CUDA-5.0/include -arch=sm_11
ptxas /tmp/tmpxft_000026f4_00000000-5_kernel.ptx, line 146; warning : Double is not supported. Demoting to float
/Developer/NVIDIA/CUDA-5.0/bin/nvcc -c -o support.o support.cu -O3 -I/Developer/NVIDIA/CUDA-5.0/include -arch=sm_11
mpic++ main.o kernel.o support.o -o stencil-mpi -lcudart -L/Developer/NVIDIA/CUDA-5.0/lib
ld: warning: ld: warning: ignoring file kernel.o, file was built for i386 which is not the architecture being linked (x86_64): kernel.o
ignoring file main.o, file was built for i386 which is not the architecture being linked (x86_64): main.o
ld: warning: ignoring file support.o, file was built for i386 which is not the architecture being linked (x86_64): support.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [stencil-mpi] Error 1
This problem was caused by trying to mix 32 and 64 bit compilation between the CUDA and MPI toolchains. It was noted in comments that adding -m64 instead of -m32 for LD_FLAGS, CXXFLAGS, and NVCC_FLAGS produced a working 64 bit build.

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/

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

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

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