posts - 570,  comments - 96,  views - 171万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

此文章并未获得最终成功,供大家参考

参考地址:https://www.cnblogs.com/orangezs/p/8453610.html

硬件:极路由1S h5661

已经刷入openwrt 21.02.1

本地openwrt sdk地址:/home/devuser/CLionProjects/openwrt-sdk-21.02.1/dl/cmake-3.9.6

编译套件地址:/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/

经过测试发现,openwrt 21.02.2 sdk不能支持c++11,只支持cmake3.9.6

下载cmake 3.9.6到本地目录/home/devuser/CLionProjects/openwrt-sdk-21.02.1/dl/并解压到

/home/devuser/CLionProjects/openwrt-sdk-21.02.1/dl/cmake-3.9.6

修改CMakeList.txt,添加以下内容:

复制代码
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_C_COMPILER "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-gcc")
SET(CMAKE_CXX_COMPILER "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-g++")
SET(CMAKE_AR "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-ar")
SET(CMAKE_LINKER "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-ld")
SET(CMAKE_RANLIB "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-ranlib")
SET(CMAKE_NM "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-nm")
SET(CMAKE_OBJDUMP "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-objdump")
SET(CMAKE_OBJCOPY "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-objcopy")
SET(CMAKE_STRIP "/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-strip")
#以下为源文件内容
cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR)
复制代码

1、使用clion通过CMakeList.txt生成Makefile或者修改~/.bashrc设置/home/devuser/CLionProjects/openwrt-sdk-21.02.1/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/到PATH路径编译

编译过程中报错;缺少opensslconf.h

解决方法:下载openssl-1.1.1m,在openssl目录执行以下命令

./config
make

2、将openssl-1.1.1m/include/openssl目录中文件全部拷贝到 cmake-3.9.6/Utilities/openssl/

3、将cmake-3.9.6/Utilities/openssl-1.1.1m/ssl/目录中文件全部拷贝到 cmake-3.9.6/Utilities/openssl/

4、第1步执行后会获得Makefile,然后执行

make

 

 再往下不懂怎么解决了。

本文章适合人群:

懂cmake,c语言开发,linux基本make命令等

 

posted on   你不知道的浪漫  阅读(728)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示