Handle linker scripts #5

1 commit merged into from Nov 22, 2010


None yet
1 participant

wadey commented Nov 22, 2010

On some OSes (such as Ubuntu linux), a .so file can contain a linker script which will point to the correct shared library to use. This will cause dlopen to raise an error.

As an example, here is what /usr/lib/libc.so looks like on Ubuntu 10.04:

/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux-x86-64.so.2 ) )

I found this Haskell GHC ticket from when they ran into the same problem: http://hackage.haskell.org/trac/ghc/ticket/2615 . I ported their solution to node-ffi (basically, see if the error message is "invalid ELF header" and then try to read the file and look for the GROUP section).

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment