I run into linking issues using libaerospike on ubuntu 14.04.
Here is sample program, that does nothing:
#include <aerospike/as_double.h>
int main() {
as_double x;
as_double_init(&x, 1);
}
When I use ld flags suggested here, I have to add -lz, but still I have success only with g+±4.4. Newer version (tested 4.7, 4.8, 4.9) always ends with undefined symbols from lm, lcrypto, ldl. The command is g++ a.cc -laerospike -lssl -lcrypto -lpthread -lrt -ldl -lz. I don’t have this problems on debian 7.1 nor debian 8.2.
I’m curious why libaerospike.so doesn’t have dependencies on these libraries?
I was able to duplicate the error with your link line with gcc 4.8.2. You need to put the crypto library before the ssl library. Also, the math library is needed “-lm”. The following compile/link steps work for me on ubuntu 14.04 with gcc 4.8.2.
Hi Brian,
I am also having issue with linking libraries of aerospike while creating shared object file from object file of c program.
For creating object file I am using following command : gcc -DAS_USE_LIBEV -o aerospikeWriteOperation.o aerospikeWriteOperation.c -laerospike -lssl -lcrypto -lpthread -lm -lz
Above command is able to create the object file. but when I am trying create shared object file using following command, .so file is not getting generated. Can you please help me with this issue :
Error:
aerospikeWriteOperation.o:(.rodata+0x8): multiple definition of __dso_handle' /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginS.o:(.data.rel.ro+0x0): first defined here aerospikeWriteOperation.o: In function _fini’:
(.fini+0x0): multiple definition of _fini' /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o:(.fini+0x0): first defined here aerospikeWriteOperation.o: In function _init’:
(.init+0x0): multiple definition of _init' /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o:(.init+0x0): first defined here /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtendS.o:(.tm_clone_table+0x0): multiple definition of TMC_END’
aerospikeWriteOperation.o:(.data+0x8): first defined here
/usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
/usr/bin/ld: error in aerospikeWriteOperation.o(.eh_frame); no .eh_frame_hdr table will be created.
collect2: error: ld returned 1 exit status