Nov 05
使用 Tomato 固件,先下载 tomatoware:
CMake:
./bootstrap --prefix=/mmc && make && make install
libsodium:
./configure --prefix=/mmc && make && make install
然后静态编译 DNSProxy" title="Pcap_DNSProxy GITHUB" rel="external">Pcap_DNSProxy ,需要修改下源码的 /Pcap_DNSProxy/Source/Pcap_DNSProxy/CMakeLists.txt 文件:
Executable file name
#static
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(BUILD_SHARED_LIBRARIES OFF)
SET(CMAKE_EXE_LINKER_FLAGS "-static -pthread -Wl,--whole-archive
-lpthread -Wl,--no-whole-archive")
#static
add_executable(Pcap_DNSProxy ${MAIN_SRC_FILES})
IF(PLATFORM_OPENWRT)
INSTALL(TARGETS Pcap_DNSProxy RUNTIME DESTINATION sbin)
ENDIF(PLATFORM_OPENWRT)
注意:单独使用 -static 编译出来的文件执行会出错,要结合后面那堆参数:
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
当然还是希望作者加一个静态编译的开关选项。
已提交,作者已添加:
* 使用 ./Linux_Build.sh 执行编译程序
* 添加参数 --enable-static 即 ./Linux_Build.sh --enable-static 可启用静态编译