Skip to content

Instantly share code, notes, and snippets.

@rparker
Created July 28, 2011 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rparker/1112425 to your computer and use it in GitHub Desktop.
Save rparker/1112425 to your computer and use it in GitHub Desktop.
Manual addition of "-arch i386" to compilation of libruby
// Run the vanilla "rvm install 1.9.2" command after setting your .rvmrc to include the line: rvm_archflags="-arch i386"
// After it fails, type: file ~/.rvm/src/ruby-1.9.2-p290/libruby.dylib
// On my system, "file" says: ==> libruby.dylib: Mach-O 64-bit dynamically linked shared library x86_64
// even though "file" on the all the ".o" files says (correctly) "i386".
// So I cut-n-pasted the line below tagged <TYPE THIS BY HAND> from the ~/.rvm/log/ruby-1.9.2-p290/make.log file.
// After pasting it, but before hitting <RETURN>, I manually added the "-arch i386" bit.
// After that command runs (instantly), repeat the "file libruby.1.9.1.dylib" query, and note that it is now 32-bit:
// (notice that you have to be explicit about the "1.9.1" version now, since the build process did not run and make
// symlinks to the same name without the version number)
// ==> libruby.1.9.1.dylib: Mach-O dynamically linked shared library i386
// NOTE - I added blank lines between each line by hand to the make.log so you can read it more easily
[2011-07-28 14:44:08] make⋅
/usr/bin/gcc-4.2 -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386 -fno-common -pipe -L. -Wl,-syslibb
root /Developer/SDKs/MacOSX10.7.sdk -arch i386 -L/usr/local/lib -Wl,-u,_objc_msgSend main.o dmydln.oo
dmyencoding.o dmyversion.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o dln_find.oo
enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o nodd
e.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o ree
gerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o stt
ruct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ass
cii.o us_ascii.o unicode.o utf_8.o newline.o dmyext.o -lpthread -ldl -lobjc -o miniruby
rbconfig.rb unchanged
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./enc/make_encmake.rb --builtin-encs="asciii
.o us_ascii.o unicode.o utf_8.o" --builtin-transes="newline.o" enc.mk
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb -I. ./tool/compile_prelude.rb ./prelude.rb
./enc/prelude.rb ./gem_prelude.rb prelude.c
/usr/bin/gcc-4.2 -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386 -fno-common -pipe -I. -I.ext/incll
ude/x86_64-darwin11.0.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o prelude..
o -c prelude.c
ar rcu libruby.1.9.1-static.a dln.o encoding.o version.o array.o bignum.o class.o compar.o complex.o dd
ir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshh
al.o math.o node.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomm
p.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftimm
e.o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o thrr
ead.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o prelude.o dmyext.o
<TYPE THIS BY HAND>
/usr/bin/gcc-4.2 -arch i386 -dynamiclib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_naa
mespace -install_name /Users/randy/.rvm/rubies/ruby-1.9.2-p290/lib/libruby.1.9.1.dylib -current_versioo
n 1.9.1 -compatibility_version 1.9.1 -Wl,-unexported_symbol,_Init_* -Wl,-unexported_symbol,*_threadptrr
_* -Wl,-u,_objc_msgSend dln.o encoding.o version.o array.o bignum.o class.o compar.o complex.o dirr
.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshall
.o math.o node.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp..
o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime..
o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o threaa
d.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o prelude.o dmyext.o -o libruby.1.9.1.dylib
ld: warning: ignoring file dln.o, file was built for i386 which is not the architecture being linked ((
x86_64)
ld: warning: ignoring file encoding.o, file was built for i386 which is not the architecture being linn
ked (x86_64)
ld: warning: ignoring file version.o, file was built for i386 which is not the architecture being linkk
ed (x86_64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment