Open mulle-kybernetik-tv opened 5 years ago
As for the ERR_get_error, it's in libcrypto.so. You'll have to link with that as well.
Ok, fixed. CMake build system now works for me. Please, try again.
It builds fine now. The tcp test still fails though and now additionally the (new) tls test fails.
The following tests FAILED:
24 - test_tcp (SEGFAULT)
27 - test_tls (OTHER_FAULT)
It works on my machine. What are the backtraces? What version of TLS are you using? Is there a difference between automake and cmake build command line?
It builds like this
[82/86] /usr/bin/cc -DDILL_THREADS -DHAVE_MPROTECT -DHAVE_POSIX_MEMALIGN -I../ -I../dns -O3 -DNDEBUG -MMD -MT CMakeFiles/test_tcp.dir/tests/tcp.c.o -MF CMakeFiles/test_tcp.dir/tests/tcp.c.o.d -o CMakeFiles/test_tcp.dir/tests/tcp.c.o -c ../tests/tcp.c
/usr/bin/cc -O3 -DNDEBUG CMakeFiles/test_tcp.dir/tests/tcp.c.o -o tests/tcp -rdynamic libdill.a -lpthread -lssl -lcrypto -lrt
The stacktrace doesn't show anything though:
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000000000000000 in ?? ()
(gdb)
I am running this on a dual Xeon, if this makes a difference.
This is what autoconf does:
Makefile:1649: update target 'tests/tcp.o' due to: tests/tcp.c tests/.dirstamp tests/.deps/.dirstamp
echo " CC " tests/tcp.o;depbase=`echo tests/tcp.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DPACKAGE_NAME=\"libdill\" -DPACKAGE_TARNAME=\"libdill\" -DPACKAGE_VERSION=\"5684026\" -DPACKAGE_STRING=\"libdill\ 5684026\" -DPACKAGE_BUGREPORT=\"sustrik@250bpm.com\" -DPACKAGE_URL=\"http://libdill.org/\" -DPACKAGE=\"libdill\" -DVERSION=\"5684026\" -DDILL_THREADS=1 -DDILL_PTHREAD=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_MPROTECT=1 -DHAVE_LIBRT=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_EPOLL_CREATE=1 -DHAVE_EPOLL=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DDILL_SHARED=1 -I. -g -O2 -MT tests/tcp.o -MD -MP -MF $depbase.Tpo -c -o tests/tcp.o tests/tcp.c &&\
mv -f $depbase.Tpo $depbase.Po
CC tests/tcp.o
Makefile:1370: update target 'tests/tcp' due to: tests/tcp.o libdill.la tests/.dirstamp
rm -f tests/tcp
echo " CCLD " tests/tcp;/bin/bash ./libtool --silent --tag=CC --mode=link gcc -g -O2 -o tests/tcp tests/tcp.o libdill.la -lrt
CCLD tests/tcp
****
Looks like stack corruption. You can step through the test to find out where exactly it happens. However, you mentioned that the test compiled by autoconf works. It may be worth checking what's different when compiling using cmake and autoconf.
I posted the relevant autoconf, cmake lines already I think. What is missing ?
The problem is somewhere in int cr = go(client(5555));
, but I don't know what the problem is because I am too slow to step past the time_assert
:)
main () at ../../tests/tcp.c:271
271 errno_assert(rc == -1 && errno == ETIMEDOUT);
(gdb)
272 int64_t diff = now() - deadline;
(gdb)
273 time_assert(diff, 0);
(gdb)
Expected duration 0, actual duration 73947 (../../tests/tcp.c:273)
These are compile flags that may be relevant:
AUTOCONF
-DDILL_THREADS=1 -DDILL_PTHREAD=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_MPROTECT=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_EPOLL_CREATE=1 -DHAVE_EPOLL=1 -O2
CMAKE
-DDILL_THREADS -DHAVE_MPROTECT -DHAVE_POSIX_MEMALIGN -O3
I would start with the optimization level. CMake uses 03, autoconf uses 02. May that cause the different behaviour?
I won't be on linux for a few days, but will try to check it out next week.
I didn't make a pull request for [https://github.com/mulle-kybernetik-tv/libdill/commit/b0fc47b0bc7e455df106e4e08eb8f83f9e9ec6a7](), because two of the tests also fail, when run from cmake. They work fine with autoconf and
make test
thoughHere are the changes to
CMakeLists.txt
:Here are the test failures:
For the tls test I got:
This being on ubuntu 18.10. I have no idea why
-lssl
doesn't resolve the symbol, but didn't investigate further.