静态编译zsummerX
下载
https://github.com/zsummer/zsummerX
下载
http://ftp.gnu.org/gnu/glibc/
../configure --prefix=/home/summer/dependlibs/glibc_static/ --enable-shared=no --disable-build-nscd --disable-nscd
add_definitions(-DGLIBC_INCLUDEDIR=/home/summer/dependlibs/glibc_static/include -DGLIBC_LIBRARYDIR=/home/summer/dependlibs/glibc_static/lib)
set(GLIBC_FLAG "-static -static-libgcc -static-libstdc++ -Bstatic")
set_target_properties (${PROJECT_NAME}_select${LIB_SUFFIX} PROPERTIES LINK_FLAGS "${GLIBC_FLAG}")
set_target_properties (${PROJECT_NAME}${LIB_SUFFIX} PROPERTIES LINK_FLAGS "${GLIBC_FLAG}")
静态选项中有-Wl, -Bstatic -Wl,-Bdynamic, -Wl,--no-export-dynamic
根据顺序可以切换使用
https://bugzilla.redhat.com/show_bug.cgi?id=642999
----------------------------------
breeze静态化
set(GLIBC_FLAG "-v -static-libgcc -static-libstdc++ -Wl,--no-export-dynamic")
set(GLIBC_INCLUDE "/home/summer/dependlibs/glibc_static/include")
set(GLIBC_LIB "/home/summer/dependlibs/glibc_static/lib")
add_definitions(-DGLIBC_INCLUDEDIR=${GLIBC_INCLUDE} -DGLIBC_LIBRARYDIR=${GLIBC_LIB})
include_directories(${GLIBC_INCLUDE} )
link_directories(${GLIBC_LIB})
set_target_properties (${BINNAME} PROPERTIES LINK_FLAGS "${GLIBC_FLAG}")