You are not logged in.

#1 2015-07-01 10:35:31

Michael Gruenstaeudl
Member
Registered: 2014-12-03
Posts: 51

[SOLVED] realtime lib seemingly inaccessible -- ld: cannot find -lrt

Hi all,
as part of a compilation of a software for genomic alignment, I am running into a compilation error concerning the realtime extensions (librt; part of glibc, I believe) and the asynchronous facility (libaio) libraries. The issue may be as simple as gcc looking for either library in the wrong location.

The relevant line of the makefile is:

DEPS_LIBS = -L/home/michael/binaries/Mauve/libs/lib -lMems-1.6 -lboost_system -lboost_filesystem -lboost_program_options -lboost_iostreams -lrt -lpthread -lGenome-1.3 -lMUSCLE-3.7

The resulting error is:

make[2]: Entering directory '/home/michael/binaries/Mauve/build_scripts/build/mauveAligner/src'
g++ -O2 -funroll-loops -fomit-frame-pointer -ftree-vectorize   -DCOMMAND_LINE   -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive  -o mauveStatic mauveAligner.o -L/home/michael/binaries/Mauve/libs/lib -lMems-1.6 -lboost_system -lboost_filesystem -lboost_program_options -lboost_iostreams -lrt -lpthread -lGenome-1.3 -lMUSCLE-3.7   
/usr/bin/ld: cannot find -lrt
collect2: error: ld returned 1 exit status

To me, this doesn't look like faulty C code, but an inability by gcc to utilize the correct libraries. Any suggestions on resolving this would be appreciated.

Last edited by Michael Gruenstaeudl (2015-07-01 20:29:49)

Offline

#2 2015-07-01 12:31:29

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] realtime lib seemingly inaccessible -- ld: cannot find -lrt

The error is most probably caused by the -static option: if this option is passed to g++ then it will try to link the libraries statically and thus will search for librt.a instead of the shared version, however static libraries are not provided by any official package because Archlinux has a strict no-static-libraries policy and so the linking will fail. In order to successfully compile the program, you have to reconfigure it to use shared libraries.


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#3 2015-07-01 20:26:16

Michael Gruenstaeudl
Member
Registered: 2014-12-03
Posts: 51

Re: [SOLVED] realtime lib seemingly inaccessible -- ld: cannot find -lrt

A thank you to mauritiusdadd for his insightful reply. Upon removing the -static flag from the makefile, the compilation executed normally.

Offline

Board footer

Powered by FluxBB