FFI error module not found
Question
I'm using Ubuntu 64bit and Pharo 1.2.1
I've written some FFI code that accesses crypt(3) from glibc. I'd like to change it to access crypt from libxcrypt that I install using apt-get. When I change the method from:
ffiCrypt: aKey with: aSalt
<cdecl: char* 'crypt' (char* char*) module: 'crypt'>
^self externalCallFailed
to:
ffiCrypt: aKey with: aSalt
<cdecl: char* 'crypt' (char* char*) module: '/lib/libxcrypt.so.1'>
^self externalCallFailed
I get External Module Not Found errors. I've linked to the libxcrypt.so.1 file from the directory my image is in.
I suspect it could be a 64 bit vs 32 bit library thing or that I need to link the library somewhere else but do not know.
What are some steps or things I could check to try to track down why the external module cannot be found?
Solution
It was both a 64bit vs 32bit library issue and a linking issue.
Reading this:
http://forum.world.st/FFI-library-dependency-howto-td50461.html#a50462
helped me learn about where Pharo looks for libraries so I just had to install the 32 bit libxcrypt and link to it properly.