Hello all,
I am wondering if it is possible to statically link to mcrypt libraries when compiling and linking my own c code? I get these errors when I do:
gcc -I/usr/local/include -c xx.c
gcc -o xx xx.o -L/usr/local/lib -lmcrypt -static
/usr/bin/ld: cannot find -lmcrypt
collect2: ld returned 1 exit status
make: *** [filtercmd] Error 1
I removed -lmcrypt and did this instead:
gcc -o xx xx.o -static /usr/local/lib/libmcrypt.so
This seems to link OK, but when I try to run the resultant
application, I get this:
/usr/lib/libc.so.1: bad ELF interpreter: No such file or directory
Yikes! Where is it trying to dynamically link this? But I'm not sure I even linked correctly anyway.
All this is on Fedora Core 2, BTW, with libmcrypt 2.5.7 installed from source (correctly, I think, since PHP uses it perfectly fine).
The code I am compiling is just VERY simple example code to get me going:
#include <mcrypt.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
char *algo = "asdfasdf";
MCRYPT td;
td = mcrypt_module_open(algo, NULL, NULL, NULL);
}
= = = = = = = = = = = = = = = = = = = =
I also can't get it to link dynamically, which is NOT my first choice (due to other constraints):
When linking, I removed -static and the direct libmcrypt.so reference and added -lmcrypt -L/usr/local/lib:
gcc -o xx xx.o -L/usr/local/lib -lmcrypt
Which links OK, but this happens when running it:
error while loading shared libraries: libmcrypt.so.4: cannot open
shared object file: No such file or directory:
But I think this happens because I didn't compile mcrypt to use dynamic loading (see libmcrypt's README; it's not turned on by default). Again, static linking is my preference anyway.
mcrypt-devel list is ghostly quiet.... hoping there are actually ppl here.
TIA!!!!