About cross-compilers and their use - Programming On Unix

Users browsing this thread: 2 Guest(s)
z3bra
Grey Hair Nixers
I think musl is stronger than glibc because it tries to follow POSIX standards more quickly, and make standard function more secure.
By keeping everything simpler, they make the code easier to review/maintain, so the libc is much stronger overall. Now that's just my POV and some would probably disagree. I don't care much about them.

So what have I done so far?

I have a cross compiler installed in $HOME/cross/gcc-x86_64:

Code:
$ sponge < /home/egull/cross/gcc-x86_64/README
TRIPLET :       x86_64-linux-musl
PREFIX  :       /home/egull/cross/gcc-x86_64
GCC     :       4.8.5
BINUTILS:       2.25
MUSL    :       1.1.10
KERNEL  :       4.1.4

$ tree /home/egull/cross/gcc-x86_64/bin/
/home/egull/cross/gcc-x86_64/bin/
├── x86_64-linux-musl-addr2line
├── x86_64-linux-musl-ar
├── x86_64-linux-musl-as
├── x86_64-linux-musl-c++filt
├── x86_64-linux-musl-cpp
├── x86_64-linux-musl-elfedit
├── x86_64-linux-musl-gcc
├── x86_64-linux-musl-gcc-4.8.5
├── x86_64-linux-musl-gcc-ar
├── x86_64-linux-musl-gcc-nm
├── x86_64-linux-musl-gcc-ranlib
├── x86_64-linux-musl-gcov
├── x86_64-linux-musl-gprof
├── x86_64-linux-musl-ld
├── x86_64-linux-musl-ld.bfd
├── x86_64-linux-musl-nm
├── x86_64-linux-musl-objcopy
├── x86_64-linux-musl-objdump
├── x86_64-linux-musl-pkg-config
├── x86_64-linux-musl-ranlib
├── x86_64-linux-musl-readelf
├── x86_64-linux-musl-size
├── x86_64-linux-musl-strings
└── x86_64-linux-musl-strip

0 directories, 24 files

It links everything statically, and use only what's in $HOME/cross/gcc-x86_64/bin/x86_64-linux-musl/{lib,include}
So if I want to compile something against, let's say libressl, I first need to install libressl's headers and libs to my toolchain's root.

I have written a dumb package manager which can install packages to whatever root the $PMROOT variable points to. It makes everything stupidly easy to work with
Here is what happens when compiling curl alone, with --with-ssl flag:

Code:
$ (cd tree/curl; pmkit build)
[...]
configure: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.
[...]

$ work/curl-7.42.1/bin/curl --version
curl 7.42.1 (x86_64-unknown-linux-gnu) libcurl/7.42.1
Protocols: ftp gopher http
Features: Largefile UnixSocket

SSL is disabled as the configure script couldn't find the appropriate libs.
Now if I build libressl, and install it to the cross-compiler directory:

Code:
# useless output is suppressed here
$ (cd tree/libressl; pmkit build)
$ PMROOT=$HOME/cross/gcc-x86_64/x86_64-linux-musl; export PMROOT
$ pmkit add repo/libressl\:2.1.6.pkg
$ pmkit list
libressl 2.1.6
$ (cd tree/curl; pmkit build)
$ work/curl/bin/curl --version
curl 7.42.1 (x86_64-unknown-linux-gnu) libcurl/7.42.1 LibreSSL/2.0.0
Protocols: ftp ftps gopher http https
Features: Largefile NTLM NTLM_WB SSL UnixSockets

SSL support is now compiled in, yay!
I can then just remove the libressl package from the cross environment:

Code:
$ PMROOT=$HOME/cross/gcc-x86_64/x86_64-linux-musl; export PMROOT
$ pmkit del libressl
$ pmkit list
$

Next step is to figure out what are the base packages that are needed on a fresh install. If you have any suggestion, they're welcome!


Messages In This Thread
About cross-compilers and their use - by z3bra - 10-08-2015, 03:12 PM
RE: About cross-compilers and their use - by xero - 13-08-2015, 11:27 AM
RE: About cross-compilers and their use - by cjm - 13-08-2015, 04:46 PM
RE: About cross-compilers and their use - by z3bra - 14-08-2015, 06:05 AM
RE: About cross-compilers and their use - by October - 19-09-2015, 11:33 PM