我目前正在开发一个使用OpenSSL库加密和解密的项目,我试图运行一个简单的加密。这是我的make文件:
INC=/usr/local/ssl/include/
LIB=/usr/local/ssl/lib/
all:
gcc -I$(INC) -L$(LIB) -o out encryption.c -lcrypto -ldl
必须注意我没有使用Xcode或类似的东西,只有终端。这些是我收到的错误:
gcc -I/usr/local/ssl/include/ -L/usr/local/ssl/lib/ -o out ex_1.c -lcrypto -ldl
ld: warning: ignoring file /usr/local/ssl/lib//libcrypto.a, file was built for archive which is not the architecture being linked (x86_64): /usr/local/ssl/lib//libcrypto.a
Undefined symbols for architecture x86_64:
"_BIO_dump_fp", referenced from:
_main in ex_1-a0d79f.o
"_ERR_free_strings", referenced from:
_main in ex_1-a0d79f.o
"_ERR_load_crypto_strings", referenced from:
_main in ex_1-a0d79f.o
"_ERR_print_errors_fp", referenced from:
_handleErrors in ex_1-a0d79f.o
"_EVP_CIPHER_CTX_free", referenced from:
_encrypt in ex_1-a0d79f.o
_decrypt in ex_1-a0d79f.o
"_EVP_CIPHER_CTX_new", referenced from:
_encrypt in ex_1-a0d79f.o
_decrypt in ex_1-a0d79f.o
"_EVP_DecryptFinal_ex", referenced from:
_decrypt in ex_1-a0d79f.o
"_EVP_DecryptInit_ex", referenced from:
_decrypt in ex_1-a0d79f.o
"_EVP_DecryptUpdate", referenced from:
_decrypt in ex_1-a0d79f.o
"_EVP_EncryptFinal_ex", referenced from:
_encrypt in ex_1-a0d79f.o
"_EVP_EncryptInit_ex", referenced from:
_encrypt in ex_1-a0d79f.o
"_EVP_EncryptUpdate", referenced from:
_encrypt in ex_1-a0d79f.o
"_EVP_aes_256_cbc", referenced from:
_encrypt in ex_1-a0d79f.o
_decrypt in ex_1-a0d79f.o
"_EVP_cleanup", referenced from:
_main in ex_1-a0d79f.o
"_OPENSSL_add_all_algorithms_noconf", referenced from:
_main in ex_1-a0d79f.o
"_OPENSSL_config", referenced from:
_main in ex_1-a0d79f.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: *** [all] Error 1
它在Ubuntu上运行得很好,在VirtualBox上,而我正在尝试在OS X上完成这项工作。我已经看过很多这方面的话题,但他们似乎没有帮助,因为它们与IDE左右相关联。