bitcoin/bitcoin — Issue #879: bitcoin-qt FTBFS : undefined reference to symbol 'shm_unlink@@GLIBC_2.2.5'
Author: dooglus
Created: 2012-02-21 10:31:49+00:00
State: open

Since updating archlinux i've been unable to build bitcoin-qt from git HEAD.

The error is as follows:

$ make
g++ -m64 -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -fstack-protector -Wl,-O1 -o bitcoin-qt build/bitcoin.o [...] build/qrc_bitcoin.o -L/usr/lib -lqrencode -lminiupnpc -lssl -lcrypto -ldb_cxx -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lQtGui -lQtCore -lpthread
/usr/bin/ld: build/qtipcserver.o: undefined reference to symbol 'shm_unlink@@GLIBC_2.2.5'
/usr/bin/ld: note: 'shm_unlink@@GLIBC_2.2.5' is defined in DSO /lib/librt.so.1 so try adding it to the linker command line
/lib/librt.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [bitcoin-qt] Error 1
$

I made the following change to bitcoin-qt.pro and the problem went away:

LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,)
-LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX
+LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX -lrt
# -lgdi32 has to happen after -lcrypto (see #681)

I don't know enough about what's going on to say whether that's a good idea, but it worked for me...