Skip to content

Commit f49317a

Browse files
committed
cmake: fix highs build on alpine
see: ERGO-Code/HiGHS#3000
1 parent a350787 commit f49317a

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

cmake/dependencies/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ if(BUILD_HIGHS)
315315
GIT_TAG "v1.14.0"
316316
GIT_SHALLOW TRUE
317317
UPDATE_COMMAND git reset --hard
318+
PATCH_COMMAND git apply --ignore-whitespace
319+
"${CMAKE_CURRENT_LIST_DIR}/../../patches/highs-v1.14.0.patch"
318320
SYSTEM
319321
)
320322
set(CI OFF) # disable CI tests

patches/highs-v1.14.0.patch

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 1dc3a98f..1388c818 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -388,8 +388,14 @@ if (BUILD_CXX)
6+
"IPO / LTO: disabled by default when building a static library; "
7+
"set CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON to enable")
8+
else()
9+
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
10+
- message(STATUS "IPO / LTO: enabled")
11+
+ if(EXISTS "/etc/alpine-release")
12+
+ # LTO is known to cause issues with fortified functions on Alpine (musl)
13+
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
14+
+ message(STATUS "IPO / LTO: disabled on Alpine to avoid conflicts with fortified functions")
15+
+ else()
16+
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
17+
+ message(STATUS "IPO / LTO: enabled")
18+
+ endif()
19+
endif()
20+
if (CUPDLP_GPU AND CMAKE_INTERPROCEDURAL_OPTIMIZATION)
21+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
22+
@@ -980,4 +986,4 @@ set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "HiGHS Libraries")
23+
24+
if(NOT CPack_CMake_INCLUDED)
25+
include(CPack)
26+
-endif()
27+
\ No newline at end of file
28+
+endif()

0 commit comments

Comments
 (0)