OpenWrt Forum Archive

Topic: Problem compiling a c program that uses libopenssl library.

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have install openssl library using make menuconfig, after that I have tried the program using the crosscompling as shown:

mipsel-linux-gcc client.c -o client -lssl

and I got the folowing errors:

In file included from client.c:1:
sockets.h:12:25: openssl/rsa.h: No such file or directory
sockets.h:13:25: openssl/evp.h: No such file or directory
sockets.h:14:25: openssl/pem.h: No such file or directory
client.c: In function `main':
client.c:12: error: `RSA' undeclared (first use in this function)
client.c:12: error: (Each undeclared identifier is reported only once
client.c:12: error: for each function it appears in.)
client.c:12: error: `key' undeclared (first use in this function)
client.c:12: error: `key2' undeclared (first use in this function)
client.c:36: error: `RSA_PKCS1_PADDING' undeclared (first use in this function)

So I tried this way because I knew where those files ware:

mipsel-linux-gcc -I/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/include -L/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib  client.c -lssl

And I got the folowing errors.

client.c:(.text+0x350): undefined reference to `PEM_read_RSAPrivateKey'
client.c:(.text+0x3a4): undefined reference to `RSA_private_encrypt'
client.c:(.text+0x3bc): undefined reference to `RSA_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_find_type'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_enc_null'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_CIPHER_CTX_init'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_NAME_dup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `COMP_compress_block'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_new_null'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_get_by_subject'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `lh_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `asn1_const_Finish'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_VerifyFinal'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `COMP_CTX_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_dup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_set_ex_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_get_ex_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BN_bin2bn'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_get_ex_new_index'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_DigestFinal_ex'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `PEM_read_bio_RSAPrivateKey'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_aes_128_cbc'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BN_bn2bin'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RAND_add'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_s_socket'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_set_purpose'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `asn1_add_error'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BUF_MEM_grow_clean'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_next'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_RSAPrivateKey'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_num'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_insert'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_free_all'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_up_ref'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_get_retry_reason'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `HMAC_Final'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `HMAC_Init_ex'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_bits'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_md5'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_object_size'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_get_cipherbyname'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_rc4'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_add_cipher'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_get_object'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_s_file'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `COMP_expand_block'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_snprintf'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_RSAPrivateKey_bio'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_dup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_sign'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ERR_peek_error'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `PEM_read_bio_PrivateKey'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `lh_retrieve'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_get_pubkey'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_dup_ex_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DH_generate_key'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DH_size'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `i2d_ASN1_INTEGER'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `lh_doall_arg'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_set_ex_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_peek'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_printf'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_lock'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DSA_verify'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_pop_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_aes_192_cbc'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_MD_CTX_cleanup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_aes_256_cbc'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OPENSSL_DIR_read'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_puts'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_verify_cert_error_string'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BN_num_bits'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BUF_MEM_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_dss1'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_PrivateKey'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DH_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_set_default_paths'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DSA_sign'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DH_compute_key'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_add_lock'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `COMP_CTX_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_push'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_sha1'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_ctrl'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_init'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `i2d_DHparams'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_private_decrypt'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ERR_put_error'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_find'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_write'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_set_cmp_func'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_assign'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OBJ_NAME_add'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_pop'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pitem_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_ASN1_INTEGER'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_zero'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_verify_cert'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_X509_bio'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_check_private_key'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_CIPHER_CTX_cleanup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_value'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_get_depth'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_DigestInit_ex'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_new_ex_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_pop'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_copy_parameters'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_get_subject_name'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `i2d_X509_NAME'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_public_encrypt'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `i2d_X509'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `PEM_read_bio_X509'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_get0_param'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `HMAC_CTX_cleanup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_MD_CTX_init'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_set_depth'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ERR_clear_error'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_DigestUpdate'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OBJ_obj2nid'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OBJ_bsearch'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RAND_bytes'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_iterator'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSAPrivateKey_dup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_copy_next_retry'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_set'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_des_cbc'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OpenSSLDie'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_missing_parameters'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_callback_ctrl'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_PrivateKey_bio'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `DH_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_set_default'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_cleanup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BUF_MEM_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_set_trust'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_SignFinal'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_find'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_MD_CTX_copy_ex'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_read'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_certificate_type'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_INTEGER_get'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_DHparams'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_int_ctrl'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_f_buffer'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `sk_shift'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OPENSSL_cleanse'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `lh_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_free_ex_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_INTEGER_set'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_check_purpose'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ERR_peek_last_error'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `i2d_ASN1_OCTET_STRING'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_get_ex_new_index'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_verify'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BN_dup'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pqueue_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ERR_add_error_data'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_NAME_cmp'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_CipherInit_ex'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_size'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_add_digest'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_const_check_infinite_end'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_push'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_mem_ctrl'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_get_issuer_name'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `ASN1_put_object'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `OPENSSL_DIR_end'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_des_ede3_cbc'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `COMP_zlib'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BUF_MEM_grow'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `lh_insert'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_load_locations'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_NAME_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_ASN1_OCTET_STRING'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `lh_delete'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `CRYPTO_malloc'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BN_clear_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_X509_NAME'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_flags'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `d2i_X509'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `asn1_GetSequence'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RSA_size'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `RAND_pseudo_bytes'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `BIO_s_connect'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_inherit'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_PKEY_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `pitem_new'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `HMAC_Update'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_STORE_CTX_set_verify_cb'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `X509_VERIFY_PARAM_free'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `HMAC_CTX_init'
/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib/libssl.so: undefined reference to `EVP_get_digestbyname'
collect2: ld returned 1 exit status

I am block
Can anyone help me ?
Thankyou.

I think you need to link against libcrypto too.

Thank you, you are right, but I had to do some thing elese, here is the hole command line:

mipsel-linux-gcc -I/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/include -L/home/jchorro/whiterussian/openwrt/staging_dir_mipsel/usr/lib  client.c -o client  -lssl  -lcrypto

and I had to add another include

<openssl/pem.h>

And I want to remark that compiling for linux 2.6 in a pc it was only necesary de -lssl option.

Regards.

I have a similar problem - yet to be solved... I would like to do EAP-TLS authentication with pppd, for which a patch is needed: http://eaptls.spe.net/download/ppp-2.4. … -0.7.patch. I've already had success with this patch on Fedora and Ubuntu, works like a charm. smile (There's one more thing: the ssl.h in newer OpenSSL versions must also be patched like this:)

diff -urN old-openssl-0.9.8e/ssl/ssl.h openssl-0.9.8e/ssl/ssl.h
--- old-openssl-0.9.8e/ssl/ssl.h        2007-02-19 18:55:07.000000000 +0100
+++ openssl-0.9.8e/ssl/ssl.h    2008-05-12 12:06:05.000000000 +0200
@@ -191,6 +191,7 @@
 #include <openssl/kssl.h>
 #include <openssl/safestack.h>
 #include <openssl/symhacks.h>
+#include <openssl/md5.h>

 #ifdef  __cplusplus
 extern "C" {

Patching OpenSSL works fine, at least compiling doesn't end there (and without the pppd patch everything compiles fine). At pppd however, with V=99 I see the following error:

mipsel-linux-uclibc-gcc -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -DHAVE_PATHS_H -DHAVE_MMAP -I../include -DCHAPMS=1 -DMPPE=1 -DHAVE_CRYPT_H=1 -DUSE_CRYPT=1 -DPLUGIN -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I/home/neutron/OpenWRT/trunk/staging_dir/mipsel/usr/include -DINET6=1 -DMAXOCTETS -Wl,-E -o pppd main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o md5.o ccp.o ecp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o tty.o eap.o chap-md5.o eap-tls.o md4.o chap_ms.o sha1.o pppcrypt.o pcap_pcc.o ipv6cp.o eui64.o -lssl -lcurl -lcrypt -ldl /home/neutron/OpenWRT/trunk/staging_dir/mipsel/usr/lib/libpcap.a
/home/neutron/OpenWRT/trunk/staging_dir/toolchain-mipsel_gcc3.4.6/lib/gcc/mipsel-linux-uclibc/3.4.6/../../../../mipsel-linux-uclibc/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status
make[5]: *** [pppd] Error 1

So I guess compiling is fine, but linking fails... The steps I took were the following:
1. check out trunk from the svn repository
2. make package/symlinks
(2.1, 2.2, etc.: make menuconfig, build fancy new firmware for my Asus WL-500gP v1 smile)
3. copy openssl patch into trunk/package/openssl/patches/190-ssl_md5.patch
4. copy pppd patch into trunk/package/ppp/patches/320-eaptls.patch
5. make V=99

What am I doing wrong?

Regards,
Adam

The discussion might have continued from here.