How to bulid staticlly linked and stripped file?
SiameseJuly opened this issue · 1 comments
Here's what my CMakeLists.txt file looks like:
~/cb-multios/CMakeLists.txt
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z execstack -z norelro -static-libgcc -static-libstdc++")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
but it doesn't work
For static linking, you can use the build.sh
script and set the LINK
variable as follows:
LINK=STATIC ./build.sh
which sets these lines
Lines 31 to 35 in e50a030
However, after trying this, I ran into an issue where the CMake is trying to build .so
files, so I opened a PR #60 with a fix. Would you be able to test that?
As for stripped files, I am unaware of any logic or code to strip the binaries of symbols after they are built, so this might need to be scripted manually by you or even better opening a PR to be added as an option, similar to building static or dynamic libraries.