tjko / nxgipd

nxgipd - a monitoring daemon for UTC Interlogix / GE Security / Caddx NetworX series alarm systems
GNU General Public License v2.0
39 stars 19 forks source link

pthread library required #3

Closed Dogora closed 9 years ago

Dogora commented 9 years ago

I'm running openSUSE 13.1 (x64) and have libmxml v2.6 installed. When I run ./configure, it fails, claiming mxml is missing or <2.6. Looking at config.log, I determined that ./configure is missing the -lpthread switch to the linker command when it tries to compile and link conftest.c around line 3711. Once I manually add -lpthread, everything works well.

Error lines from my config.log are: /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libmxml.so: undefined reference to 'pthread_getspecific' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libmxml.so: undefined reference to 'pthread_key_create' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libmxml.so: undefined reference to 'pthread_once' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libmxml.so: undefined reference to 'pthread_setspecific'

You may want to add the requirement of libpthread to the list and add it so ./configure uses it.

tjko commented 9 years ago

Seems as if libmxml.so in openSUSE is not pre-linked against libptread.so (?) As I don't see this issue in Debian, where libmxml.so seems to be linked against libptread.so.

Could you try if following change fixes this? cd9fc5394c141f5bf1add98173ee698c8069fb33

Dogora commented 9 years ago

I pulled down the complete package again, using the "Download ZIP" button on the main page, and I get the same error about missing pthread. I'm not very good at this, but it looks like your changes above to configure and config/configure.in are in the version I downloaded.

tjko commented 9 years ago

Autoconf can be tricky sometimes, I think I may have found way to conditionally add linking of libpthread if libmxml depends on it, its not pretty but should work: 67f1dee8298d498adb7ed3df59ef0a9504f37c44

If that doesn't work then manually specifying "extra" libraries should do it. Something like this probably works (?)

# LIBS="-lphtread" ./configure
Dogora commented 9 years ago

This one worked; it created the Makefile that included -lpthread on the LIBS= line (line 44). It's a bit funky, but it does work. The output of configure has these 2 lines:

checking for library containing mxmlLoadFile... no checking for library containing mxmlLoadFd... -lmxml

config.log is a bit confusing, but the end result is good.

What I've done in the past is manually modify my configure script to include -lpthread. Then, I also add that to the Makefile. I thought about LIBS="-lpthread", but I modified the files instead.

tjko commented 9 years ago

This probably is not the best way to detect what dependencies a library may have, but seems to work. I'll leave it like this for now, until someone shows better way to do this...