Problems with linking on FreeBSD-10

Konstantin Belousov kostikbel at gmail.com
Fri Jan 31 13:25:16 UTC 2014


On Fri, Jan 31, 2014 at 12:19:46AM +0000, Montgomery-Smith, Stephen wrote:
> I maintain the port math/sage.  The port builds its own version of the
> libreadline library.  The port also uses lang/gcc instead of clang,
> because the port needs Fortran.
> 
> The port is wanting to create a shared library called libR.so, which it
> wants to link with the libreadline library it created itself.  So it
> issues this kind of command:
> 
> gcc46 -Wl,-rpath=path-of-newly-made-library -o libR.so -lreadline
> 
> I have left out most of the command for brevity.
Not for brevity, but to make the diagnostic impossible.

> 
> Unfortunately the libR.so pulls in /lib/libreadline - the version that
> comes with the base FreeBSD.  I thought that -rpath flag was supposed to
> tell the linker where to find the library.  But it doesn't.
Show exact commands and exact error message.  It is not possible to
understand from you message is the failure at the static linking (ld(1))
or dynamic (at the program startup) stage.

Just in case this might be useful:
- -rpath only affects runtime search path
- ld(1) search for libraries is directed with the -L <path> option.

> 
> The failure is when using FreeBSD-10.  With FreeBSD-8 it works great.  I
> also assume that gcc46 uses /usr/local/bin/ld instead of /usr/bin/ld,
> since devel/binutils is a dependency of lang/gcc.
> 
> Can anyone help me?  Is this a bug with FreeBSD?  Or is there some extra
> flag I can set with the linker to make it work?  I have tried
> -rpath-link and -z origin, but these were random guesses. and I don't
> really know what I am doing.
> 
> Thanks, Stephen
> 
> _______________________________________________
> freebsd-ports at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20140131/4dd000ce/attachment.sig>


More information about the freebsd-ports mailing list