Discussion:
Unable to build LMDB on SUSE Linux: undefined reference to pthread_mutexattr_setrobust / pthread_mutex_consistent
(too old to reply)
Howard Chu
2015-10-31 03:07:54 UTC
Permalink
Raw Message
Content preview: > Hello, > > I am trying to build LMDB libraries from source
on SUSE Linux using gcc 4.7.2 to try for an experimental project at work.
I am getting some build errors. I see pthread.h and libpthread.{a/so} installed
in /usr/include and /usr/lib64, respectively. But I do not see these functions
in the header file or in the library. Maybe the pthread library version is
old. I am not sure. I tried searching on the web, but I was not able to understand
how to install a different version of the pthread library (it seems to come
packaged with the OS?). I do not have admin rights so I would try installing
in my local area. > > Can someone please advise on things I can try to resolve
this issue? Thank you for your time and help. [...]

Content analysis details: (-4.2 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium
trust
[69.43.206.106 listed in list.dnswl.org]
0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked.
See
http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
for more information.
[URIs: highlandsun.com]
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
Hello,
I am trying to build LMDB libraries from source on SUSE Linux using gcc
4.7.2 to try for an experimental project at work. I am getting some build
errors. I see pthread.h and libpthread.{a/so} installed in /usr/include and
/usr/lib64, respectively. But I do not see these functions in the header file
or in the library. Maybe the pthread library version is old. I am not sure. I
tried searching on the web, but I was not able to understand how to install a
different version of the pthread library (it seems to come packaged with the
OS?). I do not have admin rights so I would try installing in my local area.
Can someone please advise on things I can try to resolve this issue? Thank you for your time and help.
You're not using a released branch of LMDB code. When you use a development
branch you're expected to actually know how your development environment works.
(P.S. I had built LMDB successfully on a Mac OS X machine (home computer) without any issues)
$ make
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized -c mdb.c
mdb.c:9827:4: warning: implicit declaration of function ‘pthread_mutex_consistent’ [-Wimplicit-function-declaration]
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized -c midl.c
ar rs liblmdb.a mdb.o midl.o
ar: creating liblmdb.a
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized -fPIC -c mdb.c -o mdb.lo
mdb.c:9827:4: warning: implicit declaration of function ‘pthread_mutex_consistent’ [-Wimplicit-function-declaration]
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized -fPIC -c midl.c -o midl.lo
gcc -pthread -shared -o liblmdb.so mdb.lo midl.lo
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized -c mdb_stat.c
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized mdb_stat.o liblmdb.a -o mdb_stat
/nfs/pdx/proj/dt/tctg03/pgupta6/lmdb-mdb.master/libraries/liblmdb/mdb.c:4642: undefined reference to `pthread_mutexattr_setrobust'
/nfs/pdx/proj/dt/tctg03/pgupta6/lmdb-mdb.master/libraries/liblmdb/mdb.c:9827: undefined reference to `pthread_mutex_consistent'
collect2: error: ld returned 1 exit status
make: *** [mdb_stat] Error 1
$ more /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2
$ uname -a
Linux 3.0.101-0.7.29.1.8482.4.PTF-default #1 SMP Tue May 5 16:00:34 UTC 2015 () x86_64 x86_64 x86_64 GNU/Linux
SUSE Linux Enterprise Server 11 definitely supports robust mutexes, since they
actually list bug fixes for that feature.

https://www.suse.com/support/update/announcement/2013/suse-su-20131852-1.html

But it's possible that the function definitions are hidden or renamed. Look
for them in /usr/include/pthread.h and then supply the appropriate
preprocessor flags to expose their definitions.

You may need to adjust the LMDB code to use pthread_mutexattr_setrobust_np and
pthread_mutex_consistent_np. If you don't know how to do this, stick with the
actual release branch.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Ch
Loading...