BaiduPCS
BaiduPCS copied to clipboard
Mac执行make时发生错误
错误如下: Undefined symbols for architecture x86_64: "_AES_cbc_encrypt", referenced from: _exec_cmd in baidupcs-shell.o _decrypt_data in baidupcs-shell.o _decrypt_file in baidupcs-shell.o _encrypt_file in baidupcs-shell.o "_AES_set_decrypt_key", referenced from: _decrypt_data in baidupcs-shell.o _decrypt_file in baidupcs-shell.o "_AES_set_encrypt_key", referenced from: _exec_cmd in baidupcs-shell.o _encrypt_file in baidupcs-shell.o "_MD5", referenced from: _pcs_md5_string in baidupcs-pcs_utils.o _pcs_md5_string_raw in baidupcs-pcs_utils.o _pcs_md5_bytes_raw in baidupcs-pcs_utils.o _pcs_md5_bytes in baidupcs-pcs_utils.o "_MD5_Final", referenced from: _exec_cmd in baidupcs-shell.o _decrypt_data in baidupcs-shell.o _decrypt_file in baidupcs-shell.o _encrypt_file in baidupcs-shell.o _pcs_md5_file_s in baidupcs-pcs_utils.o _pcs_md5_file in baidupcs-pcs.o _pcs_md5_s in baidupcs-pcs.o ... "_MD5_Init", referenced from: _exec_cmd in baidupcs-shell.o _decrypt_data in baidupcs-shell.o _decrypt_file in baidupcs-shell.o _encrypt_file in baidupcs-shell.o _pcs_md5_file_s in baidupcs-pcs_utils.o _pcs_md5_file in baidupcs-pcs.o _pcs_md5_s in baidupcs-pcs.o ... "_MD5_Update", referenced from: _exec_cmd in baidupcs-shell.o _decrypt_data in baidupcs-shell.o _decrypt_file in baidupcs-shell.o _encrypt_file in baidupcs-shell.o _pcs_md5_file_s in baidupcs-pcs_utils.o _pcs_md5_file in baidupcs-pcs.o _pcs_md5_s in baidupcs-pcs.o ... ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [baidupcs] Error 1 make: *** [all] Error 2
回滚到24 Aug之前的节点才能编译通过。
See https://github.com/GangZhuo/BaiduPCS/blob/master/README.md#3-编译源代码-3
OSX 10.11 以及 OSX10.12编译均出现同样的错误,OSX10.7 10.8 10.9 10.10系统编译未见异常 (我用虚拟机装了多个系统版本进行测试)本机系统:OSX 10.11
原因是 openssl 库没有找到,请确认 export LDFLAGS=-L/usr/local/opt/openssl/lib 指定的库目录是否正确,我没有 OS 系统
反复查看Makefile文件后发现LD、OPENSSL_LIBS缺省值有问题,需要在编译的时候重新指定 下面是我的编译过程(已在 osx10.11 10.12系统测试成功 )
brew install openssl automake
cd BaiduPCS
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
autoreconf
./configure LD=/usr/bin/ld OPENSSL_LIBS='-lssl -lcrypto -lz'
make clean
make
make install #将安装到/usr/local/bin下