Archflags for compiling gems 64 bit

Hi,

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?

thanks

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
architecture.

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
special ARCHFLAGS.

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.

Hi,

Thanks that help put my mind at rest. I did compile the 1.9.1 ruby in
Linux 64 and all seems fine. I did not use any archflags and it built a
x86_64-linux binary just fine. I did set the flag as you stated for OS
X and it went as advertised as well 1.9.1 was built as x86_64

Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs