08 --> OpenWRT solves /usr/lib/liblua.so: undefined reference to `asinh' compilation error

When porting the FRR package, there is a lack of dependent library files. Adjust the compilation option and configure it to glibc mode. When compiling again, the error content is as follows

cd /home/robot/OpenWrt/LS1046A-19.07/build_dir/target-aarch64_generic_glibc/libuhttpd-nossl/libuhttpd-2.2.2/example && /home/robot/OpenWrt/LS1046A-19.07/staging_dir/host/bin/cmake -E cmake_link_script CMakeFiles/helloworld.dir/link.txt --verbose=1
/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/bin/aarch64-openwrt-linux-gnu-gcc -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/robot/OpenWrt/LS1046A-19.07/build_dir/target-aarch64_generic_glibc/libuhttpd-nossl/libuhttpd-2.2.2=libuhttpd-2.2.2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG  -L/home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/usr/lib -L/home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/lib -L/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/usr/lib -L/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/lib -znow -zrelro -rdynamic CMakeFiles/helloworld.dir/helloworld.c.o  -o helloworld ../src/libuhttpd.so.2.2.2 -lubox -ldl -llua 
/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/8.3.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/usr/lib/liblua.so: undefined reference to `sinh'
/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/8.3.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/usr/lib/liblua.so: undefined reference to `atan2'
/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/8.3.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/usr/lib/liblua.so: undefined reference to `tanh'
/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/8.3.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/usr/lib/liblua.so: undefined reference to `atanh'
/home/robot/OpenWrt/LS1046A-19.07/staging_dir/toolchain-aarch64_generic_gcc-8.3.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/8.3.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/robot/OpenWrt/LS1046A-19.07/staging_dir/target-aarch64_generic_glibc/usr/lib/liblua.so: undefined reference to `cosh'

The solution is as follows

robot@ubuntu:~/OpenWrt/LS1046A-19.07$ cd build_dir/target-aarch64_generic_glibc/libuhttpd-nossl/libuhttpd-2.2.2/example
vim CMakeLists.txt 

The additions are as follows

include_directories(${
    
    CMAKE_SOURCE_DIR}/src ${
    
    CMAKE_BINARY_DIR}/src)
add_definitions(-lm)
add_executable(helloworld helloworld.c)
target_link_libraries(helloworld uhttpd ${
    
    LIBUBOX_LIBRARY} -lm)

add_executable(template template.c)
target_link_libraries(template uhttpd ${
    
    LIBUBOX_LIBRARY} -lm)

Guess you like

Origin blog.csdn.net/weixin_38387929/article/details/112920371