Skip to content

Commit bcabaca

Browse files
committed
Fix Linux MKL build 3
1 parent 4403a6f commit bcabaca

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ jobs:
146146
- name: Build with CMake
147147
run: |
148148
source /opt/intel/oneapi/setvars.sh
149-
cmake dynadjust -DUSE_MKL=ON -DBUILD_TESTING=OFF -DUSE_UNITY_BUILD=ON
149+
cmake dynadjust -DUSE_MKL=ON -DBUILD_TESTING=OFF -DUSE_UNITY_BUILD=ON \
150+
-DCMAKE_CXX_FLAGS="-UMKL_ILP64" -DCMAKE_C_FLAGS="-UMKL_ILP64"
150151
make -j2
151152
ls -la bin/
152153

dynadjust/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,17 @@ else()
348348
# Use Intel MKL's native CMake config
349349
add_compile_options("-DUSE_MKL")
350350

351+
# Explicitly control the MKL interface at compile time
352+
if(NOT ILP64)
353+
# Undefine MKL_ILP64 to prevent OneAPI environment from forcing ILP64
354+
# Use CMAKE_CXX_FLAGS to ensure this is applied early
355+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -UMKL_ILP64")
356+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -UMKL_ILP64")
357+
message(STATUS "LP64 interface selected: added -UMKL_ILP64 to compiler flags")
358+
else()
359+
message(STATUS "ILP64 interface selected")
360+
endif()
361+
351362
# Use FindBLAS to locate Intel MKL with explicit interface selection
352363
# Note: MKLConfig.cmake in OneAPI 2025.x has issues with interface selection,
353364
# so we use FindBLAS which allows explicit LP64/ILP64 selection via BLA_VENDOR

0 commit comments

Comments
 (0)