Mercurial > trustbridge
changeset 1142:148014db2f3b static-libc
(issue126) Commit WIP on static linking libc
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 18 Sep 2014 10:29:38 +0200 |
parents | e82c440c2727 |
children | |
files | CMakeLists.txt INSTALL cinst/CMakeLists.txt |
diffstat | 3 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Wed Sep 17 16:23:33 2014 +0200 +++ b/CMakeLists.txt Thu Sep 18 10:29:38 2014 +0200 @@ -86,7 +86,7 @@ set(WARN_HARDENING_FLAGS " -Wextra -Wconversion -Wformat-security") # Hardening flags -set(HARDENING_FLAGS " -Wall -fstack-protector-all -fno-exceptions") +set(HARDENING_FLAGS " -fPIC -Wall -fstack-protector-all -fno-exceptions") set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector") set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4") set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0") @@ -103,8 +103,9 @@ endif(WIN32) if(UNIX) - set(HARDENING_FLAGS " ${HARDENING_FLAGS} -pie -fPIE -ftrapv") + set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Bdynamic -ftrapv") set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,-z,relro,-z,now") + set(EXTRA_STATIC_FLAGS " -Wl,--undefined=__pthread_unwind -static -static-libstdc++ -static-libgcc") elseif(WIN32) set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat") endif()
--- a/INSTALL Wed Sep 17 16:23:33 2014 +0200 +++ b/INSTALL Thu Sep 18 10:29:38 2014 +0200 @@ -12,6 +12,8 @@ ( qtbase/src/plugins/platforms/xcb/README ). Polarssl needs cmake and build-essentials. +The following documentation uses the variable YOURPREFIX as placeholder for your environment prefix + export YOURPREFIX=<Prefix of your choice (default /usr)> export PATH=$YOURPREFIX/bin:$PATH @@ -90,6 +92,7 @@ --without-zlib make && make install + To compile the software you can use plain cmake. An out of source build is highly suggested. For build options see CMakeList.txt @@ -99,7 +102,6 @@ cd build-linux cmake .. -DCMAKE_PREFIX_PATH=$YOURPREFIX - I386 ==== Install dependencies (list might be incomplete)
--- a/cinst/CMakeLists.txt Wed Sep 17 16:23:33 2014 +0200 +++ b/cinst/CMakeLists.txt Thu Sep 18 10:29:38 2014 +0200 @@ -11,6 +11,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common) +set(CMAKE_CXX_FLAGS "${EXTRA_STATIC_FLAGS}") + set(CINST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/windowsstore.c ${CMAKE_CURRENT_SOURCE_DIR}/nssstore_linux.c @@ -23,11 +25,20 @@ set(WIN_EXTRA_LIBS -lcrypt32 -luserenv -lshell32) endif(WIN32) +#if(EXISTS "${CMAKE_PREFIX_PATH}/lib/libc.a") +# message(status "Linking against static libc: ${CMAKE_PREFIX_PATH}/lib/libc.a") +# set (LIBC_STATIC "${CMAKE_PREFIX_PATH}/lib/libc.a" "${CMAKE_PREFIX_PATH}/lib/libpthread.a") +#endif() + +message(fatal "cmake prefix ${CMAKE_PREFIX_PATH}") target_link_libraries(cinst trustbridge_common ${PROFILING_LIBS} ${POLARSSL_LIBRARIES} - ${WIN_EXTRA_LIBS}) + ${WIN_EXTRA_LIBS} + ${LIBC_STATIC} + pthread + ) install(TARGETS cinst DESTINATION bin) if (WIN32)