LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-19-2013, 04:49 AM   #1
Gaidal
LQ Newbie
 
Registered: May 2002
Location: Sweden
Distribution: Arch x64
Posts: 29
Blog Entries: 2

Rep: Reputation: 0
Can't compile Linsched on Arch, ld cannot find -lrt and -lpcre


I'm trying to compile Linsched, and keep getting the following error:

Code:
CC UNIX_TEST unix-mcarlo-sim
/usr/bin/ld: cannot find -lrt
/usr/bin/ld: cannot find -lpcre
collect2: error: ld returned 1 exit status
What the Makefile is trying to do here is:
Code:
${UNIX_TESTS}: ${OBJ_FILES} $$@.o
    @echo CC UNIX_TEST $@
    @${LD_PERCPU} -o $@.percpu $^
#two definitions of mktime
    @${CC} -Wl,--allow-multiple-definition -static -o $@ $@.percpu -lrt -lm -lpcre
I have librt.so and libpcre.so in /usr/lib. My ld.so.conf is empty, but I think /usr/lib should be searched anyway.

Some threads seemed to imply that I need some headers too, and I do have pcre.h under /usr/include, but I don't see why I'd need this just to compile with -lrt and -lpcre.

What am I missing here?
 
Old 11-19-2013, 05:15 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You need headers to define the function parameters for the C compiler so that it knows
how to check for type errors, and improper use of return values.

Even then, if your system is a 64 bit system, then you need 64 bit libraries.

/lib is for 32 bit libraries, thus the system won't find them unless you are linking a 32 bit binary.

/lib64 is for 64 bit libraries...

And then you really should put the distribution kit somewhere other than the system directories... things could get damaged during updates to the system. I usually put them in /usr/local, then the /etc/ld.so.conf.d directory would have an entry to refer to /usr/local/lib64 (or lib) so that links can find it.
 
Old 11-19-2013, 06:02 AM   #3
Gaidal
LQ Newbie
 
Registered: May 2002
Location: Sweden
Distribution: Arch x64
Posts: 29

Original Poster
Blog Entries: 2

Rep: Reputation: 0
I think Arch Linux is pure 64-bit (unless you enable multilib), and I have:
Code:
lib64 -> usr/lib/
So that's probably not the issue.

By the way I have linked -lrt in my own projects so I know it's there. Just don't understand what's different about this Makefile.

My directories are just the Arch Linux defaults, and haven't given me any trouble during the years I've used it.
 
Old 11-19-2013, 08:06 AM   #4
Gaidal
LQ Newbie
 
Registered: May 2002
Location: Sweden
Distribution: Arch x64
Posts: 29

Original Poster
Blog Entries: 2

Rep: Reputation: 0
Because the -static flag was specified, ld was looking not for .so-files but for librt.a and libpcre.a, which I didn't have.

Since I'm not sure how to get these static versions that I couldn't in the repo, I solved the problem by removing "-static" in the makefile above.
 
  


Reply

Tags
arch linux, compiling, ld



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ls -lrt interpretation drwxrwx--- 3 600 was 16384 May 24 vaibhavs17 Linux - Newbie 8 05-24-2013 06:15 AM
[SOLVED] How to compile only specific arch code (linux-3.8.2/arch/x86) ?. abdulrahuman.s@gmail.com Linux - Kernel 6 05-18-2013 04:09 PM
[SOLVED] SIMH diesn't compile "undefinied reference to [fmod|clock_getres" although -lrt/-lm thosch97 Linux - Software 2 10-16-2011 05:19 AM
LXer: LinSched Advances For Testing The Linux Scheduler LXer Syndicated Linux News 0 10-15-2010 06:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration