Hi all,

I've recently tried to cross compile some skarnet.org packages and I'm 
having some issues. I'm compiling on x86_64 Debian Linux (glibc) for big-endian 
ARMv5 LEDE (musl) (LEDE is a fork of OpenWrt for those who don't know). I'm 
using a cross-compiler toolchain built from here: 
<https://github.com/richfelker/musl-cross-make>.

I managed to cross-compile skalibs by generating the sysdeps on the target
machine and then transferring that to my build machine. I did have to edit the
target definition though, as the compiler on the target device uses a custom
compiler triple (armeb-openwrt-linux-muslgnueabi) which needed to be changed to 
the triple of my cross-compiler (armeb-linux-musleabi). It took me a while to
figure that out though: I had run configure with these options:

./configure --host=armeb-linux-musleabi --prefix=/usr/local \
        --with-sysdeps=/path/to/sysdeps.cfg --disable-shared

and got this error:

./configure: error: target armeb-linux-musleabi does not match the \
contents of /usr/local/lib/skalibs/sysdeps/target

The configure script is displaying the default path to the sysdeps directory 
(based on the --prefix flag) instead of displaying the provided path to the
sysdeps directory; i.e. the error message should instead read:

./configure: error: target armeb-linux-musleabi does not match the \
contents of /path/to/sysdeps.cfg/target

Once I worked that out, I was able to compile skalibs and install it in a 
staging directory without any more issues.

I then tried to compile execline. I gave configure the appropriate options,
pointing it at the sysdeps directory and pointing the include and library path
at the staging directory, roughly like so:

./configure --host=armeb-linux-musleabi --prefix=/usr/local --disable-shared \
        --with-sysdeps=/path/to/sysdeps.cfg/ \
        --with-include=/path/to/staging/usr/local/include \
        --with-lib=/path/to/staging/usr/local/lib

However, when I tried to build execline the compiler tried to include 
libskarnet.a
from the host machine when linking the programs:

exec armeb-linux-musleabi-gcc <snip> -L/path/to/staging/usr/local/lib \
        -Wl,--gc-sections src/execline/cd.o 
/usr/lib/x86_64-linux-gnu/libskarnet.a  
/usr/lib/x86_64-linux-gnu/libskarnet.a: error adding symbols: File format not 
recognized

I tried changing the arguments to configure and make and clobbering their 
environments, but I couldn't stop the compiler from trying to use host 
libraries.

tl;dr: skalibs' configure script has a bug in one of its error messages and I 
can't
get execline to cross-compile as the compiler keeps on trying to use host 
libraries.
I can compile on the target machine if absolutely required, but it would save 
several
hours to cross compile.

Regards,
multiplex'd

Reply via email to