链接 OpenSSL 时对 t1sl_steup_key_block 的未定义引用
我在将 OpenSSL 库链接到现有项目时遇到问题。 我哪里弄错了?
以下是我遵循的步骤。
我已经下载了 SSL 库,配置并安装了它。它安装在 /usr/local/ssl
中。
2)我已将 libcrypto.a
和 libssl.a
从 /usr/local/ssl/lib
复制到我的项目中,例如 /mnt/linux/bla/bla/lib
.
3)然后我编辑 make 文件并在其中添加 libssl libcrpto 的路径。添加的路径是像 /mnt/linux/bla /bla
3) make
4) build project via slick edit 这样的
项目中的路径当它构建时,我会得到一个很长的错误链,就像
../lib/libssl.a(t1_enc.o) :In function 't1sl_steup_key_block: undefined ref
现在一样,我猜将 .a 文件复制到项目中可能会出现问题。有没有其他选择,或者我应该使用 ln -s 将 .a 文件从 /usr/local/openssl/lib 链接到我的项目库文件夹中?下面是错误。
Debug/FC5/m2pa.o -ldl -lpthread -ltdapi ../septel/gctlib.lib ../lib/libpq.a ../asn1/lib/libasn1per.a ../mysql/lib/libmysqlclient.a -L../lib ../asn1/lib/libasn1rt.a -lm -lcrypt -lcrypto -lssl -rdynamic
../lib/libssl.a(ssl_lib.o): In function `SSL_set_quiet_shutdown':ssl_lib.c:(.text+0x670): multiple definition of `SSL_set_quiet_shutdown'
../mysql/lib/libmysqlclient.a(ssl.o):ssl.cpp:(.text+0x125c): first defined here
/usr/bin/ld: Warning: size of symbol `SSL_set_quiet_shutdown' changed from 45 in ../mysql/lib/libmysqlclient.a(ssl.o) to 12 in ../lib/libssl.a(ssl_lib.o)
../lib/libssl.a(ssl_lib.o): In function `SSL_get_quiet_shutdown':ssl_lib.c:(.text+0x680): multiple definition of `SSL_get_quiet_shutdown'
../mysql/lib/libmysqlclient.a(ssl.o):ssl.cpp:(.text+0x12down' changed from 35 in ../mysql/lib/libmysqlclient.a(ssl.o) to 8 in ../lib/libssl.a(ssl_lib.o)
../lib/libssl.a(ssl_err2.o): In function `SSL_load_error_strings':ssl_err2.c:(.text+0x4): undefined reference to `ERR_load_crypto_strings'
../lib/libssl.a(ssl_algs.o): In function `SSL_library_init':ssl_algs.c:(.text+0x4): undefined reference to `EVP_des_cbc'
:ssl_algs.c:(.text+0xc): undefined reference to `EVP_add_cipher'
:ssl_algs.c:(.text+0x11): undefined reference to `EVP_des_ede3_cbc'
:ssl_algs.c:(.text+0x19): undefined reference to `EVP_add_cipher'
:ssl_algs.c:(.text+0x1e): undefined reference to `EVP_idea_cbc'
I got a problem of linking an OpenSSL library into an existing project.
Where I do get it wrong?
Below are the steps I have followed.
I have downloaded the SSL library, configured and installed it. It gets installed in /usr/local/ssl
.
2) I have copied libcrypto.a
and libssl.a
from /usr/local/ssl/lib
into my project, something like /mnt/linux/bla/bla/lib
.
3) Then I edit the make file and added path of libssl libcrpto there. The path added is one that is in project like /mnt/linux/bla /bla
3) make
4) build project via slick edit
When it builds I get a long error chain, like
../lib/libssl.a(t1_enc.o) :In function 't1sl_steup_key_block: undefined ref
Now, I guess copying .a files into project could be problem. Is there is any alternative for that or should I use ln -s
to link .a files form /usr/local/openssl/lib
into my project library folder? Below is the error.
Debug/FC5/m2pa.o -ldl -lpthread -ltdapi ../septel/gctlib.lib ../lib/libpq.a ../asn1/lib/libasn1per.a ../mysql/lib/libmysqlclient.a -L../lib ../asn1/lib/libasn1rt.a -lm -lcrypt -lcrypto -lssl -rdynamic
../lib/libssl.a(ssl_lib.o): In function `SSL_set_quiet_shutdown':ssl_lib.c:(.text+0x670): multiple definition of `SSL_set_quiet_shutdown'
../mysql/lib/libmysqlclient.a(ssl.o):ssl.cpp:(.text+0x125c): first defined here
/usr/bin/ld: Warning: size of symbol `SSL_set_quiet_shutdown' changed from 45 in ../mysql/lib/libmysqlclient.a(ssl.o) to 12 in ../lib/libssl.a(ssl_lib.o)
../lib/libssl.a(ssl_lib.o): In function `SSL_get_quiet_shutdown':ssl_lib.c:(.text+0x680): multiple definition of `SSL_get_quiet_shutdown'
../mysql/lib/libmysqlclient.a(ssl.o):ssl.cpp:(.text+0x12down' changed from 35 in ../mysql/lib/libmysqlclient.a(ssl.o) to 8 in ../lib/libssl.a(ssl_lib.o)
../lib/libssl.a(ssl_err2.o): In function `SSL_load_error_strings':ssl_err2.c:(.text+0x4): undefined reference to `ERR_load_crypto_strings'
../lib/libssl.a(ssl_algs.o): In function `SSL_library_init':ssl_algs.c:(.text+0x4): undefined reference to `EVP_des_cbc'
:ssl_algs.c:(.text+0xc): undefined reference to `EVP_add_cipher'
:ssl_algs.c:(.text+0x11): undefined reference to `EVP_des_ede3_cbc'
:ssl_algs.c:(.text+0x19): undefined reference to `EVP_add_cipher'
:ssl_algs.c:(.text+0x1e): undefined reference to `EVP_idea_cbc'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用已安装在 /usr/lib 目录中的 libssl 和 libcrypto (假设您已经安装了两者的开发包)?一旦使用默认安装编译并运行且没有错误,您就可以从源代码构建新的 libssl/libcrypto(?),安装到 usr/local,并使用库的 usr/local 版本进行重建。
Have you tried using the libssl and libcrypto already installed in your /usr/lib directory (assuming you've installed the dev packages for both)? Once that compiles and runs without error using the default install, you can build your new libssl/libcrypto(?) from source, install to usr/local, and rebuild using the usr/local versions of the libraries.
您需要在 makefile 中添加标志
-lssl
和-lcrypto
例如:
You need to add the flag
-lssl
and-lcrypto
in your makefile'For example: