Only build static libraries (and also link statically with any dependencies

I’m currently trying to create a Linux distro that will run on a 32-Bit ARM Raspberry Pi that is set in Big Endian mode (the ARM Cortex-A7 CPU inside the Raspberry Pi can run in both Little Endian and Big Endian mode).

I am the author of the network analysis program Dynamo, and so in order to get a cross-compilation build system up and running, I’m trying to build my Dynamo program as a statically linked binary file for 32-Bit ARM Big Endian. (I should be able to use qemu to run it on my x64 desktop PC before I try run it natively on the raspberry pi).

I have set up a “chroot jail” in which I have a 32-Bit “armeb” compiler (the ‘eb’ on the end means Big Endian), and one by one I am building all the dependencies of my program. I’m currently stuck on building Glib.

I wasn’t able to get my “armeb” cross-compiler to build glibc (yes I mean glibc), and so I had to link it with uClibc instead. I built uClibc as a static library only (i.e. I only have “.a” files, I don’t have “.so” files).

Now I am trying to use meson and ninja to build Glib, but here’s what I’m getting when it tries to build libresourceplugin.so:

 in function `__uClibc_fini':
 __uClibc_main.c:(.text+0x1d4): undefined reference to `__fini_array_start'
 undefined reference to `__fini_array_end'
 undefined reference to `__fini_array_start'

I’ve seen these errors before – I’ve gotten them when a program tries to link dynamically with uClibc (which isn’t possible because I only built uClibc as a static library). The solution with other packages was to simply do “./configure --disable-shared” to make sure that it links statically with uClibc (I originally though that this would just make it produce a static library that could possibly link dynamically with its dependencies, but it actually links entirely statically).

So what I need to do now is tell meson and ninja to build Glib to only link statically with uClibc, in order to produce Glib as static library (i.e. I need “.a” files). I’ve tried a few things such as “meson -Ddefault_library=static” but still I’m getting the same errors

Any pointers please?

Alternatively could someone tell me how not to run the tests during the build – because it seems that libresourceplugin.so is only for testing.

As far as I know this purely affects libraries built as part of the current project (when they weren’t already explicitly stated to be static or shared)

-Dtests=false

I assume you told meson to use a custom libc? And remember meson supports cross building things

I managed to get glibc (yes I mean glibc) to build for 32-Bit Big Endian ARM, and so now I can build glib (yes I mean glib) without any issues.

The only problem I’m having now though is that after I do “ninja -C _build” to install glib, other programs that depend on glib can’t find it when I do “./configure”. For example when I try to build GTK2, it tells me at the “./configure” step that it can’t find glib. I started another thread about this problem, please see the thread entitled “Glib installed into /lib64”.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.