LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-22-2007, 02:44 PM   #1
kvtournh
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Mandriva
Posts: 91

Rep: Reputation: 15
ld can't find library during linking


Hi,

I try to compile a program written in c++ but needs a fortran library which needs the ifcore library from ifort. I do the following which should work (afaik)

Code:
$ icpc -O3 -xP -axP -no-ipo -o blub blub.o fortlib.a -lifcore
ld: cannot find -lifcore
libifcore.so, libifcore.so.5 and libifcore.a are all included in the directory /usr/local/intel/fce/9.1.036/lib/ and this directory is located in /etc/ld.conf.so

Code:
 $ ls -l /usr/local/intel/fce/9.1.036/lib/*ifcore*
-rw-r--r-- 1 root root 1229946 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcore.a
-rw-r--r-- 1 root root 1260052 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcoremt.a
-rw-r--r-- 1 root root 1265484 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcoremt_pic.a
-rwxr-xr-x 1 root root      27 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcoremt.so*
-rwxr-xr-x 1 root root  969224 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcoremt.so.5*
-rw-r--r-- 1 root root 1234150 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcore_pic.a
-rwxr-xr-x 1 root root      25 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcore.so*
-rwxr-xr-x 1 root root  951040 Jul  7  2006 /usr/local/intel/fce/9.1.036/lib/libifcore.so.5*
$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/X11R6/lib
/usr/lib/qt3/lib64
/usr/local/lib/root
/usr/local/intel/cc/9.1.042/lib
/usr/local/intel/cce/9.1.042/lib
/usr/local/intel/fce/9.1.036/lib

$ ldconfig -p | grep ifcore
        libifcoremt.so.5 (libc6,x86-64) => /usr/local/intel/fce/9.1.036/lib/libifcoremt.so.5
        libifcore.so.5 (libc6,x86-64) => /usr/local/intel/fce/9.1.036/lib/libifcore.so.5
So ... what is going wrong here?
 
Old 02-22-2007, 02:58 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
I think the ld.so.conf is only changing what paths are searched at runtime of the program, and not used by ld, so you need to add the path using a -L option:
Code:
-L/usr/local/intel/fce/9.1.036/lib
If you added the paths to ld.so.conf since the last boot, make sure you run ldconfig to update the linker cache before you run your program.
 
Old 02-22-2007, 04:47 PM   #3
kvtournh
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Mandriva
Posts: 91

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by matthewg42
I think the ld.so.conf is only changing what paths are searched at runtime of the program, and not used by ld, so you need to add the path using a -L option:
Code:
-L/usr/local/intel/fce/9.1.036/lib
If you added the paths to ld.so.conf since the last boot, make sure you run ldconfig to update the linker cache before you run your program.
Thanks matthew,
You are completely right. I knew this already (the -L) ... but I thought that the library-paths searched in, were those of the ld program. This is not true at all. It are the paths the compiler uses. The -print-search-path flag shows those.

It all makes sence now, because i was already wondering how they could distinguish between libraries with the same name and version numbers but other directory.

regards

Last edited by kvtournh; 02-22-2007 at 07:57 PM.
 
  


Reply



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
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
strange linking error -- can not find shared library George2 Programming 1 07-10-2006 11:24 AM
Linking with a library stonehurstX11 Linux - Newbie 4 01-04-2006 04:07 PM
linking own library bobby2k3 Programming 2 10-20-2003 10:36 AM
linking library simonissa Linux - Software 2 05-21-2003 09:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03: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