I managed to solve this myself. It turns out that whenever you link a binary against libdb, you must also explicitly link it against libpthread, even though libdb is linked against libpthread itself. Otherwise - segfault. A target/uClibc/toolchain peculiarity? Very odd, but at least apache works now.
2015-01-15 15:28 GMT+02:00 Alex Potapenko <opotape...@gmail.com>: > Dear all! > > I'm trying to get httpd to work on my router using optware. I added > optware target with the same toolchain used to build router's firmware. > While numerous packages I built so far work fine, launching any binary that > comes with httpd results in a segfault: > > root@unknown:/tmp/home/root# gdb /opt/sbin/httpd >> GNU gdb (GDB) 7.8.1 >> Copyright (C) 2014 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later < >> http://gnu.org/licenses/gpl.html> >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" >> and "show warranty" for details. >> This GDB was configured as "arm-linux". >> Type "show configuration" for configuration details. >> For bug reporting instructions, please see: >> <http://www.gnu.org/software/gdb/bugs/>. >> Find the GDB manual and other documentation resources online at: >> <http://www.gnu.org/software/gdb/documentation/>. >> For help, type "help". >> Type "apropos word" to search for commands related to "word"... >> Reading symbols from /opt/sbin/httpd...done. >> (gdb) run -d >> Starting program: /opt/sbin/httpd -d >> [Thread debugging using libthread_db enabled] >> Using host libthread_db library "/opt/lib/libthread_db.so.1". >> Program received signal SIGSEGV, Segmentation fault. >> 0x403428ec in pthread_mutex_lock () from /opt/lib/libc.so.0 >> (gdb) bt full >> #0 0x403428ec in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #1 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #2 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #3 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #4 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #5 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #6 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #7 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #8 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #9 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #10 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #11 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #12 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #13 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #14 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #15 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #16 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #17 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #18 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #19 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #20 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #21 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #22 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> #23 0x40342910 in pthread_mutex_lock () from /opt/lib/libc.so.0 >> No symbol table info available. >> ---Type <return> to continue, or q <return> to quit---q >> Quit >> (gdb) info sharedlibrary >> From To Syms Read Shared Object Library >> 0x40019930 0x4001ce90 Yes (*) /lib/ld-uClibc.so.0 >> 0x401bbd1c 0x401db6c8 Yes /opt/lib/libpcre.so.1 >> 0x40129524 0x4013f1e4 Yes /opt/lib/libaprutil.so.0 >> 0x4014bdb8 0x4014eba0 Yes /opt/lib/libgdbm.so.3 >> 0x400ca11c 0x400e6034 Yes /opt/lib/libexpat.so.1 >> 0x401e7118 0x401fb040 Yes /opt/lib/libiconv.so.2 >> 0x40161170 0x4017b60c Yes /opt/lib/libapr.so.0 >> 0x4018709c 0x401891bc Yes /opt/lib/libuuid.so.1 >> 0x40192620 0x40192a94 Yes (*) /opt/lib/librt.so.0 >> 0x4019d31c 0x401a9cf8 Yes /opt/lib/libm.so.0 >> 0x402cc4ac 0x402cdda4 Yes /opt/lib/libcrypt.so.0 >> 0x400f1784 0x400f2564 Yes (*) /opt/lib/libdl.so.0 >> 0x400fe7b0 0x4010554c Yes /opt/lib/libgcc_s.so.1 >> 0x402fd990 0x40344904 Yes /opt/lib/libc.so.0 >> 0x403621e8 0x4036851c Yes /opt/lib/libpthread.so.0 >> 0x403bc9c8 0x40405698 Yes /opt/lib/libstdc++.so.6 >> 0x40439990 0x40480904 Yes /lib/libc.so.0 >> 0x400ab31c 0x400b7cf8 Yes /lib/libm.so.0 >> 0x4049c7b0 0x404a354c Yes /lib/libgcc_s.so.1 >> (*): Shared library is missing debugging information. > > > The stack entries are seemingly endless, my patience got me to 6k+, and > they're all identical. It looks like httpd is endlessly trying to acquire > some lock, until stack is overflown, but I have no idea how to debug > further. I even went on and compiled non-stripped version of uClibc in the > hope that maybe I could get more info, but still no luck. > > Any help and guidance on solving this is greatly appreciated! > > -- > Best regards, > Alex Potapenko > -- Best regards, Alex Potapenko