[Rd] build 32-bit R on x86_64?
Vinh Nguyen
vqnguyen at uci.edu
Thu Nov 3 19:52:44 CET 2011
Hi everyone,
I was trying to reproduce building a 32 bit version of R on a 64 bit
Ubuntu 11.04 machine (which worked before) with the latest version of
R in SVN but am getting this error:
make[3]: Leaving directory `/home/vinh/Downloads/R/trunk/src/modules/lapack'
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSM.so
when searching for -lSM
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSM.a
when searching for -lSM
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libICE.so
when searching for -lICE
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libICE.a
when searching for -lICE
/usr/bin/ld: skipping incompatible
/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so when searching for
-lpangocairo-1.0
...
It should be looking in /usr/lib32, not /usr/lib. I did the following
to arrive at these messages:
sudo apt-get install ia32-libs lib32readline6-dev lib32ncurses5-dev
lib32icu-dev gcc-multilib gfortran-multilib ## ubuntu does not have
ia32-libs-dev
./configure r_arch=i386 CC='gcc -std=gnu99 -m32' CXX='g++ -m32'
FC='gfortran -m32' F77='gfortran -m32'
make -j24
Any suggestions on how to fix this? Thanks.
-- Vinh
On Wed, Aug 10, 2011 at 8:37 AM, Vinh Nguyen <vqnguyen at uci.edu> wrote:
> On Tue, Aug 9, 2011 at 6:24 PM, Simon Urbanek
> <simon.urbanek at r-project.org> wrote:
>> It actually works ;) I'm using it for testing on my RForge.net machine and yes, it's Debian - everything just works there :).
>>
>> But back to the original question. First a minor detail, don't set environment variables use configure variables instead. Second, don't build in the source directory, always create an object directory. Third, r_arch is simply a name you set for the architecture, it has no meaning other than that it's a label.
>>
>> So now to the real stuff. If you want 32-bit build, you'll need 32-bit runtime of everything important in your system and the multilib compilers. In Debian (and thus likely in Ubuntu too) that can be achieved by something like
>>
>> sudo apt-get install ia32-libs-dev lib32readline6-dev lib32ncurses5-dev lib32icu-dev gcc-multilib gfortran-multilib
>>
>> Then you can build both 64-bit and 32-bit R, the difference will be in the all compiler flags -- for 64-bit you'll use -m64 (or nothing since it's the default) and for 32-bit you'll use -m32.
>>
>> So roughly something like
>>
>> tar fxz R-2.13.1.tar.gz
>> mkdir obj-32
>> cd obj-32
>> ../R-2.13.1/configure r_arch=i386 CC='gcc -std=gnu99 -m32' CXX='g++ -m32' FC='gfortran -m32' F77='gfortran -m32'
>> make -j24 && sudo make install rhome=/usr/local/R/2.13
>> cd ..
>> mkdir obj-64
>> cd obj-64
>> ../R-2.13.1/configure r_arch=amd64
>> make -j24 && sudo make install rhome=/usr/local/R/2.13
>>
>> That will leave you with multi-arch R that you can run with
>> R --arch=i386 # 32-bit
>> R --arch=amd64 # 64-bit
>> Packages will be also built as multi-libs. Good luck :)
>> [BTW the rhome=... setting is entirely optional, I just like to keep my R versions organized…]
>>
>> Cheers,
>> Simon
>>
>
> Thanks Simon! Confirm that these instructions work. ia32-libs-dev
> was not available for Ubuntu Natty, so I installed ia32-libs instead,
> and the compilation works!
>
> -- Vinh
More information about the R-devel
mailing list