一、交叉编译openssl
Ubuntu20.04 交叉编译openssl 1.0.1f_编译前去除 makefile 中所有的"-m64"字段_qq76211822的博客-CSDN博客文章浏览阅读319次。Ubuntu20.04 交叉编译openssl_编译前去除 makefile 中所有的"-m64"字段https://blog.csdn.net/sz76211822/article/details/127815993?spm=1001.2014.3001.5501
二、交叉编译curl
三、修改CMakeLists.txt
set(CMAKE_HOST_UNIX true)
set(CURL_INCLUDE_DIR /opt/huishi-rv1106/thirdpty/libcurl/include)
set(CURL_LIBRARY /opt/huishi-rv1106/thirdpty/libcurl/lib)
set(OPENSSL_INCLUDE_DIR /opt/huishi-rv1106/thirdpty/openssl/include)
set(OPENSSL_CRYPTO_LIBRARY /opt/huishi-rv1106/thirdpty/openssl/lib)
set(OPENSSL_SSL_LIBRARY /opt/huishi-rv1106/thirdpty/openssl/lib)
然后设置编译选项
四、修改sdk文件夹中的CMakeLists.txt
主要是编译时提示找不到openssl目录,故添加
target_include_directories(${PROJECT_NAME}${STATIC_LIB_SUFFIX}
PRIVATE "/opt/huishi-rv1106/thirdpty/openssl/include")
五、编译
cmake \
-DCMAKE_AR=/opt/env_toolchain_0331/env/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-ar \
-DCMAKE_CXX_COMPILER=/opt/env_toolchain_0331/env/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-g++ \
-DCMAKE_C_COMPILER=/opt/env_toolchain_0331/env/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc \
..
六、输入指令make
说明:
错误:Error running link command: No such file or directory
解决办法:增加set(CMAKE_AR $(TOOLS_DIR)/build/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-ar CACHE FILEPATH "Archiver")。因在cmake 时指定了交叉编译器路径,故在外面指定CMAKE_AR
原因:查看编译的中间文件link.txt,发现是链接静态库的ar工具未设置成功(CMAKE_AR-NOTFOUND)