freddy freddy -4 years ago 171
Linux Question

Cross compilation: can't resolve symbol 'register_printf_function'

I have cross-compiled strongswan-5.2.2, a open source project implementing VPN server&client, for embedded-linux running on mipsel (target) on Ubuntu12.04 running on Intel x86 machine.

But executing the cross-compiled strongswan on mipsel machine fails as follows:

$ ./charon
./charon: can't resolve symbol 'register_printf_function'

It seems like that
is not refereed by the executable. The reason why I think like that is
is implemented in
(AFAIK). However,
already exists on
of target mipsel machine.

Inspecting all of shared libraries referred by the executable shows:

$ readelf -d ./charon | grep NEEDED
0x000001 (NEEDED) Shared Library: []
0x000001 (NEEDED) Shared Library: []
0x000001 (NEEDED) Shared Library: []
0x000001 (NEEDED) Shared Library: []
0x000001 (NEEDED) Shared Library: []

All of the above libraries exist on
of target machine..

Why is that error message coming up, yet I have all of the shared libraries required by the executable on target machine? And... how can I solve the problem?


$ nm -D
0002fb70 T register_printf_fuction

That function is already implemented in the shared library, isn't it...?

Answer Source

register_printf_function is specific to GNU glibc. If your target machine has some other libc (e.g. dietlibc or musl-libc) it is not available.

you may compile glibc for your target machine (probably difficult) or find a strongswan specific workaround

Check with nm -D /lib/ that the target libc has a register_printf_function

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download