Relinux环境编译 c语言版sdk提示ssl错误
我在ubuntu环境编译 linux 平台 c语言版sdk, 到最后编译 阿里云sdk时,总是提示 ssl的库文件错误。
就是参考 README.md文件来编译的。
-------------------------
Relinux环境编译 c语言版sdk提示ssl错误
编译的sdk版本是 aliyun-oss-c-sdk-3.4.3.tar.gz
依赖库版本分别是:
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
curl-7.34.0.tar.gz
mxml-2.9.tar.gz
openssl-1.0.1e.tar.gz
perl-5.16.3.tar.gz
-------------------------
Relinux环境编译 c语言版sdk提示ssl错误
(1) curl-7.34.0(官方建议7.32.0及以上版本)
http://curl.haxx.se/download.html
cd /home/oss_sdk_test/curl-7.34.0 \
&& ./configure --with-ssl --with-libssl-prefix=/usr/local/ssl && make
&& make install
(2) apr-1.5.2(官方建议1.5.2及以上版本)
https://apr.apache.org/download.cgi
cd /home/oss_sdk_test/apr-1.5.2 && ./configure && make
&& make install
(3) apr-util-1.5.4(官方建议1.5.4及以上版本)
https://apr.apache.org/download.cgi
cd /home/oss_sdk_test/apr-util-1.5.4 \
&& ./configure --with-apr=/usr/local/apr/ && make
&& make install
(4) mxml-2.9(官方建议2.8及以上版本)
http://www.msweet.org/downloads.php?L+Z3
cd /home/oss_sdk_test/mxml-2.9 && ./configure
&& make
&& make install
(5) 编译OSS C SDK
https://help.aliyun.com/document_detail/32175.html
cd /home/oss_sdk_test/aliyun-oss-c-sdk-3.4.3
cmake . -DCURL_INCLUDE_DIR=/usr/local/include/curl/ -DCURL_LIBRARY=/usr/local/lib/libcurl.a \
-DAPR_INCLUDE_DIR=/usr/local/include/apr-1/ -DAPR_LIBRARY=/usr/local/apr/lib/libapr-1.a \
-DAPR_UTIL_INCLUDE_DIR=/usr/local/apr/include/apr-1 -DAPR_UTIL_LIBRARY=/usr/local/apr/lib/libaprutil-1.a \
-DMINIXML_INCLUDE_DIR=/usr/local/include -DMINIXML_LIBRARY=/usr/local/lib/libmxml.a
make
编译出现错误如下:
Linking C executable ../build/bin/oss_c_sdk_sample
/usr/local/lib/libcurl.a(libcurl_la-ssluse.o): In function `ossl_recv':
ssluse.c:(.text+0x2c): undefined reference to `ERR_clear_error'
ssluse.c:(.text+0x58): undefined reference to `SSL_read'
ssluse.c:(.text+0x98): undefined reference to `SSL_get_error'
ssluse.c:(.text+0xb1): undefined reference to `ERR_get_error'
ssluse.c:(.text+0x107): undefined reference to `ERR_error_string'
/usr/local/lib/libcurl.a(libcurl_la-ssluse.o): In function `ossl_send':
ssluse.c:(.text+0x16c): undefined reference to `ERR_clear_error'
ssluse.c:(.text+0x198): undefined reference to `SSL_write'
ssluse.c:(.text+0x1d0): undefined reference to `SSL_get_error'
ssluse.c:(.text+0x1e8): undefined reference to `ERR_get_error'
ssluse.c:(.text+0x1f3): undefined reference to `ERR_error_string'
/usr/local/lib/libcurl.a(libcurl_la-ssluse.o): In function `x509_name_oneline':
ssluse.c:(.text+0x2a6): undefined reference to `BIO_s_mem'
ssluse.c:(.text+0x2ae): undefined reference to `BIO_new'
ssluse.c:(.text+0x2cd): undefined reference to `X509_NAME_print_ex'
ssluse.c:(.text+0x2e4): undefined reference to `BIO_ctrl'
ssluse.c:(.text+0x313): undefined reference to `BIO_free'
/usr/local/lib/libcurl.a(libcurl_la-ssluse.o): In function `cert_verify_callback':
ssluse.c:(.text+0x351): undefined reference to `X509_STORE_CTX_get_current_cert'
ssluse.c:(.text+0x359): undefined reference to `X509_get_subject_name'
/usr/local/lib/libcurl.a(libcurl_la-ssluse.o): In function `ssl_ui_writer':
ssluse.c:(.text+0x630): undefined reference to `UI_get_string_type'
ssluse.c:(.text+0x640): undefined reference to `UI_get0_user_data'
ssluse.c:(.text+0x64d): undefined reference to `UI_get_input_flags'
ssluse.c:(.text+0x656): undefined reference to `UI_OpenSSL'
ssluse.c:(.text+0x65e): undefined reference to `UI_method_get_writer'
/usr/local/lib/libcurl.a(libcurl_la-ssluse.o): In function `ssl_ui_reader':
ssluse.c:(.text+0x68e): undefined reference to `UI_get_string_type'
-------------------------
Relinux环境编译 c语言版sdk提示ssl错误
参考sdk源码里的 README.md文件,在 64位 ubuntu环境编译的。
-------------------------
Relinux环境编译 c语言版sdk提示ssl错误
帮助文档中,没有看到执行cmake命令时,设置openssl头文件和库文件的定义。
-------------------------
Relinux环境编译 c语言版sdk提示ssl错误
openssl 可以编译通过,
编译crul 的时候,需要打开ssl 么?
-------------------------
Relinux环境编译 c语言版sdk提示ssl错误
只在编译curl的时候,设置 openssl的路径么?
后面编译 OSS C SDK时,不用再设置 openssl 的 sdk路径么 ?