View previous topic :: View next topic |
Author |
Message |
Zephire n00b
Joined: 29 Jan 2013 Posts: 3
|
Posted: Tue Jan 29, 2013 2:10 pm Post subject: ld not finding libary |
|
|
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 |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9526 Location: beyond the rim
|
Posted: Tue Jan 29, 2013 3:12 pm Post subject: |
|
|
ld.so.conf configures the directories to be used for libraries at runtime. |
|
Back to top |
|
|
Zephire n00b
Joined: 29 Jan 2013 Posts: 3
|
Posted: Tue Jan 29, 2013 5:41 pm Post subject: |
|
|
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21624
|
Posted: Wed Jan 30, 2013 2:02 am Post subject: |
|
|
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 |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9526 Location: beyond the rim
|
Posted: Wed Jan 30, 2013 8:29 am Post subject: |
|
|
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 |
|
|
|