Trying to link mysqld to program, but getting errors

Hi!
I'm trying to create a small library that I want to include in other projects. The library is dependent upon SOCI, and subsequently mysql.

I actually copied the entire /soci and /mysql folders into my projects /include directory. I also copied the libmysqld.a, libsoci_core.a, and libsoci_mysql.a libs into my project's /lib directory.

I am compiling and linking with this:
g++ -c mylib.cpp entry.cpp object.cpp \
-I./include/soci \
-I./include/soci/mysql \
-I./include/mysql
g++ -fpic -shared -o mylib.dylib mylib.o entry.o object.o \
-Llib -lsoci_core -lsoci_mysql -lmysqld \
-I./include/soci \
-I./include/soci/mysql \
-I./include/mysql

The output comes during the linking phase, and is:

H6326:LibTest rweiss$ ./make
Undefined symbols for architecture x86_64:
"_CRYPTO_cleanup_all_ex_data", referenced from:
_vio_end in libmysqld.a(vio.c.o)
"_ERR_clear_error", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
_my_rand_buffer in libmysqld.a(my_rnd.cc.o)
_my_rnd_ssl in libmysqld.a(my_rnd.cc.o)
_ssl_should_retry in libmysqld.a(viossl.c.o)
"_ERR_free_strings", referenced from:
_vio_end in libmysqld.a(vio.c.o)
"_ERR_get_error", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_ERR_remove_state", referenced from:
_vio_end in libmysqld.a(vio.c.o)
"_EVP_CIPHER_CTX_cleanup", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_CIPHER_CTX_init", referenced from:
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_CIPHER_CTX_set_padding", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_CIPHER_block_size", referenced from:
_my_aes_get_size in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_CIPHER_iv_length", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
_my_aes_needs_iv in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_DecryptFinal_ex", referenced from:
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_DecryptInit", referenced from:
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_DecryptUpdate", referenced from:
_my_aes_decrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_EncryptFinal", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_EncryptInit", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_EncryptUpdate", referenced from:
_my_aes_encrypt in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_128_cbc", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_128_cfb1", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_128_cfb128", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_128_cfb8", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_128_ecb", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_128_ofb", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_192_cbc", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_192_cfb1", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_192_cfb128", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_192_cfb8", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_192_ecb", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_192_ofb", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_256_cbc", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_256_cfb1", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_256_cfb128", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_256_cfb8", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_256_ecb", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_aes_256_ofb", referenced from:
aes_evp_type(my_aes_opmode) in libmysqld.a(my_aes_openssl.cc.o)
"_EVP_cleanup", referenced from:
_vio_end in libmysqld.a(vio.c.o)
"_MD5_Final", referenced from:
_compute_md5_hash in libmysqld.a(my_md5.cc.o)
"_MD5_Init", referenced from:
_compute_md5_hash in libmysqld.a(my_md5.cc.o)
"_MD5_Update", referenced from:
_compute_md5_hash in libmysqld.a(my_md5.cc.o)
"_RAND_bytes", referenced from:
_my_rand_buffer in libmysqld.a(my_rnd.cc.o)
_my_rnd_ssl in libmysqld.a(my_rnd.cc.o)
"_SHA1_Final", referenced from:
mysql_sha1_result(SHAstate_st*, unsigned char*) in libmysqld.a(my_sha1.cc.o)
_compute_sha1_hash in libmysqld.a(my_sha1.cc.o)
_compute_sha1_hash_multi in libmysqld.a(my_sha1.cc.o)
"_SHA1_Init", referenced from:
mysql_sha1_reset(SHAstate_st*) in libmysqld.a(my_sha1.cc.o)
_compute_sha1_hash in libmysqld.a(my_sha1.cc.o)
_compute_sha1_hash_multi in libmysqld.a(my_sha1.cc.o)
"_SHA1_Update", referenced from:
mysql_sha1_input(SHAstate_st*, unsigned char const*, unsigned int) in libmysqld.a(my_sha1.cc.o)
_compute_sha1_hash in libmysqld.a(my_sha1.cc.o)
_compute_sha1_hash_multi in libmysqld.a(my_sha1.cc.o)
"_SSL_SESSION_set_timeout", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_accept", referenced from:
_sslaccept in libmysqld.a(viossl.c.o)
"_SSL_clear", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_connect", referenced from:
_sslconnect in libmysqld.a(viossl.c.o)
"_SSL_ctrl", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_free", referenced from:
_vio_ssl_delete in libmysqld.a(viossl.c.o)
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_get_error", referenced from:
_ssl_should_retry in libmysqld.a(viossl.c.o)
"_SSL_get_fd", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_get_session", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_new", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_pending", referenced from:
_vio_is_connected in libmysqld.a(viosocket.c.o)
_vio_ssl_has_data in libmysqld.a(viossl.c.o)
"_SSL_read", referenced from:
_vio_ssl_read in libmysqld.a(viossl.c.o)
"_SSL_set_fd", referenced from:
_ssl_do in libmysqld.a(viossl.c.o)
"_SSL_set_quiet_shutdown", referenced from:
_vio_ssl_shutdown in libmysqld.a(viossl.c.o)
"_SSL_shutdown", referenced from:
_vio_ssl_shutdown in libmysqld.a(viossl.c.o)
"_SSL_write", referenced from:
_vio_ssl_write in libmysqld.a(viossl.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Can anyone please help me troubleshoot?
Looks like you need to link libcrypto

Also, you shouldn't (need to) copy headers and libs to local folder just include their paths
Topic archived. No new replies allowed.