Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Fix building on Haiku and Solaris after c0d5d36dda04cdd409aabc015da0beb810842fcd #78084

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

brad0
Copy link
Contributor

@brad0 brad0 commented Jan 14, 2024

Haiku and Solaris need some additional libraries after the commit c0d5d36

Otherwise fails to link a whole bunch of the tools and other binaries with undefined symbols with accept() and connect().

I did a static and dynamic build on illumos and a dynamic build on Haiku.

-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;mlir'

and on illumos

-DLLVM_ENABLE_RUNTIMES='openmp'

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 14, 2024

@llvm/pr-subscribers-llvm-support

Author: Brad Smith (brad0)

Changes

Haiku and Solaris need some additional libraries after the commit c0d5d36


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

3 Files Affected:

  • (modified) llvm/lib/Support/CMakeLists.txt (+2-2)
  • (modified) llvm/tools/llvm-jitlink/CMakeLists.txt (-8)
  • (modified) llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt (-8)
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 2433730b528802..e19223fdef4f17 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -65,14 +65,14 @@ elseif( CMAKE_HOST_UNIX )
     set(system_libs ${system_libs} m)
   endif()
   if( UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
-    set(system_libs ${system_libs} kstat)
+    set(system_libs ${system_libs} kstat socket)
   endif()
   if( FUCHSIA )
     set(system_libs ${system_libs} zircon)
   endif()
   if ( HAIKU )
     add_compile_definitions(_BSD_SOURCE)
-    set(system_libs ${system_libs} bsd)
+    set(system_libs ${system_libs} bsd network)
   endif()
 endif( MSVC OR MINGW )
 
diff --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index 1480be3f03c6d7..120c8b47c8fb73 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -28,12 +28,4 @@ add_llvm_tool(llvm-jitlink
   llvm-jitlink-statistics.cpp
   )
 
-if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
-  target_link_libraries(llvm-jitlink PRIVATE network)
-endif()
-
-if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-  target_link_libraries(llvm-jitlink PRIVATE socket nsl)
-endif()
-
 export_executable_symbols(llvm-jitlink)
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
index 7e4570c13d81f7..f6d882d1a8f06f 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
@@ -11,12 +11,4 @@ add_llvm_utility(llvm-jitlink-executor
   intrinsics_gen
 )
 
-if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
-  target_link_libraries(llvm-jitlink-executor PRIVATE network)
-endif()
-
-if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-  target_link_libraries(llvm-jitlink-executor PRIVATE socket)
-endif()
-
 export_executable_symbols(llvm-jitlink-executor)

@brad0 brad0 added platform:solaris platform:haiku cmake Build system in general and CMake in particular labels Jan 14, 2024
Haiku and Solaris need some additional libraries after the commit c0d5d36
@brad0 brad0 merged commit 2e0a105 into llvm:main Jan 15, 2024
4 checks passed
@brad0 brad0 deleted the llvm_support_CMake branch January 15, 2024 01:23
@rorth
Copy link
Collaborator

rorth commented Jan 15, 2024

Haiku and Solaris need some additional libraries after the commit c0d5d36

Otherwise fails to link a whole bunch of the tools and other binaries with undefined symbols with accept() and connect().

That's not true on Solaris 11.4, the only Solaris version supported in LLVM. After 11.3, libsocket and libnsl have been folded into libc. While those two have been left in place as filters on libc for compatibility's sake, it's better not to link unnecessary libraries.

justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
Haiku and Solaris need some additional libraries after the commit
c0d5d36

Otherwise fails to link a whole bunch of the tools and other binaries
with undefined symbols with accept() and connect().

I did a static and dynamic build on illumos and a dynamic build on
Haiku.

```
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;mlir'
```
and on illumos
```
-DLLVM_ENABLE_RUNTIMES='openmp'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular llvm:support platform:haiku platform:solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants