问题
I downloaded ruby 2.0.0 and ran
./configure
make
make install
On a 64 bit linux machine this build a 64 bit version. On AIX, this built a 32 bit version. How do I configure it to compile in 64 bit mode?
I tried
export OBJECT_MODE=64
./configure
but it failed with checking for gcc... gcc checking whether the C compiler works... no
Update: I managed to get this to compile with the following:
export OBJECT_MODE=64 ## not sure if I needed this or not
./configure --disable-install-doc CC="gcc" CFLAGS="-maix64 -mminimal-toc" CXX="g++" CXXFLAGS="-maix64 -mminimal-toc" NM="nm -X64" AR="ar -X64" LDFLAGS="-maix64" EXTLDFLAGS="-maix64"
make
make test
make install
the tests passed and it seems to be running fine unfortunately my swig generated extension (which runs fine on linux) has problems. It compiles and links cleanly but I get an error on the require:
.....ruby/aix/lib/ruby/site_ruby/2.0.0/powerpc-aix6.1.0.0/wv.so. Not enough space[loadquery failed]
.....ruby/aix/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require'
maybe I will start a new question on that problem
回答1:
This is going to be an uphill struggle.
First, see if you can build a simple hello world with -mpowerpc64 -maix64 added to the gcc command line. e.g.
gcc -mpowerpc64 -maix64 -o foo foo.c
The reason I suggest that is I have to do extra work to build my gcc to get all the libraries it uses in 64 bit mode. Even if that does work, you still might not have all the libraries available that you need to get ruby and all its extensions to work.
I got past first base with:
CFLAGS='-mpowerpc64 -maix64' configure ...
but it died with the toc too big which I got past by adding -Wl,-bbigtoc. But then ar fails because no one passed it a -X 64 flag. You can get past that by editing the Makefile and change what AR is set to to be ar -X64. etc.
The gist here is to use configure to get close and then edit the Makefile and other files by hand to add in the flags you need. I'm sure there are one step solutions but this will save you from starting back over each time.
来源:https://stackoverflow.com/questions/21471194/how-do-i-configure-ruby-to-compile-in-64-bit-mode-on-aix