archflags for compiling gems 64 bit

D

Dale Ackerman

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
 
M

Michael Granger

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

Dale Ackerman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top