Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about build error #676

Closed
coach-bin opened this issue Jun 20, 2023 · 5 comments
Closed

Question about build error #676

coach-bin opened this issue Jun 20, 2023 · 5 comments

Comments

@coach-bin
Copy link

coach-bin commented Jun 20, 2023

I'm using 3.21.0.
Building xtest, I got the error message below.
optee_test/host/xtest/regression_1000.c:10:10: fatal error: openssl/bn.h: No such file or directory

Should it be able to find the header file from optee_test/host/openssl/include/openssl? What should I need to check more?

I have CMakeLists.txt and the directories like below:
{root}
└ optee_os
└ optee_client
└ optee_test
└ CMakeLists.txt

CMakeLists.txt contains two lines below:
add_subdirectory (optee_client)
add_subdirectory (optee_test)

And I ran the commands below from {root} :
cmake -D OPTEE_TEST_SDK=$PWD/../optee_os/out/plat-xxx/export-ta_arm64 -D CMAKE_INSTALL_PREFIX= -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=y -D CMAKE_TOOLCHAIN_FILE=toolchain.arm.cmake
make

toolchain.arm.cmake has :
SET(CMAKE_SYSTEM_NAME "Linux")
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
get_filename_component(COMPILER_PATH "../../../xxx/aarch64-linux-gnu/bin/aarch64-linux-gnu-" ABSOLUTE)
SET(CMAKE_C_COMPILER ${COMPILER_PATH}gcc)
SET(CMAKE_CXX_COMPILER ${COMPILER_PATH}g++)
SET(CMAKE_LINKER ${COMPILER_PATH}ld)
SET(CMAKE_NM ${COMPILER_PATH}nm)
SET(CMAKE_OBJCOPY ${COMPILER_PATH}objcopy)
SET(CMAKE_OBJDUMP ${COMPILER_PATH}objdump)
SET(CMAKE_RANLIB ${COMPILER_PATH}ranlib)

@jforissier
Copy link
Contributor

OpenSSL is in optee_test/host.openssl/{include,lib/{arm,aarch64}}. You probably need to add something to the build flags for xtest. In the OP-TEE dev environment (https://optee.readthedocs.io/en/latest/building/devices/qemu.html?#qemu-v8) we rely on Buildroot for providing OpenSSL.

@coach-bin
Copy link
Author

Thanks!

@coach-bin
Copy link
Author

@jforissier
From the code below, xtest CMakeLists.txt is trying to find openssl package from host machine.

find_package(OpenSSL)
if(OPENSSL_FOUND)
add_compile_options(-DOPENSSL_FOUND=1)
set (OPENSSL_PRIVATE_LINK OpenSSL::Crypto)
endif()

And I think that it finally leads to link failure (see error message below). Do I need to update libssl-dev for arm64?(I'm using ubuntu20.04) or is there another way to build?
aarch64-linux-gnu/bin/ld: /usr/lib/x86_64-linux-gnu/libcrypto.so: error adding symbols: file in wrong format

@jforissier
Copy link
Contributor

is there another way to build

In addition to CMakeLists.txt there is a Makefile in the top level of the project. It might be better suited to what you are trying to accomplish.
However I recommend you follow the instructions in the document I linked above. It will build the full stack using cross compilation and the Buildroot environment.

@coach-bin
Copy link
Author

@jforissier Thanks, I succeeded to build optee_test with Makefile. I ported optee to our own platform, so I'm not using build(of OPTEE repo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants