Project

General

Profile

[UE] cross-compiling lighttpd with-pcre

Added by subash about 5 years ago

Hi,
I am facing the dreaded /lib/libubacktrace.so missing when I turn on the with-pcre option while cross-compiling lighttpd.
My uClibc version is 0.9.33.2
My libpcre version is 8.35
My lighttpd version is 1.4.51

For the with-pcre addition, I just followed:
http://fengh2000.blogspot.com/2009/06/how-to-cross-compile-lighttpd-with-pcre.html
and
http://www.ridgesolutions.ie/index.php/2013/06/05/build-cross-compile-lighttpd-for-arm-linux-with-pcre/

Strangely if I copy the libubacktrace.so to my build machine's /lib (with root perms) the build goes through fine, which obviously is a no-go!
Is there any Makefile patch to remove this ASNEEDED dependency on libubacktrace as I dont see any backtrace related symbols either in libpcre or lighttpd source?

Did any of you face this error while cross-compiling lighttpd with-pcre?
Any help/suggestions on this is highly appreciated.

Thanks,
Subash

<partial logs, sorry about the redaction!>

/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/root/lib mod_flv_streaming.lo  
libtool: link: /<redacted>/buildroot/tools/3.14.43_gcc-linaro-4.8-2014.04/bin/arm-linux-uclibc-gcc -std=gnu99 -shared  -fPIC -DPIC  .libs/mod_flv_streaming.o   -L/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/root/lib -L/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/root -L/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/openssl-1.0.2i    -Wl,-soname -Wl,mod_flv_streaming.so -o .libs/mod_flv_streaming.so
/<redacted>/buildroot/tools/3.14.43_gcc-linaro-4.8-2014.04/bin-ccache/../lib/gcc/arm-linux-uclibcgnueabi/4.8.3/../../../../arm-linux-uclibcgnueabi/bin/ld: cannot find /lib/libubacktrace.so.0
collect2: error: ld returned 1 exit status
make4: * [mod_flv_streaming.la] Error 1
make4: Leaving directory `/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/lighttpd/src'
make3:
[all] Error 2
make3: Leaving directory `/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/lighttpd/src'
make2:
[all-recursive] Error 1
make2: Leaving directory `/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/lighttpd'
make1:
[all] Error 2
make1: Leaving directory `/<redacted>/buildroot/build/ap-arm-qca-wsg/build_arm_release/lighttpd'
make: *
* [lighttpd] Error 2


Replies (10)

RE: cross-compiling lighttpd with-pcre - Added by gstrauss about 5 years ago

If you do not link with libubacktrace.so present, what linker errors do you get? i.e. which symbols are missing?

Have you tried ./configure --with-libunwind=no, or making sure that HAVE_LIBUNWIND is undefined when buffer.c is compiled?

RE: cross-compiling lighttpd with-pcre - Added by subash about 5 years ago

Thanks for your reply @gstrauss.
Did you mean --without-libunwind? I did try without-libunwind it didnt help.
The redacted error that I pasted earlier is without the libubacktrace.so in my build machine's /lib.
If I drop the .so there, then it links good and build is fine.
Strangely, there are no symbols like backtrace or backtrace_* in usage on any of the sources of lighttpd or libpcre. Hence, it is weird that it still looks for libubacktrace.so during linking.

Meanwhile, I will try --with-libunwind=no and see what happens.

Thanks,
Subash

RE: cross-compiling lighttpd with-pcre - Added by subash about 5 years ago

Just an update that --with-libunwind=no does not help and returns the same error as earlier.
It again looks for libubacktrace.so under the build machine's /lib

Thanks,
Subash

RE: cross-compiling lighttpd with-pcre - Added by gstrauss about 5 years ago

Is mod_flv_streaming.so the only lib that fails to link? If you compile with make -k do other things fail to link?

Did you run ldd -r on the openssl libraries to see if they depend on libubacktrace? lighttpd does not have an explicit dependency on libubacktrace so you need to find out why it is needed. If it is not explicitly on the link line, then some other library or link process depends on it.

... From a quick internet search, it might be related to uClibc and cross-compilation. This is definitely not lighttpd-specific, so I think you'll have more luck over in some uClibc forums. From 2012: http://uclibc.10924.n7.nabble.com/PATCH-buildsys-clean-up-libubacktrace-linker-script-handling-td11535.html

From 2016: http://buildroot-busybox.2317881.n4.nabble.com/uclibc-ng-bump-to-1-0-18-td146178.html suggests that there may be a config option for uClibc:

For my purposes I need backtrace support, so I add "UCLIBC_HAS_BACKTRACE=y" into uClibc-ng.config.

This would seem to imply that you might want to compile your uClibc with UCLIBC_HAS_BACKTRACE=n or whatever means "not =y" in uClibc-ng.config

RE: cross-compiling lighttpd with-pcre - Added by subash about 5 years ago

Thanks Glenn.
On make -k, it fails on all mod_*.so builds.
UCLIBC_HAS_BACKTRACE is set to y already in the uClibc release.config file.

The reason why I believe this is lighttpd specific is, I hit this error only when I turn on with-pcre in the lighttpd config/Makefile following the earlier links I pointed to. If I dont turn on with-pcre, everything just builds/links fine. I am trying to pull in pcre so that I can do a regex based URL parsing in lighttpd config.
I have tried the uClibc patch that you pointed out, but it didnt help neither.
May be I will try reaching out that alias as well.

Thanks,
Subash

RE: cross-compiling lighttpd with-pcre - Added by gstrauss about 5 years ago

Please read my response more carefully. I suggested UCLIBC_HAS_BACKTRACE= or =n, not the opposite.
If you're not providing libubacktrace.so.0 on your target systems, why do you think UCLIBC_HAS_BACKTRACE=y is logical?

If lighttpd works without pcre, and the lighttpd build breaks when you add pcre, basic logic suggests that you should look at pcre.
Have you tested build an app with pcre (but not lighttpd), to validate whether or not your problem is introduced with pcre?

RE: cross-compiling lighttpd with-pcre - Added by subash about 5 years ago

Thanks Glenn, appreciate your response.
I also need libubacktrace.so for some other binaries which is packaged as an image, hence I meant =y.
I am currently linking pcre to another app existing in the image just as a test to see if it related to pcre and not lighttpd. I have also removed the with-pcre option to stay on-course on this test.

Thanks,
Subash

RE: cross-compiling lighttpd with-pcre - Added by subash about 5 years ago

It does not look like a pcre issue.
The test of adding -lpcre to another app built/linked just fine.
I verified the linking by running
objdump -p <app_binary> | grep NEEDED
- lists libpcre.so as well.

Thanks,
Subash

RE: cross-compiling lighttpd with-pcre - Added by gstrauss about 5 years ago

What more can I say?

Something has a dependency on libubacktrace.so.0. You need to identify it. lighttpd does not have a direct, explicit dependency on libubacktrace.so.0.
lighttpd does not have any code specific to uclibc. Therefore, this is not a lighttpd issue.

If you enable UCLIBC_HAS_BACKTRACE, then you need to provide libubacktrace.so.0. If you think otherwise, then please validate your assumption on the uclibc forums.

You might be able to link shared libs with unresolved dependencies (depending on linker flags), but when you go to load and run those libs, the program will fail if the dependencies are not present, either at load time, or when used (e.g. dlopen() and friends)

RE: cross-compiling lighttpd with-pcre - Added by subash about 5 years ago

Thanks Glenn for your support.
It is the dependency which I am trying to remove, wherever it seems lingering.
On searching uClibc threads(havent reached out yet), it looks like at some places UBACKTRACE has had its round of static compilation issues/patches and hence it only looks in that "hard-coded" path instead of the regular LD_LIBRARY or -L path.
I will continue digging around and reach out to the uClibc alias.

Thanks,
Subash

    (1-10/10)