[Rd] Cross-compilation

Hin-Tak Leung hin-tak.leung at cimr.cam.ac.uk
Thu Nov 2 16:38:01 CET 2006

You might be better off using the same g++ as distributed and found on 
Prof Ripley's web site, rather than the newer 4.x:

$ /home/hin-tak/mingw-cross/bin/i586-mingw32-c++  --version
i586-mingw32-c++ (GCC) 3.4.5 (mingw special)

Name-mangling and C++ ABI had changed between gcc 3.x and 4.x, so 
compiling c++ programs might be different.

It had worked out-of-the-box for me when I was using fedora 5 x86_64
(I just upgraded to fedora 6 yesterday, and I haven't tried doing
any cross-compiling yet). So fc4 probably should work.

Hin-Tak Leung

Tom McCallum wrote:
> Thanks for your reply, as an example it appears to have difficulty linking  
> to even ostream library of the standard C++, as shown below:
> /home/tmccallum/ritzel/RItzel/src/Classifier.cpp:209: undefined reference  
> to `_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
> Classifier.o: In function `operator<<':
> /usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/ostream:218:  
> undefined reference to `_ZNSolsEd'
> /usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/ostream:196:  
> undefined reference to `_ZNSolsEl'
> I am currently working R-2.4.0 as downloaded today.
> I know the g++ has gone through some alterations and wondered if you knew  
> the version of g++ you cross-compiled your package with for comparison -  
> mine is g++ (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8).
> Many thanks
> Tom
> On Wed, 25 Oct 2006 18:10:40 +0100, Ramon Diaz-Uriarte <rdiaz at cnio.es>  
> wrote:
>> Dear Tom,
>> It has worked for me out-of-the box in at least two times, one a while  
>> ago
>> with R-2.2-something and recently with R-2.4.0. In both cases, I was  
>> running
>> Debian (with a mix of testing and unstable) on x86. I never had to do
>> anything, just run the script and at least in one case I did  
>> crosscompile a
>> package with C++.
>> R.
>> On Wednesday 25 October 2006 18:03, Tom McCallum wrote:
>>> Hi everyone,
>>> I am trying to cross-compile a package I wrote using the Yan and Rossini
>>> tutorial "Building Microsoft Windows versions of R and R packages using
>>> Intel Linux".  I have got reasonably far with this but when doing the
>>> linking using the line:
>>> i586-mingw32-g++  -shared -s  -o mylibrary.dll mylibrary.def mylibrary.o
>>> mylibrary_res.o  -L/my/path/RCrossBuild/WinR/R-2.4.0/bin -lR
>>> I get lots of these type of messages:
>>> /my/path/to/mylibrary.cpp:43: undefined reference to
>>> and other similar linker errors for virtually every object and command  
>>> in
>>> the program.  After some googling I have found that there may be  
>>> problems
>>> with the libgcc.a library and its default -fPIC argument during
>>> compilation.
>>> Has anyone got this tutorial to work and if so how did they overcome  
>>> this?
>>> I am attempting to do this on Fedora Core 4 on a 32-bit machine, having
>>> completed all the previous sections of the tutorial for building a
>>> cross-platform version of R.
>>> Many thanks
>>> Tom

More information about the R-devel mailing list