From 92d96cbe5ddafc6ba059678575dd398cdf165e84 Mon Sep 17 00:00:00 2001 From: Alik Aslanyan Date: Thu, 25 Jul 2019 00:22:51 +0400 Subject: [PATCH] Static link glibc --- CMakeLists.txt | 4 ++-- rust/Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3238668..7c3174b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ file(GLOB_RECURSE SOURCE_FILES ${SRC_DIR}/*.h ${SRC_DIR}/*.cpp ${AMXXSDK}/sdk/*. add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ) -set(FLAGS "-m32 -O3 -mtune=generic -fvisibility=hidden -flto -fPIC") +set(FLAGS "-m32 -O3 -mtune=generic -fvisibility=hidden -flto=thin -fpic") set(PORTABLE_LINK_FLAGS "${FLAGS} -static-libgcc -static-libstdc++ -Wl,--gc-sections -Wl,--version-script=${CMAKE_SOURCE_DIR}/version_script.lds") set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${FLAGS} -fdata-sections -ffunction-sections -fpermissive") @@ -43,7 +43,7 @@ if(WIN32) set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX "_amxx_i386.dll") else() target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}-rust pthread) # TODO: Conditional dynamic linking of OpenSSL. (ssl crypto) - set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${PORTABLE_LINK_FLAGS} -fuse-ld=lld") + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${PORTABLE_LINK_FLAGS} -static -fuse-ld=lld -Wl,--allow-multiple-definition") set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX "_amxx_i386.so") endif() diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 6a18736..221499e 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["staticlib"] panic = "unwind" [profile.release] -lto = "fat" +lto = "thin" panic = "unwind" codegen-units = 1 opt-level = 3 @@ -42,4 +42,4 @@ owning_ref = "0.4.0" fnv = "1.0.6" [build-dependencies] -cbindgen = "0.9.0" \ No newline at end of file +cbindgen = "0.9.0"