Skip to content

Conversation

@matthias-springer
Copy link
Member

Fix build after #167848.

@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2025

@llvm/pr-subscribers-mlir

Author: Matthias Springer (matthias-springer)

Changes

Fix build after #167848.


Full diff: https://github.com/llvm/llvm-project/pull/167855.diff

1 Files Affected:

  • (modified) mlir/lib/ExecutionEngine/CMakeLists.txt (+10)
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index c813a431270d0..90024b1c8206e 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -205,6 +205,11 @@ if(LLVM_ENABLE_PIC)
   set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 17)
   target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)
 
+  # Conditionally link apfloat wrappers only on Linux.
+  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    target_link_libraries(mlir_c_runner_utils PUBLIC mlir_apfloat_wrappers)
+  endif()
+
   add_mlir_library(mlir_runner_utils
     SHARED
     RunnerUtils.cpp
@@ -216,6 +221,11 @@ if(LLVM_ENABLE_PIC)
   )
   target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)
 
+    # Conditionally link apfloat wrappers only on Linux.
+  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    target_link_libraries(mlir_runner_utils PUBLIC mlir_apfloat_wrappers)
+  endif()
+
   add_mlir_library(mlir_async_runtime
     SHARED
     AsyncRuntime.cpp

@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2025

@llvm/pr-subscribers-mlir-execution-engine

Author: Matthias Springer (matthias-springer)

Changes

Fix build after #167848.


Full diff: https://github.com/llvm/llvm-project/pull/167855.diff

1 Files Affected:

  • (modified) mlir/lib/ExecutionEngine/CMakeLists.txt (+10)
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index c813a431270d0..90024b1c8206e 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -205,6 +205,11 @@ if(LLVM_ENABLE_PIC)
   set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 17)
   target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)
 
+  # Conditionally link apfloat wrappers only on Linux.
+  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    target_link_libraries(mlir_c_runner_utils PUBLIC mlir_apfloat_wrappers)
+  endif()
+
   add_mlir_library(mlir_runner_utils
     SHARED
     RunnerUtils.cpp
@@ -216,6 +221,11 @@ if(LLVM_ENABLE_PIC)
   )
   target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)
 
+    # Conditionally link apfloat wrappers only on Linux.
+  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    target_link_libraries(mlir_runner_utils PUBLIC mlir_apfloat_wrappers)
+  endif()
+
   add_mlir_library(mlir_async_runtime
     SHARED
     AsyncRuntime.cpp

@matthias-springer matthias-springer merged commit 7e5155a into main Nov 13, 2025
8 of 12 checks passed
@matthias-springer matthias-springer deleted the users/matthias-springer/fix_build2 branch November 13, 2025 09:58
@joker-eph
Copy link
Collaborator

Why is this conditional? Can you add some more description to the comment before the guards?

@matthias-springer
Copy link
Member Author

matthias-springer commented Nov 13, 2025

This should have been part of this PR which has the comment a few lines above: https://github.com/llvm/llvm-project/pull/167848/files#diff-59f728a05a7cfa4ed1fcb3e644268db28754a743adc28427119b2372e15327feR172

This is basically copied from the CMake setup of C bindings:

  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    target_link_options(MLIR-C PRIVATE "-Wl,-exclude-libs,ALL")
  else()
    if(NOT CMAKE_C_VISIBILITY_PRESET STREQUAL "hidden" OR NOT CMAKE_CXX_VISIBILITY_PRESET STREQUAL "hidden")
      message(STATUS "MLIR-C on this platform exports all symbols. Recommend building with CMAKE_(C|CXX)_VISIBILITY_PRESET=hidden or implement filtering support.")
    endif()
  endif()

In both cases, C bindings and ApFloatWrappers.cpp, we want to hide symbols. Unfortunately, the exact mechanism to do this is different on Linux, Mac, Windows. We have to find a better way to do this.

@joker-eph
Copy link
Collaborator

I'm not sure I would put the bindings and a runtime library on the same footing though: the consequences don't seem to be the same: the bindings affect the compiler while the runtime library affect the executable!

@matthias-springer
Copy link
Member Author

It's a bit of a mess tbh. Same pattern here:

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

What I haven't figured out yet: how come mlir_async_runtime doesn't have to be linked with mlir_runner_utils?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants