准备工具链
- 使用MTK Openwrt 相应平台工具链,
不能使用buildroot的工具链,否则程序无法运行
,本文MTK7621为例 - 工具链官网下载地址
构建libev
- rtty依赖libev库,因此需要先构建libev
git clone https://github.com/enki/libev.git
cd libev~/rtty/libev (master) $ ./configure --host=mipsel-linux CC=/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc CFLAGS=-I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for mipsel-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for mipsel-linux-gcc... /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc accepts -g... yes
checking for /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc option to accept ISO C89... none needed
checking whether /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... mipsel-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc... /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/mipsel-openwrt-linux-musl/bin/ld
checking if the linker (/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/mipsel-openwrt-linux-musl/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for mipsel-linux-dumpbin... no
checking for mipsel-linux-link... no
checking for dumpbin... no
checking for link... link -dump
configure: WARNING: using cross tools not prefixed with host triplet
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to mipsel-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/mipsel-openwrt-linux-musl/bin/ld option to reload object files... -r
checking for mipsel-linux-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for mipsel-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for mipsel-linux-ar... no
checking for ar... ar
checking for archiver @FILE support... @
checking for mipsel-linux-strip... strip
checking for mipsel-linux-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc object... ok
checking for sysroot... no
checking for mipsel-linux-mt... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc supports -fno-rtti -fno-exceptions... no
checking for /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc option to produce PIC... -fPIC -DPIC
checking if /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc PIC flag -fPIC -DPIC works... yes
checking if /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc static flag -static works... yes
checking if /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc supports -c -o file.o... yes
checking if /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc supports -c -o file.o... (cached) yes
checking whether the /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc linker (/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/mipsel-openwrt-linux-musl/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking sys/inotify.h usability... yes
checking sys/inotify.h presence... yes
checking for sys/inotify.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking port.h usability... no
checking port.h presence... no
checking for port.h... no
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/eventfd.h usability... yes
checking sys/eventfd.h presence... yes
checking for sys/eventfd.h... yes
checking sys/signalfd.h usability... yes
checking sys/signalfd.h presence... yes
checking for sys/signalfd.h... yes
checking for inotify_init... yes
checking for epoll_ctl... yes
checking for kqueue... no
checking for port_create... no
checking for poll... yes
checking for select... yes
checking for eventfd... yes
checking for signalfd... yes
checking for clock_gettime... yes
checking for nanosleep... yes
checking for library containing floor... none required
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev (master) $ DESTDIR=~/rtty/libev/op make install
/bin/bash ./libtool --tag=CC --mode=compile /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -MT ev.lo -MD -MP -MF .deps/ev.Tpo -c -o ev.lo ev.c
libtool: compile: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -MT ev.lo -MD -MP -MF .deps/ev.Tpo -c ev.c -fPIC -DPIC -o .libs/ev.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
ev.c:1825:31: warning: 'ev_default_loop_ptr' initialized and declared 'extern'EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */^
libtool: compile: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -MT ev.lo -MD -MP -MF .deps/ev.Tpo -c ev.c -o ev.o >/dev/null 2>&1
mv -f .deps/ev.Tpo .deps/ev.Plo
/bin/bash ./libtool --tag=CC --mode=compile /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -MT event.lo -MD -MP -MF .deps/event.Tpo -c -o event.lo event.c
libtool: compile: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -MT event.lo -MD -MP -MF .deps/event.Tpo -c event.c -fPIC -DPIC -o .libs/event.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
libtool: compile: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -MT event.lo -MD -MP -MF .deps/event.Tpo -c event.c -o event.o >/dev/null 2>&1
mv -f .deps/event.Tpo .deps/event.Plo
/bin/bash ./libtool --tag=CC --mode=link /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -I/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include -version-info 4:0:0 -o libev.la -rpath /usr/local/lib ev.lo event.lo
libtool: link: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -shared -fPIC -DPIC .libs/ev.o .libs/event.o -Wl,-soname -Wl,libev.so.4 -o .libs/libev.so.4.0.0
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
libtool: link: (cd ".libs" && rm -f "libev.so.4" && ln -s "libev.so.4.0.0" "libev.so.4")
libtool: link: (cd ".libs" && rm -f "libev.so" && ln -s "libev.so.4.0.0" "libev.so")
libtool: link: ar cru .libs/libev.a ev.o event.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libev.a
libtool: link: ( cd ".libs" && rm -f "libev.la" && ln -s "../libev.la" "libev.la" )
make[1]: Entering directory '/home/snow/rtty/libev'/usr/bin/mkdir -p '/home/snow/rtty/libev/op/usr/local/lib'/bin/bash ./libtool --mode=install /usr/bin/install -c libev.la '/home/snow/rtty/libev/op/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libev.so.4.0.0 /home/snow/rtty/libev/op/usr/local/lib/libev.so.4.0.0
libtool: install: (cd /home/snow/rtty/libev/op/usr/local/lib && { ln -s -f libev.so.4.0.0 libev.so.4 || { rm -f libev.so.4 && ln -s libev.so.4.0.0 libev.so.4; }; })
libtool: install: (cd /home/snow/rtty/libev/op/usr/local/lib && { ln -s -f libev.so.4.0.0 libev.so || { rm -f libev.so && ln -s libev.so.4.0.0 libev.so; }; })
libtool: install: /usr/bin/install -c .libs/libev.lai /home/snow/rtty/libev/op/usr/local/lib/libev.la
libtool: install: /usr/bin/install -c .libs/libev.a /home/snow/rtty/libev/op/usr/local/lib/libev.a
libtool: install: chmod 644 /home/snow/rtty/libev/op/usr/local/lib/libev.a
libtool: install: ranlib /home/snow/rtty/libev/op/usr/local/lib/libev.a
libtool: install: warning: remember to run `libtool --finish /usr/local/lib'/usr/bin/mkdir -p '/home/snow/rtty/libev/op/usr/local/include'/usr/bin/install -c -m 644 ev.h ev++.h event.h '/home/snow/rtty/libev/op/usr/local/include'/usr/bin/mkdir -p '/home/snow/rtty/libev/op/usr/local/share/man/man3'/usr/bin/install -c -m 644 ev.3 '/home/snow/rtty/libev/op/usr/local/share/man/man3'
make[1]: Leaving directory '/home/snow/rtty/libev'
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev (master) $
~/rtty/libev/op (master) $ tree
.
├── config.log
└── usr└── local├── include│ ├── event.h│ ├── ev++.h│ └── ev.h├── lib│ ├── libev.a│ ├── libev.la│ ├── libev.so -> libev.so.4.0.0│ ├── libev.so.4 -> libev.so.4.0.0│ └── libev.so.4.0.0└── share└── man└── man3└── ev.37 directories, 10 files
~/rtty/libev/op (master) $
构建rtty
- rtty可以选择是否支持
SSL
编译
(一)生成不支持SSL
的rtty
- 由于涉及到交叉编译,在cmake选项中需要附带很多参数,每次cmake不方便,因此此处编写
toolchain.cmake
文件,将需要指定的参数放入此文件
~/test/rtty/rtty/build (master) $ cat ../toolchain.cmake
# which C and C++ compiler to use
set(CMAKE_C_COMPILER /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc)set(LIBEV_LIBRARY /home/snow/rtty/libev/op/usr/local/lib/libev.so)
set(LIBEV_INCLUDE_DIR /home/snow/rtty/libev/op/usr/local/include)~/test/rtty/rtty/build (master) $
- 注意
LIBEV_LIBRARY
设置为/home/snow/rtty/libev/op/usr/local/lib/libev.so
,否则后续cmake时报错如下:
~/test/rtty/rtty/build (master) $ cmake -DCMAKE_TOOLCHAIN_FILE=/home/snow/test/rtty/rtty/toolchain.cmake -DSSL_SUPPORT=OFF ..
-- The C compiler identification is GNU 5.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Libev: /home/snow/rtty/libev/op/usr/local/lib (found version "4.22")
-- Configuring done
WARNING: Target "rtty" requests linking to directory "/home/snow/rtty/libev/op/usr/local/lib". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/snow/test/rtty/rtty/build
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $ make
[ 9%] Building C object src/CMakeFiles/rtty.dir/command.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 18%] Building C object src/CMakeFiles/rtty.dir/file.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 27%] Building C object src/CMakeFiles/rtty.dir/filectl.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 36%] Building C object src/CMakeFiles/rtty.dir/http.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 45%] Building C object src/CMakeFiles/rtty.dir/main.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 54%] Building C object src/CMakeFiles/rtty.dir/net.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 63%] Building C object src/CMakeFiles/rtty.dir/rtty.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 72%] Building C object src/CMakeFiles/rtty.dir/utils.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 81%] Building C object src/CMakeFiles/rtty.dir/log/log.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 90%] Building C object src/CMakeFiles/rtty.dir/buffer/buffer.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[100%] Linking C executable rtty
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
CMakeFiles/rtty.dir/command.c.o: In function `task_free':
command.c:(.text+0x1a8): undefined reference to `ev_io_stop'
command.c:(.text+0x1d8): undefined reference to `ev_io_stop'
command.c:(.text+0x1f8): undefined reference to `ev_child_stop'
command.c:(.text+0x20c): undefined reference to `ev_timer_stop'
CMakeFiles/rtty.dir/command.c.o: In function `run_task':
command.c:(.text+0x46c): undefined reference to `ev_child_start'
command.c:(.text+0x4ac): undefined reference to `ev_io_start'
command.c:(.text+0x4e8): undefined reference to `ev_io_start'
command.c:(.text+0x534): undefined reference to `ev_timer_start'
CMakeFiles/rtty.dir/file.c.o: In function `detect_file_operation':
file.c:(.text+0x94c): undefined reference to `ev_io_start'
file.c:(.text+0xcdc): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/file.c.o: In function `parse_file_msg':
file.c:(.text+0x1014): undefined reference to `ev_io_start'
file.c:(.text+0x12a4): undefined reference to `ev_io_start'
file.c:(.text+0x141c): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/http.c.o: In function `on_net_write':
http.c:(.text+0x54): undefined reference to `ev_io_stop'
CMakeFiles/rtty.dir/http.c.o: In function `send_http_msg':
http.c:(.text+0x1c4): undefined reference to `ev_io_start'
http.c:(.text+0x1d0): undefined reference to `ev_now'
CMakeFiles/rtty.dir/http.c.o: In function `http_conn_free':
http.c:(.text+0x248): undefined reference to `ev_io_stop'
http.c:(.text+0x258): undefined reference to `ev_io_stop'
http.c:(.text+0x268): undefined reference to `ev_timer_stop'
CMakeFiles/rtty.dir/http.c.o: In function `on_connected':
http.c:(.text+0x340): undefined reference to `ev_io_start'
http.c:(.text+0x374): undefined reference to `ev_io_start'
http.c:(.text+0x3bc): undefined reference to `ev_timer_start'
CMakeFiles/rtty.dir/http.c.o: In function `on_timer_cb':
http.c:(.text+0x3f0): undefined reference to `ev_now'
CMakeFiles/rtty.dir/http.c.o: In function `http_request':
http.c:(.text+0x618): undefined reference to `ev_io_start'
http.c:(.text+0x690): undefined reference to `ev_now'
CMakeFiles/rtty.dir/main.c.o: In function `signal_cb':
main.c:(.text+0x18): undefined reference to `ev_break'
CMakeFiles/rtty.dir/main.c.o: In function `main':
main.c:(.text+0x108): undefined reference to `ev_default_loop'
main.c:(.text+0x464): undefined reference to `ev_signal_start'
main.c:(.text+0x484): undefined reference to `ev_run'
main.c:(.text+0x49c): undefined reference to `ev_loop_destroy'
CMakeFiles/rtty.dir/net.c.o: In function `sock_write_cb':
net.c:(.text+0x2c): undefined reference to `ev_io_stop'
net.c:(.text+0x3c): undefined reference to `ev_timer_stop'
CMakeFiles/rtty.dir/net.c.o: In function `timer_cb':
net.c:(.text+0x1d8): undefined reference to `ev_io_stop'
CMakeFiles/rtty.dir/net.c.o: In function `tcp_connect_sockaddr':
net.c:(.text+0x3a8): undefined reference to `ev_timer_start'
net.c:(.text+0x3dc): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/rtty.c.o: In function `del_tty':
rtty.c:(.text+0x2c): undefined reference to `ev_io_stop'
rtty.c:(.text+0x3c): undefined reference to `ev_io_stop'
rtty.c:(.text+0x4c): undefined reference to `ev_timer_stop'
rtty.c:(.text+0x5c): undefined reference to `ev_child_stop'
CMakeFiles/rtty.dir/rtty.c.o: In function `tty_timer_cb':
rtty.c:(.text+0x244): undefined reference to `ev_now'
rtty.c:(.text+0x28c): undefined reference to `ev_timer_stop'
CMakeFiles/rtty.dir/rtty.c.o: In function `pty_on_write':
rtty.c:(.text+0x3ac): undefined reference to `ev_io_stop'
CMakeFiles/rtty.dir/rtty.c.o: In function `pty_on_exit':
rtty.c:(.text+0x50c): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/rtty.c.o: In function `on_net_connected':
rtty.c:(.text+0x574): undefined reference to `ev_break'
rtty.c:(.text+0x5f0): undefined reference to `ev_io_start'
rtty.c:(.text+0x800): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/rtty.c.o: In function `pty_on_read':
rtty.c:(.text+0x850): undefined reference to `ev_now'
rtty.c:(.text+0x96c): undefined reference to `ev_io_stop'
rtty.c:(.text+0xac4): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/rtty.c.o: In function `rtty_exit':
rtty.c:(.text+0xb1c): undefined reference to `ev_io_stop'
rtty.c:(.text+0xb2c): undefined reference to `ev_io_stop'
rtty.c:(.text+0xbc4): undefined reference to `ev_break'
CMakeFiles/rtty.dir/rtty.c.o: In function `on_net_write':
rtty.c:(.text+0xc9c): undefined reference to `ev_io_stop'
CMakeFiles/rtty.dir/rtty.c.o: In function `on_net_read':
rtty.c:(.text+0xd9c): undefined reference to `ev_now'
rtty.c:(.text+0x13ec): undefined reference to `ev_io_start'
rtty.c:(.text+0x1448): undefined reference to `ev_child_start'
rtty.c:(.text+0x1484): undefined reference to `ev_timer_start'
rtty.c:(.text+0x1504): undefined reference to `ev_io_start'
rtty.c:(.text+0x1534): undefined reference to `ev_now'
rtty.c:(.text+0x158c): undefined reference to `ev_io_start'
rtty.c:(.text+0x16e8): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/rtty.c.o: In function `rtty_timer_cb':
rtty.c:(.text+0x1808): undefined reference to `ev_now'
rtty.c:(.text+0x1af4): undefined reference to `ev_io_start'
CMakeFiles/rtty.dir/rtty.c.o: In function `rtty_start':
rtty.c:(.text+0x1c5c): undefined reference to `ev_timer_start'
rtty.c:(.text+0x1cb4): undefined reference to `ev_now'
CMakeFiles/rtty.dir/rtty.c.o: In function `rtty_send_msg':
rtty.c:(.text+0x1db8): undefined reference to `ev_io_start'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/rtty.dir/build.make:241: src/rtty] Error 1
make[1]: *** [CMakeFiles/Makefile2:115: src/CMakeFiles/rtty.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
- 根本原因如下:
target_link_libraries
需要指定具体的库名称,否则无法链接
~/test/rtty/rtty (master) $ grep -nwr "LIBEV_LIBRARY"
src/CMakeLists.txt:17:target_link_libraries(rtty PRIVATE ${LIBEV_LIBRARY} util crypt m)
- 如需要静态库方式链接
libev
,则将toolchain.cmake
修改如下:
~/test/rtty/rtty/build (master) $ cat ../toolchain.cmake
# which C and C++ compiler to use
set(CMAKE_C_COMPILER /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc)set(LIBEV_LIBRARY /home/snow/rtty/libev/op/usr/local/lib/libev.a)
set(LIBEV_INCLUDE_DIR /home/snow/rtty/libev/op/usr/local/include)~/test/rtty/rtty/build (master) $
工程编译,也可以直接通过-D
方式定义变量,无需toolchain.cmake
如,上述编译之类修改为:
~/test/rtty/rtty/build (master) $ cmake .. -DCMAKE_C_COMPILER=/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -DLIBEV_LIBRARY=/home/snow/rtty/libev/op/usr/local/lib/libev.a -DLIBEV_INCLUDE_DIR=/home/snow/rtty/libev/op/usr/local/include -DSSL_SUPPORT=OFF ..
-- The C compiler identification is GNU 5.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Libev: /home/snow/rtty/libev/op/usr/local/lib/libev.a (found version "4.22")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/snow/test/rtty/rtty/build
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $ make
[ 9%] Building C object src/CMakeFiles/rtty.dir/command.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 18%] Building C object src/CMakeFiles/rtty.dir/file.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 27%] Building C object src/CMakeFiles/rtty.dir/filectl.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 36%] Building C object src/CMakeFiles/rtty.dir/http.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 45%] Building C object src/CMakeFiles/rtty.dir/main.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 54%] Building C object src/CMakeFiles/rtty.dir/net.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 63%] Building C object src/CMakeFiles/rtty.dir/rtty.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined[ 72%] Building C object src/CMakeFiles/rtty.dir/utils.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 81%] Building C object src/CMakeFiles/rtty.dir/log/log.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[ 90%] Building C object src/CMakeFiles/rtty.dir/buffer/buffer.c.o
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[100%] Linking C executable rtty
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
[100%] Built target rtty
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $ ls src/rtty -alh
-rwxrwxr-x 1 snow snow 129K 6月 2 19:41 src/rtty
~/test/rtty/rtty/build (master) $
~/test/rtty/rtty/build (master) $
(二)支持SSL
的rtty
构建libssl
- rtty支持
openssl, mbedtls, CyaSSl(wolfssl)
,本文以openssl为例,构建libssl
库
~/rtty/openssl/openssl (master) $ ./config linux-mips32 no-asm no-async shared --prefix=/home/snow/rtty/openssl/openssl/build --cross-compile-prefix=/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-
- 注意点:
(1)使用绝对路径,否则报错
~/rtty/openssl/openssl (master) $ ./config no-asm no-async shared --prefix=~/rtty/openssl/openssl/build --cross-compile-prefix=~/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-Failure! build file wasn't produced.
Please read INSTALL.md and associated NOTES-* files. You may also have to
look over your available compiler tool chain or change your configuration.Directory given with --prefix MUST be absolute
~/rtty/openssl/openssl (master) $
~/rtty/openssl/openssl (master) $
(2)顶层Makefile
去除m64
选项
~/rtty/openssl/openssl (master) $ ./config no-asm no-async shared --prefix=/home/snow/rtty/openssl/openssl/build --cross-compile-prefix=/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-
Configuring OpenSSL version 3.2.0-dev for target linux-x86_64
Using os-specific seed configurationCreated configdata.pm
Running configdata.pm
Created Makefile.in
Created Makefile
Created include/openssl/configuration.h**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL.md file first) ***
*** ***
**********************************************************************
~/rtty/openssl/openssl (master) $
~/rtty/openssl/openssl (master) $
~/rtty/openssl/openssl (master) $ make install
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/asn1.h.in > include/openssl/asn1.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/asn1t.h.in > include/openssl/asn1t.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/bio.h.in > include/openssl/bio.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/cmp.h.in > include/openssl/cmp.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/cms.h.in > include/openssl/cms.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/conf.h.in > include/openssl/conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/crmf.h.in > include/openssl/crmf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/crypto.h.in > include/openssl/crypto.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ct.h.in > include/openssl/ct.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/err.h.in > include/openssl/err.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ess.h.in > include/openssl/ess.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/fipskey.h.in > include/openssl/fipskey.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/lhash.h.in > include/openssl/lhash.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ocsp.h.in > include/openssl/ocsp.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/opensslv.h.in > include/openssl/opensslv.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/pkcs12.h.in > include/openssl/pkcs12.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/pkcs7.h.in > include/openssl/pkcs7.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/safestack.h.in > include/openssl/safestack.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/srp.h.in > include/openssl/srp.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ssl.h.in > include/openssl/ssl.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ui.h.in > include/openssl/ui.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/x509.h.in > include/openssl/x509.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/x509_vfy.h.in > include/openssl/x509_vfy.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/x509v3.h.in > include/openssl/x509v3.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" test/provider_internal_test.cnf.in > test/provider_internal_test.cnf
make depend && make _build_libs
make[1]: Entering directory '/home/snow/rtty/openssl/openssl'
make[1]: Leaving directory '/home/snow/rtty/openssl/openssl'
make[1]: Entering directory '/home/snow/rtty/openssl/openssl'
/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -I. -Iinclude -Iapps/include -fPIC -pthread -m64 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/home/snow/rtty/openssl/openssl/build/ssl\"" -DENGINESDIR="\"/home/snow/rtty/openssl/openssl/build/lib64/engines-3\"" -DMODULESDIR="\"/home/snow/rtty/openssl/openssl/build/lib64/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_libctx.o apps/lib/app_libctx.c
mipsel-openwrt-linux-musl-gcc.bin: error: unrecognized command line option '-m64'
make[1]: *** [Makefile:3243: apps/lib/libapps-lib-app_libctx.o] Error 1
make[1]: Leaving directory '/home/snow/rtty/openssl/openssl'
make: *** [Makefile:1599: build_libs] Error 2
~/rtty/openssl/openssl (master) $
~/rtty/openssl/openssl (master) $
(3)需要指定编译平台类型 linux-mips32
~/rtty/openssl/openssl (master) $ make install
make depend && make _build_libs
make[1]: Entering directory '/home/snow/rtty/openssl/openssl'
make[1]: Leaving directory '/home/snow/rtty/openssl/openssl'
make[1]: Entering directory '/home/snow/rtty/openssl/openssl'
/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc -I. -Iinclude -Iapps/include -fPIC -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/home/snow/rtty/openssl/openssl/build/ssl\"" -DENGINESDIR="\"/home/snow/rtty/openssl/openssl/build/lib64/engines-3\"" -DMODULESDIR="\"/home/snow/rtty/openssl/openssl/build/lib64/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_libctx.o apps/lib/app_libctx.c
mipsel-openwrt-linux-musl-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
In file included from include/internal/sockets.h:117:0,from apps/include/apps.h:16,from apps/lib/app_libctx.c:10:
/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]#warning redirecting incorrect #include <sys/poll.h> to <poll.h>...............
crypto/bn/bn_dh.c:1001:5: note: in expansion of macro 'BN_DEF'BN_DEF(0x515DA54D, 0xD6FC2A2C), BN_DEF(0xFFFFFFFF, 0x7FFFFFFF),^
crypto/bn/bn_dh.c:17:26: note: (near initialization for 'ffdhe8192_q[126]')# define BN_DEF(lo, hi) (BN_ULONG)hi << 32 | lo^
crypto/bn/bn_dh.c:1001:5: note: in expansion of macro 'BN_DEF'BN_DEF(0x515DA54D, 0xD6FC2A2C), BN_DEF(0xFFFFFFFF, 0x7FFFFFFF),^
crypto/bn/bn_dh.c:17:39: warning: left shift count >= width of type [-Wshift-count-overflow]# define BN_DEF(lo, hi) (BN_ULONG)hi << 32 | lo^
crypto/bn/bn_dh.c:1001:38: note: in expansion of macro 'BN_DEF'BN_DEF(0x515DA54D, 0xD6FC2A2C), BN_DEF(0xFFFFFFFF, 0x7FFFFFFF),^
crypto/bn/bn_dh.c:17:26: error: initializer element is not constant# define BN_DEF(lo, hi) (BN_ULONG)hi << 32 | lo^
crypto/bn/bn_dh.c:1001:38: note: in expansion of macro 'BN_DEF'BN_DEF(0x515DA54D, 0xD6FC2A2C), BN_DEF(0xFFFFFFFF, 0x7FFFFFFF),^
crypto/bn/bn_dh.c:17:26: note: (near initialization for 'ffdhe8192_q[127]')# define BN_DEF(lo, hi) (BN_ULONG)hi << 32 | lo^
crypto/bn/bn_dh.c:1001:38: note: in expansion of macro 'BN_DEF'BN_DEF(0x515DA54D, 0xD6FC2A2C), BN_DEF(0xFFFFFFFF, 0x7FFFFFFF),^
make[1]: *** [Makefile:7448: crypto/bn/libcrypto-lib-bn_dh.o] Error 1
make[1]: Leaving directory '/home/snow/rtty/openssl/openssl'
make: *** [Makefile:1599: build_libs] Error 2
~/rtty/openssl/openssl (master) $
指定target类型为linux-mips32
~/rtty/openssl/openssl (master) $ ./config linux-mips32 no-asm no-async shared --prefix=/home/snow/rtty/openssl/openssl/build --cross-compile-prefix=/home/snow/toolchain/OpenWrt-Toolchain-ramips-mt7621_gcc-5.3.0_musl-1.1.16.Linux-x86_64/toolchain-mipsel_1004kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mipsel-openwrt-linux-
Configuring OpenSSL version 3.2.0-dev for target linux-mips32
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created Makefile.in
Created Makefile
Created include/openssl/configuration.h**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL.md file first) ***
*** ***
**********************************************************************
~/rtty/openssl/openssl (master) $
~/rtty/openssl/openssl (master) $
- 最后执行
make install
即可生成libssl
相关库
~/rtty/openssl/openssl (master) $ ls build/bin build/lib
build/bin:
c_rehash opensslbuild/lib:
engines-3 libcrypto.a libcrypto.so libcrypto.so.3 libssl.a libssl.so libssl.so.3 ossl-modules pkgconfig
~/rtty/openssl/openssl (master) $