[Openmcl-devel] Error: Can't resolve foreign symbol "sinf"

R. Matthew Emerson rme at clozure.com
Mon Dec 12 20:46:40 UTC 2011


On Dec 12, 2011, at 1:28 AM, Gary Byers wrote:

> 
> 
> On Sun, 11 Dec 2011, Otto Diesenbacher wrote:
> 
>> Gary Byers <gb at clozure.com> writes:
>> 
>> thanks for your answer!
>> 
>> yep, it gives a null-pointer:
>> 
>> Welcome to Clozure Common Lisp Version 1.8-dev-r15129M-trunk  (LinuxX8664)!
>> ? (with-cstrs ((name "sinf"))
>>   (#_dlsym #$RTLD_DEFAULT name))
>> #<A Null Foreign Pointer>
>> 
>> Stable Release 1.7 works fine:
>> 
>> Welcome to Clozure Common Lisp Version 1.7-r14925M  (LinuxX8664)!
> 
> 
> I had installed Ubuntu 11.10 on a machine here, but hadn't updated
> the installed packages since I did so.  The linker (I assume) seems
> to have changed; traditionally, if a shared library was referenced
> in the call to the linker, the application was linked to refer to
> the library (regardless of whether or not it referenced anything that
> was defined in that library); some recent change to the linker seems
> to cause the library to be quietly omitted if there are no references
> to symbols that it defines.
> [...]
> I don't know whether the old behavior was documented or intentional
> or whether the change is documented or intentional or whether there
> are linker options to control it.

There appears to be a linker option named --as-needed.  With this
option in effect, libfoo will not be linked even if we specify -lfoo.

According to https://wiki.ubuntu.com/OneiricOcelot/ReleaseNotes, the
option --as-needed is now the default on Ubuntu 11.10.

It's possible to turn this behavior off.  The release notes above mention
http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

So, we could say -Wl,--no-as-needed to the link command line instead of
adding explicit references to sinf or exp or whatever.  I hesitate to
use the word "aesthetic" with any of this, but I personally find the
use of -Wl,--no-as-needed somewhat more aesthetically appealing (in a
relative sense).




More information about the Openmcl-devel mailing list