freebsd gcc cross compiler creates binaries that crash when using c++ exceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have set up a cross compile toolchain that targets freebsd and runs on my linux host that doesn't work correctly. This is what I did:


0. Prerequisites
I want the toolchain to reside in /home/ubuntu/crossroot. So I copied these files from a FreeBSD 7.1 installation to this directory:
/usr/include/...
/usr/lib/...
/lib/...


1. create binutils in (2.21)
../../src/binutils/configure --target=i386-pc-freebsd7.1 --disable-nls --prefix=/home/ubuntu/crossroot --with-sysroot=/home/ubuntu/crossroot
make 
make install

2. create gcc (4.2.4)
../..src/gcc/configure --target=i386-pc-freebsd7.1 --disable-nls --prefix=/home/ubuntu/crossroot --with-sysroot=/home/ubuntu/crossroot --enable-languages=c,c++
make
make install

There are no errors in this process. But when I try to compile a simple test program using c++ exceptions and run it on the target machine I get a segmentation fault after the exception is catched. I statically linked libstdc++ and libgcc. The dynamically linked version seems to run but only because libgcc.so and libstdc++.so from the target machine are picked. If I copy over the versions from the created toolchain I get the same crashes again. If no exceptions are thrown everything works as it should.

To figure out what I did wrong I tried this:

A) Use the same sources for gcc and binutils and build a cross toolchain for linux (a different linux). This toolchain works as it should.
B) Build the same toolchain natively on the FreeBSD system I got the dependencies from. This toolchain works too.

So I took all compiler support libraries (like libstdc++.*, libgcc.*, ...) from the working native freebsd build of the toolchain and copied them over to the cross toolchain for freebsd. This seemed to cure the problem. So I guess something must have went wrong when building libgcc. 

Is there some flaw in the way I built this toolchain? Where could I try to start looking for the source of the problem? I can add all sorts of other outputs from the created toolchains if it helps.

Thank you

Markus

P.S.: This list is really awesome. I had multiple questions in the last days and they all have been answered quickly.






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux