Cross Compile Libxml++


ryosaeba

Certified Guru
Joined
May 19, 2006
Messages
421
Age
41
Location
Como (Italy)
Website
mtorromeo.github.com
Hi,
my gp2x is back to me and I'm working on something new, but I'm stuck trying to cross compile libxml++ for the gp2x.
I already cross compiled other libraries without too much problems but I can't solve this.

libxml++ is a c++ wrapper around the libxml2 library (which is already present in my ooPo toolkit).
I edited config.sub adding this:
Code:
gp2x)
basic_machine=arm-gp2x
os=-linux-gnu
;;

I exported this env variables:
Code:
CC='gp2x-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib'
CXX='gp2x-g++ -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib'
CFLAGS='-O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2'
LDFLAGS='-L/usr/local/gp2xdev/lib'
LD_LIBRARY_PATH='/usr/local/gp2xdev/lib'
PKG_CONFIG_PATH='/usr/local/gp2xdev/lib/pkgconfig'

And then I run
Code:
./configure --prefix=/usr/local/gp2xdev --host=gp2x --libdir=/usr/local/gp2xdev/lib --build=x86_64-pc-linux-gnu --enable-static --enable-shared
make

The compilation goes well till this point
Code:
make[2]: Entering directory `/home/ryo/development/libxml++-1.0.5/libxml++'
/bin/sh ../libtool --tag=CXX --mode=link gp2x-g++ -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib  -g -O2  -L/usr/local/gp2xdev/lib -o libxml++-1.0.la -rpath /usr/local/gp2xdev/lib -version-info 1:4:0 attribute.lo dtd.lo document.lo noncopyable.lo keepblanks.lo	parsers/libparsers.la exceptions/libexceptions.la nodes/libnodes.la io/libio.la -L/usr/local/gp2xdev/lib -lxml2 -lz -lm
gp2x-g++ -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib -shared -nostdlib /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crti.o /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/crtbeginS.o  .libs/attribute.o .libs/dtd.o .libs/document.o .libs/noncopyable.o .libs/keepblanks.o -Wl,--whole-archive parsers/.libs/libparsers.a exceptions/.libs/libexceptions.a nodes/.libs/libnodes.a io/.libs/libio.a /usr/local/gp2xdev/gp2x/lib/libstdc++.a -Wl,--no-whole-archive  -Wl,--rpath -Wl,/usr/local/gp2xdev/lib -Wl,--rpath -Wl,/usr/local/gp2xdev/lib -L/usr/local/gp2xdev/lib -L/home/ryo/development/gp2xdev/toolchain/gcc-4.0.2/build-gp2x-c++/gp2x/libstdc++-v3/src -L/home/ryo/development/gp2xdev/toolchain/gcc-4.0.2/build-gp2x-c++/gp2x/libstdc++-v3/src/.libs -L/home/ryo/development/gp2xdev/toolchain/gcc-4.0.2/build-gp2x-c++/gcc -L/usr/local/gp2xdev/gp2x/bin -L/usr/local/gp2xdev/gp2x/lib /usr/local/gp2xdev/lib/libxml2.so -lz -L/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2 -L/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib -lm -lc -lgcc /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/crtendS.o /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crtn.o  -mcpu=arm920t -Wl,-soname -Wl,libxml++-1.0.so.1 -o .libs/libxml++-1.0.so.1.0.4
exceptions/.libs/libexceptions.a(locale_facets.o):../../../../libstdc++-v3/src/locale_facets.cc:65: multiple definition of `std::__num_base::_S_atoms_out'
parsers/.libs/libparsers.a(locale_facets.o):../../../../libstdc++-v3/src/locale_facets.cc:65: first defined here
exceptions/.libs/libexceptions.a(locale_facets.o):(.data._ZNSt10__num_base11_S_atoms_inE+0x0): multiple definition of `std::__num_base::_S_atoms_in'
parsers/.libs/libparsers.a(locale_facets.o):(.data._ZNSt10__num_base11_S_atoms_inE+0x0): first defined here
exceptions/.libs/libexceptions.a(locale_facets.o):(.data._ZNSt10money_base8_S_atomsE+0x0): multiple definition of `std::money_base::_S_atoms'
parsers/.libs/libparsers.a(locale_facets.o):(.data._ZNSt10money_base8_S_atomsE+0x0): first defined here
...
...
a lot of other errors
...
...

I'm trying to compile version 1.0.5 'cause it doesn't have the dependecy on glibmm, present in versions 2.x

Any help is really appreciated, a precompiled version of the library could do too.
 
Code:
./configure --prefix=/usr/local/gp2xdev --host=gp2x --libdir=/usr/local/gp2xdev/lib --build=x86_64-pc-linux-gnu --enable-static --enable-shared
make
I don't know anything about that library, but what are you trying to achieve by doing both --enable-static and --enable-shared? Building both .a and .so libraries?

If gp2xdev is based on gcc 3.x.x, I guess --enable-shared should do be enough. Give it a try, even I don't think it will solve your problem.
Then try --enable-static alone.
 
Last edited by a moderator:
I don't know anything about that library, but what are you trying to achieve by doing both --enable-static and --enable-shared? Building both .a and .so libraries?
Exactly.

If gp2xdev is based on gcc 3.x.x, I guess --enable-shared should do be enough. Give it a try, even I don't think it will solve your problem.
Then try --enable-static alone.
I need static the most (gcc 4.x), I tried configuring only for static/shared but I get the same error.

I then tried editing the gcc command that produces the error to find the problem and I located it in
"-Wl,--whole-archive", removing this flag solves the error. So I edited the configure script removing this flag from everywhere (I couldn't find another way) and restarted compiling. I managed this way to get over the last error and I have a compiled libxml++-1.0.so.1.0.4 but I get this other error and I can't understand why...

gp2x-g++ -shared -nostdlib /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crti.o /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/crtbeginS.o .libs/attribute.o .libs/dtd.o .libs/document.o .libs/noncopyable.o .libs/keepblanks.o -Wl, parsers/.libs/libparsers.a exceptions/.libs/libexceptions.a nodes/.libs/libnodes.a io/.libs/libio.a /usr/local/gp2xdev/gp2x/lib/libstdc++.a -Wl,--no-whole-archive -Wl,--rpath -Wl,/usr/lib64 -Wl,--rpath -Wl,/usr/lib64 -L/home/ryo/development/gp2xdev/toolchain/gcc-4.0.2/build-gp2x-c++/gp2x/libstdc++-v3/src -L/home/ryo/development/gp2xdev/toolchain/gcc-4.0.2/build-gp2x-c++/gp2x/libstdc++-v3/src/.libs -L/home/ryo/development/gp2xdev/toolchain/gcc-4.0.2/build-gp2x-c++/gcc -L/usr/local/gp2xdev/gp2x/bin -L/usr/local/gp2xdev/gp2x/lib /usr/lib64/libxml2.so -L/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2 -L/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib -lm -lc -lgcc /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/crtendS.o /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crtn.o -Wl,-soname -Wl,libxml++-1.0.so.1 -o .libs/libxml++-1.0.so.1.0.4
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/bin/ld: : No such file: No such file or directory
collect2: ld returned 1 exit status


The strange thing is that, that same filename is valid and I specified "gp2x-ld" in libtool...
 
Last edited by a moderator:
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/bin/ld: : No such file: No such file or directory
collect2: ld returned 1 exit status


The strange thing is that, that same filename is valid and I specified "gp2x-ld" in libtool...
This reduces to /usr/local/gp2xdev/gp2x/bin/ld which looks valid.
My install of gp2xdev has this:
Code:
-rwxr-xr-x 2 laurent laurent 3054915 Dec 26 14:18 gp2x/bin/ld
-rwxr-xr-x 2 laurent laurent 3054915 Dec 26 14:18 bin/gp2x-ld
Of course both files are the same (hard link). So the file looks fine to me.

Did you happen to rename files in your gp2x/bin directory? That'd be bad :)
 
Last edited by a moderator:
No. As I stated above, the file exists, for some reason the compilation script thinks it doesn't...

Here the proof:
Code:
$> /usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/bin/ld -v
GNU ld version 2.16.1

Edit
Now that I look better at the message, it's not saying that ld doesn't exist. It's saying that ld is searching for a file that doesn't exist, and the file it's searching for is named ' for some reason.
This could be due to my crazy cutting in the configuration script, but I only removed "-Wl,--whole-archive" flags.

I know where to look now though...
 
Last edited by a moderator:
I managed to build the library with a dirty hack...

I replaced "ld" with this script:
Code:
#!/bin/bash
exec /usr/local/gp2xdev/gp2x/bin/ld.bak ${*//--whole-archive/--no-whole-archive}

But the final library is incomplete (as I suspected) and so useless...

I need to understand what's really causing the problem (this hack skips the problem, doesn't solve it) but I already tired everything I could think of.

What I'm asking now is for a kind soul to compile this library for me (maybe using a different toolchain this problem won't arise)...
My toolchain is based on gcc-4.0.2 and is built with --with-float=soft
Anyone?
 
Any version from the 1.x tree should do (1.0.5 is the latest I think). I need the static version of the library the most but if you could compile both versions it would be better.
 
W007! I did it!

I added a bunch of flags to the configure script matching some of the flags I used for my toolchain and apparently one of them did the trick...

For the curious I added --disable-libstdcxx-pch --disable-multilib --disable-nls

Now on to the next problem...

@Gary Miller: thanks anyway!
 
Back
Top