I am currently working on a project on encryption and decryption using OpenSSL library, and I'm trying to run a simple encryption. This is my make file:
INC=/usr/local/ssl/include/
LIB=/usr/local/ssl/lib/
all:
gcc -I$(INC) -L$(LIB) -o out encryption.c -lcrypto -ldl
Must note I'm not using Xcode or anything like it, just the Terminal. And these are the errors I am receiving:
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
It works just fine on Ubuntu, on a VirtualBox, while I'm trying to make this work on OS X. I've seen many topics on this but they don't seem to help because they're linked with an IDE or so.