Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ld not finding libary
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Zephire
n00b
n00b


Joined: 29 Jan 2013
Posts: 3

PostPosted: Tue Jan 29, 2013 2:10 pm    Post subject: ld not finding libary Reply with quote

Dear fellow gentoo users,

I have the follwing problem that ld is not finding a libary despite its path being listed in /etc/ld.so.conf.

Quote:
gcc -lbcm_host main.c
/usr/lib/gcc/armv6j-hardfloat-linux-gnueabi/4.5.4/../../../../armv6j-hardfloat-linux-gnueabi/bin/ld: cannot find -lbcm_host
collect2: ld returned 1 exit status

but if I manually add the path by the -L argument all works fine:
Quote:
gcc -L/opt/vc/lib -lbcm_host main.c


But /opt/vc/lib is listed in
Quote:
# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
/lib
/usr/lib
/usr/local/lib
include ld.so.conf.d/*.conf
/usr/lib/opengl/xorg-x11/lib
/opt/vc/lib


I run ldconfig and env-update multiple times, but no change in the behaviour. Does -L do more than what ld.so.conf does?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9013
Location: beyond the rim

PostPosted: Tue Jan 29, 2013 3:12 pm    Post subject: Reply with quote

ld.so.conf configures the directories to be used for libraries at runtime.
Back to top
View user's profile Send private message
Zephire
n00b
n00b


Joined: 29 Jan 2013
Posts: 3

PostPosted: Tue Jan 29, 2013 5:41 pm    Post subject: Reply with quote

Thank you. I recreated the ./configure and now somehow it finds the path.
Edit: Not quite. I have to add /opt/vc/lib to LIBRARY_PATH. What is the right way to make
Gentoo aware of /opt/vc/lib for compiling?

How does the System know in which folders it has to look for libs for compiling? It seems
the libs in /opt/vc/lib are not registered with pkg-config.
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 9059

PostPosted: Wed Jan 30, 2013 2:02 am    Post subject: Reply with quote

Use export LDFLAGS+=-L/opt/vc/lib for manual usage, or add LDFLAGS="-L/opt/vc/lib" to the Portage environment for the package. If your build system respects LDFLAGS, that will be sufficient.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9013
Location: beyond the rim

PostPosted: Wed Jan 30, 2013 8:29 am    Post subject: Reply with quote

Generally it's the responsibility of the build system to call the compiler/linker with the appropriate options to find the necessary headers/libraries, e.g. using ./configure --with-foo=/usr/lib/myfoo to add -L/usr/lib/myfoo.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum