mercredi 3 juillet 2019

Linker issue for openssl while linking libPocoCrypto.so to my app while cross compiling for ARMv7

I was using poco-1.5.3 for my application running on odroid for last couple of years. I was compiling the application on my x86_64 machine using arm-linux-gnueabihf-g++ cross compiler. Cross compilation steps

1. Compiled the poco-1.5.3 code on an odroid. 
2. Copied all the libraries and header file present in the /usr/local/lib/, /usr/local/lib/include and /usr/lib/ of odroid in a directory armv7-libs. 
3. Created a tar file armv7-libs.tgz
4. Copied these libraries on my x86_64 in path /usr/local/arm_libs/libs-armhf/lib
5. Compiled my application using cross-compiler arm-linux-gnueabihf-g++ by providing compiler option -L/usr/local/arm_libs/libs-armhf/lib
6. Below is the command to compile a file. 
    1. arm-linux-gnueabihf-g++ -o tests/test_app tests/test_app.o app.o -pedantic -I/usr/local/arm_libs/libs-armhf/include -Darmhf -std=c++11 -Wall -Wno-variadic-macros -g -fPIC -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -fopenmp -O3 -Ofast -L/usr/local/arm_libs/libs-armhf/lib -lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoCrypto -ljson -lssl -lcrypto 
7. It used to be compile well. And I could runt he tests/test_app on target machine (odroid xu4)

Now we want to support arm64 as well and which is not available in poco-1.5.3. So we decided to upgrade the library from poco-1.5.3 to poco-1.8.1. I followed the same steps as above for poco-1.8.1 library. I started facing linker issue now.

    1. arm-linux-gnueabihf-g++ -o tests/test_app tests/test_app.o app.o -pedantic -I/usr/local/arm_libs/libs-armhf/include -Darmhf -std=c++11 -Wall -Wno-variadic-macros -g -fPIC -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -fopenmp -O3 -Ofast -L/usr/local/arm_libs/libs-armhf/lib -lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoCrypto -ljson -lssl -lcrypto 
    2. Below are the linker issue which I am facing. 
/usr/local/arm_libs/libs-armhf/libPocoCrypto.so: undefined reference to `X509_verify@OPENSSL_1.0.0'
/usr/local/arm_libs/libs-armhf/libPocoNetSSL.so: undefined reference to `SSL_do_handshake@OPENSSL_1.0.0'
/usr/local/arm_libs/libs-armhf/libPocoNetSSL.so: undefined reference to `TLSv1_1_server_method@OPENSSL_1.0.1'
/usr/local/arm_libs/libs-armhf/libPocoCrypto.so: undefined reference to `RSA_private_decrypt@OPENSSL_1.0.0'

I verified that the openssl libraries are present in the path /usr/local/arm_libs/libs-armhf/lib/

$ ls /usr/local/arm_libs/libs-armhf/lib/ | grep libssl*
libssl.a
libssl.so
libssl.so.1.0.0
$ ls /usr/local/arm_libs/libs-armhf/lib/ | grep libcry*
libcrypto.a
libcrypto.so
libcrypto.so.1.0.0

Request you to please let me know if I am doing some wrong. Or there is some change the way poco-1.8.1 library needs to be created.

Aucun commentaire:

Enregistrer un commentaire