This is an archive of the discontinued LLVM Phabricator instance.

Add Z3 to system libraries list if enabled
ClosedPublic

Authored by mati865 on Aug 4 2020, 5:19 AM.

Details

Summary

Without this trying to link static LLVM libraries (built with Z3 enabled) fails because llvm-config doesn't print -lz3.
We are already using this patch at MSYS2: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-clang/0013-Add-Z3-to-system-libraries-list-if-enabled.patch

Diff Detail

Event Timeline

mati865 created this revision.Aug 4 2020, 5:19 AM
mati865 requested review of this revision.Aug 4 2020, 5:19 AM
This revision is now accepted and ready to land.Aug 23 2020, 3:25 PM
mati865 planned changes to this revision.Aug 23 2020, 4:04 PM

I'll update it soon.

llvm/lib/Support/CMakeLists.txt
207

Actually I forgot to remove ${Z3_LINK_FILES} here.

mati865 updated this revision to Diff 287348.Aug 24 2020, 5:21 AM

Updated the diff.

This revision is now accepted and ready to land.Aug 24 2020, 5:21 AM

Could you commit it for me please? I don't have write permission to the repo.

This is actually failing on another machine I have because of the lib name. This fixes it:

 -----------------------
index a571d269b39..2da2f203a28 100644
@@ -57,9 +57,7 @@ endif()
 
 # Link Z3 if the user wants to build it.
 if(LLVM_WITH_Z3)
-  set(Z3_LINK_FILES ${Z3_LIBRARIES})
-else()
-  set(Z3_LINK_FILES "")
+  set(system_libs ${system_libs} ${Z3_LIBRARIES})
 endif()
 
 add_llvm_component_library(LLVMSupport
@@ -206,7 +204,7 @@ add_llvm_component_library(LLVMSupport
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
   ${Backtrace_INCLUDE_DIRS}
-  LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES}
+  LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags}
   )
 
 set(llvm_system_libs ${system_libs})
mati865 updated this revision to Diff 287579.Aug 25 2020, 12:19 AM

Indeed, hardcoding z3 was stupid oversight from my side.

This revision was automatically updated to reflect the committed changes.