On 03/04/2010 03:29 PM, Dale A. wrote:
I am trying to understand if the archflags=’-arch x86_64’ flag is used
both in Linux and OSX or is this a OS X only flag. I want to make sure
I compile gems correctly. I am also working with the RVM scripts to
work with different rubies.
I found this flag in the context of mysql gem but didn’t know if any/all
gem compilation would require this?
You typically don’t need to use this flag on any other platform (though
it’s valid) unless you’re compiling for another machine with a different
The reason you typically have to use it on MacOS X is that you’re trying
to compile an extension that’s linked against a library compiled for a
single architecture with the Ruby that’s distributed on MacOS X that’s
compiled as a “universal binary” (both i386 and x86_64 architectures).
The linker can’t find both architectures in the library you’re trying to
link against, so it fails.
This happens a lot with libraries installed via add-on third-party
packaging systems like MacPorts and Homebrew, because they don’t install
“universal” versions of their packages by default. I don’t have much
experience with HomeBrew, but quite a few MacPorts have a ‘universal’
variant that will link correctly against the system Ruby without any
I work a lot on a Mac myself, so when I rewrote the build system for pg
0.9.0, I added a bit of code to try to figure out what the right
ARCHFLAGS is for your PostgreSQL installation, but it also honors
manually-set ARCHFLAGS environment variables in case you need to
override it for some reason.
Hope this helps.