aliyun / aliyun-oss-cpp-sdk

Aliyun OSS SDK for C++
Other
188 stars 88 forks source link

ubuntu 16.04 64bit make时提示“../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to `curl_easy_perform'”等 #88

Closed chwncy closed 4 months ago

chwncy commented 3 years ago

../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to curl_easy_perform' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference tocurl_easy_getinfo' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to curl_easy_reset' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference tocurl_easy_init' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to curl_easy_strerror' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference tocurl_slist_append' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to curl_easy_cleanup' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference tocurl_slist_free_all' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to curl_easy_setopt' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference tocurl_global_init' ../lib/libalibabacloud-oss-cpp-sdk.so: undefined reference to `curl_global_cleanup' collect2: error: ld returned 1 exit status sample/CMakeFiles/cpp-sdk-sample.dir/build.make:211: recipe for target 'sample/cpp-sdk-sample' failed make[2]: [sample/cpp-sdk-sample] Error 1 CMakeFiles/Makefile2:190: recipe for target 'sample/CMakeFiles/cpp-sdk-sample.dir/all' failed make[1]: [sample/CMakeFiles/cpp-sdk-sample.dir/all] Error 2 Makefile:149: recipe for target 'all' failed make: *** [all] Error 2


命令行输入:”ldd libalibabacloud-oss-cpp-sdk.so“ 时,提示如下: linux-vdso.so.1 => (0x00007ffcb41f0000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f9ec8022000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9ec7ca0000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9ec7997000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9ec75cd000) /lib64/ld-linux-x86-64.so.2 (0x00007f9ec89e5000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9ec73c9000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9ec71b3000)


命令行输入:”sudo apt-get install libcurl4-openssl-dev libssl-dev“ 时,提示如下: Reading package lists... Done Building dependency tree
Reading state information... Done libcurl4-openssl-dev is already the newest version (7.47.0-1ubuntu2.16). libssl-dev is already the newest version (1.0.2g-1ubuntu4.17). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

LionelDong commented 3 years ago

兄弟你是用的cmake吗~ 最后怎么解决的

JianJingGao commented 4 months ago

22.04也遇到了这个问题....

chwncy commented 4 months ago

好几年过去了,貌似还是有人遇到这个问题,现在统一回复一下该如何编译

  1. 下载curl源码,并编译成功;
  2. 编译aliyun库,cmake .. -DCURL_LIBRARY=/xxx/lib/libcurl.so -DCURL_INCLUDE_DIR=/xxx/include -DCMAKE_INSTALL_PREFIX=$(pwd)/build -DBUILD_SHARED_LIBS=ON,等待编译完成