Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Crossdev trouble with __cxa_atexit
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
momesana
Apprentice
Apprentice


Joined: 20 Sep 2004
Posts: 210
Location: Germany (Bremen)

PostPosted: Sat Mar 12, 2011 11:11 am    Post subject: Crossdev trouble with __cxa_atexit Reply with quote

Hi,
I have a mediaplayer based on the RTD1073 CPU and really would like to be able to compile C++ Programs for it.

CPU Details:
Code:
/ # cat /proc/cpuinfo
system type             : Realtek Venus
processor               : 0
cpu model               : MIPS 24K V7.8
BogoMIPS                : 269.51
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes
ASEs implemented        : mips16
VCED exceptions         : not available
VCEI exceptions         : not available


I set up an crossdevelopment environment by emerging cross-mipsel-linux-uclibc/gcc-4.5.2 using crossdev.
The useflags for it currently look like this:
Code:
[ Found these USE variables for cross-mipsel-linux-uclibc/gcc-4.5.2 ]
 U I
 - - altivec     : Adds support for optimizations for G4 and G5/ppc970 processors
 - - bootstrap   : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used during original system bootstrapping [make stage2]
 - - build       : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping [make stage1]
 - - doc         : Adds extra documentation (API, Javadoc, etc)
 - - fixed-point : <unknown>
 + + fortran     : Adds support for fortran (formerly f77)
 - - gcj         : Enable building with gcj (The GNU Compiler for the Javatm Programming Language)
 - - graphite    : <unknown>
 - - gtk         : Adds support for x11-libs/gtk+ (The GIMP Toolkit)
 - - hardened    : activate default security enhancements for toolchain (gcc, glibc, binutils)
 - - libffi      : <unknown>
 - - lto         : <unknown>
 - - mudflap     : <unknown>
 - - multilib    : On 64bit systems, if you want to be able to compile 32bit and 64bit binaries
 - - multislot   : <unknown>
 - - n32         : <unknown>
 - - n64         : <unknown>
 + + nls         : Adds Native Language Support (using gettext - GNU locale utilities)
 - - nocxx       : Disable support for C++ (DON'T USE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)
 - - nopie       : <unknown>
 - - nossp       : <unknown>
 + + nptl        : Enable support for Native POSIX Threads Library, the new threading module (requires linux-2.6 or better usually)
 - - objc        : <unknown>
 - - objc++      : <unknown>
 - - objc-gc     : <unknown>
 + + openmp      : Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp"
 - - test        : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in make.conf/package.use anymore
 - - vanilla     : Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically


cross-mipsel-linux-uclibc/uclibc-0.9.30.1-r1 has been built with these useflags:
Code:
[ Found these USE variables for cross-mipsel-linux-uclibc/uclibc-0.9.30.1-r1 ]
 U I
 - - build                          : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping [make stage1]
 - - crosscompile_opts_headers-only : Build the toolchain against cross-headers only.
 - - debug                          : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml
 - - elibc_uclibc                   : ELIBC setting for systems that use the uClibc C library
 - - hardened                       : activate default security enhancements for toolchain (gcc, glibc, binutils)
 + + ipv6                           : Adds support for IP version 6
 - - minimal                        : Install a very minimal build (disables, for example, plugins, fonts, most drivers, non-critical features)
 - - savedconfig                    : Use this to restore your config from /etc/portage/savedconfig ${CATEGORY}/${PN}. Make sure your USE flags allow for appropriate dependencies
 - - ssp                            : <unknown>
 - - uclibc-compat                  : <unknown>
 - - wordexp                        : <unknown>


The complete build logs for all these crossdev packages can be found here (I've concatenated the individual log files but it's indicated where the single log file sections begin. Total size is about 8,4MB): http://www.fileshost.com/download.php?id=ACA925DF1

I can successfully compile C programs for the targetplatform and they work without any problems. Using the C++ compiler however the resulting binary have the symbol __cxa_atexit which is not supported on the target platform. The GCC Compiler was compiled with the __cxa_atexit feature disabled as can easily be seen below:

Code:
mipsel-linux-uclibc-g++ -v                                                 
Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/mipsel-linux-uclibc/gcc-bin/4.5.2/mipsel-linux-uclibc-g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/lto-wrapper
Target: mipsel-linux-uclibc
Configured with: /var/tmp/cross/mipsel-linux-uclibc/portage/cross-mipsel-linux-uclibc/gcc-4.5.2/work/gcc-4.5.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/mipsel-linux-uclibc/gcc-bin/4.5.2 --includedir=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include --datadir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2 --mandir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2/man --infodir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2/info --with-gxx-include-dir=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4 --host=i686-pc-linux-gnu --target=mipsel-linux-uclibc --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/mipsel-linux-uclibc/4.5.2/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --with-sysroot=/usr/mipsel-linux-uclibc --disable-bootstrap --disable-__cxa_atexit --enable-target-optspace --enable-tls --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.2 p1.1, pie-0.4.5'
Thread model: posix
gcc version 4.5.2 (Gentoo 4.5.2 p1.1, pie-0.4.5)


Ok, Following example code is supposed to be compiled for the target:
Code:
#include <iostream>
using namespace std;

int main(int argc, char **argv) {
        cout << "Hello World" << endl;
        return 0;
}


I do it as follows:
Code:
momesana@gentoo-box ~/projects/mips/helloworld $  mipsel-linux-uclibc-g++ -v -static-libstdc++ -static-libgcc test.cpp -o test
Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/mipsel-linux-uclibc/gcc-bin/4.5.2/mipsel-linux-uclibc-g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/lto-wrapper
Target: mipsel-linux-uclibc
Configured with: /var/tmp/cross/mipsel-linux-uclibc/portage/cross-mipsel-linux-uclibc/gcc-4.5.2/work/gcc-4.5.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/mipsel-linux-uclibc/gcc-bin/4.5.2 --includedir=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include --datadir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2 --mandir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2/man --infodir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2/info --with-gxx-include-dir=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4 --host=i686-pc-linux-gnu --target=mipsel-linux-uclibc --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/mipsel-linux-uclibc/4.5.2/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --with-sysroot=/usr/mipsel-linux-uclibc --disable-bootstrap --disable-__cxa_atexit --enable-target-optspace --enable-tls --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.2 p1.1, pie-0.4.5'
Thread model: posix
gcc version 4.5.2 (Gentoo 4.5.2 p1.1, pie-0.4.5)
COLLECT_GCC_OPTIONS='-v' '-static-libgcc' '-o' 'test' '-mllsc' '-mno-synci' '-mno-shared'
 /usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -D_FORTIFY_SOURCE=2 -quiet -dumpbase test.cpp -mllsc -mno-synci -mno-shared -auxbase test -version -o /tmp/ccTxfKvD.s
GNU C++ (Gentoo 4.5.2 p1.1, pie-0.4.5) version 4.5.2 (mipsel-linux-uclibc)
        compiled by GNU C version 4.5.1, GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/mipsel-linux-uclibc/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/../../../../mipsel-linux-uclibc/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4/mipsel-linux-uclibc
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4/backward
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include-fixed
 /usr/mipsel-linux-uclibc/usr/include
End of search list.
GNU C++ (Gentoo 4.5.2 p1.1, pie-0.4.5) version 4.5.2 (mipsel-linux-uclibc)
        compiled by GNU C version 4.5.1, GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ec67a0feaf45cce4c34b4d13d7fd9150
COLLECT_GCC_OPTIONS='-v' '-static-libgcc' '-o' 'test' '-mllsc' '-mno-synci' '-mno-shared'
 /usr/libexec/gcc/mipsel-linux-uclibc/as -EL -no-mdebug -mabi=32 -mno-shared -v -KPIC -o /tmp/cc1l6fXV.o /tmp/ccTxfKvD.s
GNU assembler version 2.21 (mipsel-linux-uclibc) using BFD version (GNU Binutils) 2.21
COMPILER_PATH=/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/:/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/:/usr/libexec/gcc/mipsel-linux-uclibc/:/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/:/usr/lib/gcc/mipsel-linux-uclibc/
LIBRARY_PATH=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/:/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/../../../../mipsel-linux-uclibc/lib/:/usr/mipsel-linux-uclibc/lib/:/usr/mipsel-linux-uclibc/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-static-libgcc' '-o' 'test' '-mllsc' '-mno-synci' '-mno-shared'
 /usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/collect2 --sysroot=/usr/mipsel-linux-uclibc --eh-frame-hdr -EL -dynamic-linker /lib/ld-uClibc.so.0 -o test /usr/mipsel-linux-uclibc/usr/lib/crt1.o /usr/mipsel-linux-uclibc/usr/lib/crti.o /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/crtbegin.o -L/usr/lib/gcc/mipsel-linux-uclibc/4.5.2 -L/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/../../../../mipsel-linux-uclibc/lib -L/usr/mipsel-linux-uclibc/lib -L/usr/mipsel-linux-uclibc/usr/lib /tmp/cc1l6fXV.o -Bstatic -lstdc++ -Bdynamic -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/crtend.o /usr/mipsel-linux-uclibc/usr/lib/crtn.o


Now we transfer the code to the target device and try to run it:
Code:

/tmp # ./test
./test: can't resolve symbol '__cxa_atexit'


Inspecting the binary we just created it's easy to realize that __cxa_exit is still being used (despite being disabled in gcc):
Code:
momesana@gentoo-box ~/projects/mips/helloworld $ mipsel-linux-uclibc-nm -anC test | grep __cxa_atexit
         U __cxa_atexit


Any Ideas?

Thanks in advance
_________________
in the world I see, you're stalking elk throught the grand canyon forests, around the ruins of the rockefeller center. You'll wear leather clothes, that will last you the rest of your life... (Tylers Vision)
Back to top
View user's profile Send private message
Wormo
Retired Dev
Retired Dev


Joined: 29 Nov 2004
Posts: 526
Location: SB County California

PostPosted: Sat Mar 12, 2011 6:55 pm    Post subject: Reply with quote

Try adding "-fno-use-cxa-atexit" to your CXXFLAGS
Back to top
View user's profile Send private message
momesana
Apprentice
Apprentice


Joined: 20 Sep 2004
Posts: 210
Location: Germany (Bremen)

PostPosted: Sat Mar 12, 2011 9:07 pm    Post subject: Reply with quote

Wormo wrote:
Try adding "-fno-use-cxa-atexit" to your CXXFLAGS

Hi and thanks for your resonse.
I tried this:

Code:
momesana@gentoo-box ~/projects/mips/helloworld $ export CXXFLAGS="-fno-use-cxa-atexit"
momesana@gentoo-box ~/projects/mips/helloworld $ echo $CXXFLAGS
-fno-use-cxa-atexit
momesana@gentoo-box ~/projects/mips/helloworld $ mipsel-linux-uclibc-c++ -static-libstdc++ -static-libgcc test.cpp               
momesana@gentoo-box ~/projects/mips/helloworld $ mipsel-linux-uclibc-nm -anC test | grep exit
         U __cxa_atexit
00000000 a atexit.c
00472df0 T atexit


Didn't help at all as you can see in the output of nm above :(
_________________
in the world I see, you're stalking elk throught the grand canyon forests, around the ruins of the rockefeller center. You'll wear leather clothes, that will last you the rest of your life... (Tylers Vision)
Back to top
View user's profile Send private message
Wormo
Retired Dev
Retired Dev


Joined: 29 Nov 2004
Posts: 526
Location: SB County California

PostPosted: Sun Mar 13, 2011 5:57 am    Post subject: Reply with quote

Sorry, I was thinking of using a Makefile when I mentioned CXXFLAGS -- you'll have to insert it directly as a g++ argument since you're running the compile command yourself. It still might not work, but it seems like it should...
Back to top
View user's profile Send private message
momesana
Apprentice
Apprentice


Joined: 20 Sep 2004
Posts: 210
Location: Germany (Bremen)

PostPosted: Sun Mar 13, 2011 12:15 pm    Post subject: Reply with quote

Wormo wrote:
Sorry, I was thinking of using a Makefile when I mentioned CXXFLAGS -- you'll have to insert it directly as a g++ argument since you're running the compile command yourself. It still might not work, but it seems like it should...

Nah, doesn't work either. I experimented around a little by installing different versions of gcc and tested those as well. Here are my findings:

Available GCC-Compilers:
Code:

 [1] i686-pc-linux-gnu-4.4.4
 [2] i686-pc-linux-gnu-4.5.1 *
 [3] mipsel-linux-uclibc-3.4.6
 [4] mipsel-linux-uclibc-3.4.6-hardened
 [5] mipsel-linux-uclibc-3.4.6-hardenednopie
 [6] mipsel-linux-uclibc-3.4.6-hardenednopiessp
 [7] mipsel-linux-uclibc-3.4.6-hardenednossp
 [8] mipsel-linux-uclibc-4.1.2
 [9] mipsel-linux-uclibc-4.3.4
 [10] mipsel-linux-uclibc-4.4.5
 [11] mipsel-linux-uclibc-4.5.2 *


The ones we are going to test:
Code:

 [3] mipsel-linux-uclibc-3.4.6
 [8] mipsel-linux-uclibc-4.1.2
 [9] mipsel-linux-uclibc-4.3.4
 [10] mipsel-linux-uclibc-4.4.5
 [11] mipsel-linux-uclibc-4.5.2 *


I've written a simple shell script to create, compile and test a minimal c++ file (As you can see I am obviously not a bash expert):
Code:

#!/bin/bash

# setting vars
CC=mipsel-linux-uclibc-c++
CXXFLAGS="-fno-use-cxa-atexit"
LD=mipsel-linux-uclibc-ldd
NM="mipsel-linux-uclibc-nm -anC"
SRC=test.cpp
BIN=test
MINIMAL="off"

# functions
function printUsage {
    echo "Usage: ./test_symbol [--minimal-example]"
}

function parseArgs {
    if [ $# -gt 1 ]; then
       echo "Error: Too many arguments!"
   printUsage
   exit
    fi

    if [ $# -eq 1 ]; then
       if [ "$1" != "--minimal-example" ]; then
       echo "Error: Unknown argument!"
       printUsage
       exit 1
   else
       echo "Running in Minimal mode!"
       MINIMAL="on"
   fi
    fi
}

function createSource {

MINIMAL_CPP="int main() { return 0; }\n"

NORMAL_CPP="
#include <iostream>\n
using namespace std;\n
\n
int main(int argc, char **argv) {\n
\tcout << \"Hello Cruel GCC World!\" << endl;\n
\treturn 0;\n
}\n"
   if [ "$MINIMAL" == "on" ]; then
      echo -e $MINIMAL_CPP >> $SRC
    else
       echo -e $NORMAL_CPP >> $SRC
    fi

    if [ ! -e "test.cpp" ]; then
       error "Can't create source file"
    fi
}

function error {
    echo "Script failed due to the following error: $1!"
    exit 1
}

# check command line arguments
parseArgs $@

# cleaning up
source /etc/profile
rm -f libstdc++.a
rm -f test.cpp
rm -f test

# creating file to be compiled
createSource

# making symlink
ln -s $($CC -print-file-name=libstdc++.a) || error "Can't create symlink to libstdc++";

# compiling
$CC -static-libgcc -L. -o $BIN $SRC || error "Can't compile source file" # not using $CXXFLAGS

# inspecting
echo "testing for __cxa_atexit in binary:"
NM_OUTPUT=$($NM test | grep __cxa_atexit)
if [ "" == "$NM_OUTPUT" ]; then
    echo "Passed! :-)"
else
    echo "Failed! :-("
    echo "nm output: $NM_OUTPUT"
fi


Now we call the code with the different versions of GCC to see how they performs:
Code:

gentoo-box helloworld # for i in 3 8 9 10 11; do echo "===== Testing GCC Profile [$i] ===="; gcc-config $i &> /dev/null; ./test_symbol; done


I get this output on my system
Code:
 
===== Testing GCC Profile [3] ====
./libstdc++.a(eh_personality.o): In function `__gxx_personality_v0':
(.text.__gxx_personality_v0+0x118): undefined reference to `_Unwind_GetIPInfo'
./libstdc++.a(eh_personality.o): In function `__gxx_personality_v0':
(.text.__gxx_personality_v0+0x120): undefined reference to `_Unwind_GetIPInfo'
collect2: ld gab 1 als Ende-Status zurück
Script failed due to the following error: Can't compile source file!
===== Testing GCC Profile [8] ====
testing for __cxa_atexit in binary:
Passed! :-)
===== Testing GCC Profile [9] ====
testing for __cxa_atexit in binary:
Passed! :-)
===== Testing GCC Profile [10] ====
./libstdc++.a(eh_globals.o): In function `__cxa_get_globals_fast':
(.text.__cxa_get_globals_fast+0x18): undefined reference to `__tls_get_addr'
./libstdc++.a(eh_globals.o): In function `__cxa_get_globals':
(.text.__cxa_get_globals+0x18): undefined reference to `__tls_get_addr'
collect2: ld gab 1 als Ende-Status zurück
Script failed due to the following error: Can't compile source file!
===== Testing GCC Profile [11] ====
testing for __cxa_atexit in binary:
Failed! :-(
nm output:          U __cxa_atexit


Now, let's test their ability to compile the most minimal piece of c++ code possible:
Code:

for i in 3 8 9 10 11; do echo "===== Testing GCC Profile [$i] ===="; gcc-config $i &> /dev/null; ./test_symbol --minimal-example; done


It yields the following output:
Code:

===== Testing GCC Profile [3] ====
Running in Minimal mode!
testing for __cxa_atexit in binary:
Passed! :-)
===== Testing GCC Profile [8] ====
Running in Minimal mode!
testing for __cxa_atexit in binary:
Passed! :-)
===== Testing GCC Profile [9] ====
Running in Minimal mode!
testing for __cxa_atexit in binary:
Passed! :-)
===== Testing GCC Profile [10] ====
Running in Minimal mode!
testing for __cxa_atexit in binary:
Passed! :-)
===== Testing GCC Profile [11] ====
Running in Minimal mode!
testing for __cxa_atexit in binary:
Passed! :-)



Now let's test the binary created with gcc-4.3.4 on the target device:
Code:

/tmp # uname -a
Linux Venus 2.6.12.6-VENUS #1 Mon Aug 2 13:32:07 CST 2010 mips unknown
/tmp # ./test
Hello Cruel GCC World!


Let's compare it with the binary created by gcc-4.5.2
Code:

/tmp # ./test
./test: can't resolve symbol '__cxa_atexit'


All instances of g++ manage to compile a minimal C/C++ source. Regarding the normal cpp file (that uses iostream), only two versions ( mipsel-linux-uclibc-4.1.2 and mipsel-linux-uclibc-4.3.4) manage to compile a binary I can use on the target device. mipsel-linux-uclibc-3.4.6 and mipsel-linux-uclibc-4.4.5 fail to compile the binary in the first place whereas mipsel-linux-uclibc-4.5.2 succeeds in compiling the source but uses the __cxa_atexit symbol thereby rendering the binary useless on my specific target device. Using -fno-use-cxa-atexit or -fuse-cxa-atexit didn't make any difference. I tried both.

Regards
- momesana
_________________
in the world I see, you're stalking elk throught the grand canyon forests, around the ruins of the rockefeller center. You'll wear leather clothes, that will last you the rest of your life... (Tylers Vision)
Back to top
View user's profile Send private message
momesana
Apprentice
Apprentice


Joined: 20 Sep 2004
Posts: 210
Location: Germany (Bremen)

PostPosted: Sun Mar 13, 2011 4:32 pm    Post subject: Reply with quote

Ok, the problem seems to be related to the libstdc++ library in use.
I can use whatever GCC version I want as long as the static stdc++ lib I pull in is one that is supported (4.1.x or 4.3.x):

Code:

gentoo-box helloworld # mipsel-linux-uclibc-c++ -v -static-libgcc -L./libs/stdc++/4.3.5 -lstdc++ -o test test.cpp
gentoo-box helloworld # mipsel-linux-uclibc-c++ -v -static-libgcc -L./libs/stdc++/4.3.5 -lstdc++ -o test test.cpp
Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/mipsel-linux-uclibc/gcc-bin/4.5.2/mipsel-linux-uclibc-c++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/lto-wrapper
Target: mipsel-linux-uclibc
Configured with: /var/tmp/cross/mipsel-linux-uclibc/portage/cross-mipsel-linux-uclibc/gcc-4.5.2/work/gcc-4.5.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/mipsel-linux-uclibc/gcc-bin/4.5.2 --includedir=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include --datadir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2 --mandir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2/man --infodir=/usr/share/gcc-data/mipsel-linux-uclibc/4.5.2/info --with-gxx-include-dir=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4 --host=i686-pc-linux-gnu --target=mipsel-linux-uclibc --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/mipsel-linux-uclibc/4.5.2/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --with-sysroot=/usr/mipsel-linux-uclibc --disable-bootstrap --disable-__cxa_atexit --enable-target-optspace --enable-tls --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.2 p1.1, pie-0.4.5'
Thread model: posix
gcc version 4.5.2 (Gentoo 4.5.2 p1.1, pie-0.4.5)
COLLECT_GCC_OPTIONS='-v' '-static-libgcc' '-L./libs/stdc++/4.3.5' '-o' 'test' '-mllsc' '-mno-synci' '-mno-shared'
 /usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -D_FORTIFY_SOURCE=2 -quiet -dumpbase test.cpp -mllsc -mno-synci -mno-shared -auxbase test -version -o /tmp/ccrLg8xk.s
GNU C++ (Gentoo 4.5.2 p1.1, pie-0.4.5) version 4.5.2 (mipsel-linux-uclibc)
        compiled by GNU C version 4.5.1, GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/mipsel-linux-uclibc/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/../../../../mipsel-linux-uclibc/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4/mipsel-linux-uclibc
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include/g++-v4/backward
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include
 /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/include-fixed
 /usr/mipsel-linux-uclibc/usr/include
End of search list.
GNU C++ (Gentoo 4.5.2 p1.1, pie-0.4.5) version 4.5.2 (mipsel-linux-uclibc)
        compiled by GNU C version 4.5.1, GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ec67a0feaf45cce4c34b4d13d7fd9150
COLLECT_GCC_OPTIONS='-v' '-static-libgcc' '-L./libs/stdc++/4.3.5' '-o' 'test' '-mllsc' '-mno-synci' '-mno-shared'
 /usr/libexec/gcc/mipsel-linux-uclibc/as -EL -no-mdebug -mabi=32 -mno-shared -v -KPIC -o /tmp/ccu9PMgK.o /tmp/ccrLg8xk.s
GNU assembler version 2.21 (mipsel-linux-uclibc) using BFD version (GNU Binutils) 2.21
COMPILER_PATH=/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/:/usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/:/usr/libexec/gcc/mipsel-linux-uclibc/:/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/:/usr/lib/gcc/mipsel-linux-uclibc/
LIBRARY_PATH=/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/:/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/../../../../mipsel-linux-uclibc/lib/:/usr/mipsel-linux-uclibc/lib/:/usr/mipsel-linux-uclibc/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-static-libgcc' '-L./libs/stdc++/4.3.5' '-o' 'test' '-mllsc' '-mno-synci' '-mno-shared'
 /usr/libexec/gcc/mipsel-linux-uclibc/4.5.2/collect2 --sysroot=/usr/mipsel-linux-uclibc --eh-frame-hdr -EL -dynamic-linker /lib/ld-uClibc.so.0 -o test /usr/mipsel-linux-uclibc/usr/lib/crt1.o /usr/mipsel-linux-uclibc/usr/lib/crti.o /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/crtbegin.o -L./libs/stdc++/4.3.5 -L/usr/lib/gcc/mipsel-linux-uclibc/4.5.2 -L/usr/lib/gcc/mipsel-linux-uclibc/4.5.2/../../../../mipsel-linux-uclibc/lib -L/usr/mipsel-linux-uclibc/lib -L/usr/mipsel-linux-uclibc/usr/lib -lstdc++ /tmp/ccu9PMgK.o -lstdc++ -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc/mipsel-linux-uclibc/4.5.2/crtend.o /usr/mipsel-linux-uclibc/usr/lib/crtn.o
gentoo-box helloworld # mipsel-linux-uclibc-nm -naC test | grep __cxa_atexit
gentoo-box helloworld #


Regards
- momesana
_________________
in the world I see, you're stalking elk throught the grand canyon forests, around the ruins of the rockefeller center. You'll wear leather clothes, that will last you the rest of your life... (Tylers Vision)
Back to top
View user's profile Send private message
Wormo
Retired Dev
Retired Dev


Joined: 29 Nov 2004
Posts: 526
Location: SB County California

PostPosted: Mon Mar 14, 2011 2:14 am    Post subject: Reply with quote

momesana wrote:
Ok, the problem seems to be related to the libstdc++ library in use.
I can use whatever GCC version I want as long as the static stdc++ lib I pull in is one that is supported (4.1.x or 4.3.x):

Code:

gentoo-box helloworld # mipsel-linux-uclibc-c++ -v -static-libgcc -L./libs/stdc++/4.3.5 -lstdc++ -o test test.cpp
gentoo-box helloworld # mipsel-linux-uclibc-c++ -v -static-libgcc -L./libs/stdc++/4.3.5 -lstdc++ -o test test.cpp



That does make sense, but what stdc++ library was getting pulled in by default? There still might be a toolchain bug lurking, if the static libstdc++ built with your 4.5 toolchain came out broken...
Back to top
View user's profile Send private message
momesana
Apprentice
Apprentice


Joined: 20 Sep 2004
Posts: 210
Location: Germany (Bremen)

PostPosted: Mon Mar 14, 2011 4:44 pm    Post subject: Reply with quote

Wormo wrote:
momesana wrote:
Ok, the problem seems to be related to the libstdc++ library in use.
I can use whatever GCC version I want as long as the static stdc++ lib I pull in is one that is supported (4.1.x or 4.3.x):

Code:

gentoo-box helloworld # mipsel-linux-uclibc-c++ -v -static-libgcc -L./libs/stdc++/4.3.5 -lstdc++ -o test test.cpp
gentoo-box helloworld # mipsel-linux-uclibc-c++ -v -static-libgcc -L./libs/stdc++/4.3.5 -lstdc++ -o test test.cpp



That does make sense, but what stdc++ library was getting pulled in by default? There still might be a toolchain bug lurking, if the static libstdc++ built with your 4.5 toolchain came out broken...

Well, the question is ... how do I measure the scale of "brokenness" :-P ?
_________________
in the world I see, you're stalking elk throught the grand canyon forests, around the ruins of the rockefeller center. You'll wear leather clothes, that will last you the rest of your life... (Tylers Vision)
Back to top
View user's profile Send private message
Wormo
Retired Dev
Retired Dev


Joined: 29 Nov 2004
Posts: 526
Location: SB County California

PostPosted: Tue Mar 15, 2011 6:13 am    Post subject: Reply with quote

So basically your 4.5 version of libstdc++ breaks statically-linked executables, while older versions work ok while statically linked?
How about 4.5 libstdc++ with shared linking, does that work or is that stdc++ totally broken?

I think it would be nice to file a report at bugs.gentoo.org, even though admittedly MIPS team is struggling to keep up right now -- at least it would be another place for other users to find your workaround of downgrading libstdc++
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum