-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Wrong libLLVM symbolic links generated for 18.1 #84637
Comments
What should the symlinks look like? Also, in my builds libLLVM.so is a symlink to libLLVM.so.18.1, I'm not sure why you are seeing libLLVM.so as a regular file. |
This is what they look like for the current LLVM 17 package that we distribute, built with the exact set of CMake build flags I linked above:
What do you see after building LLVM 18 with the shared library? |
|
In our builds on conda-forge, #82647 (resp. 4cc7a75) only fixed the linux side, but on OSX the result is still:
(this is in a setting where the unversioned |
@h-vetinari Can you post the output of |
@tstellar, I assume the What build flags do you pass in to CMake when building LLVM? I've linked our LLVM-specific flags above and we use more flags for all CMake builds. I presume the problem is the difference in build flags or some platform-specific CMake issue. |
Certainly:
The issue is the symlink pointing to |
@finagolfin Just to be clear the problem you are seeing is that libLLVM.so is not a symlink to libLLVM.so.18.1 ? |
@h-vetinari Is there any reason why you can't link against libLLVM.18.1.dylib ? |
No there isn't, but the point is that the CMake build as-is generates a broken symlink, and I'd prefer to fix it in LLVM rather than having to carry a manual fix. |
Yep, that would be one way to fix it. We link our Rust compiler build against |
This is a partial revert of 10c48a7 with a fix for the symlink target name on MacOS See llvm#84637
@h-vetinari Are you able to test this fix on MacOS: #85163 |
@finagolfin I still can't reproduce the issue you are seeing with the symlinks. Do you have a build log or something I can pull the cmake invocation from? |
I'm currently trying out the following diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 3bc78b0dc935..b3505e2b749e 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -2089,7 +2089,13 @@ function(llvm_install_library_symlink name dest type)
set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
if (ARG_SOVERSION)
- set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}.${ARG_SOVERSION})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # macOS puts the SOVERSION in the middle, i.e. we need to point to libLLVM.18.1.dylib
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}.${ARG_SOVERSION}${CMAKE_${type}_LIBRARY_SUFFIX})
+ else()
+ # linux has the SOVERSION at the end, i.e. libLLVM.so.18.1
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}.${ARG_SOVERSION})
+ endif()
else()
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
endif() I expect this to work, because the only problem AFAICT is the hard-coded format not being adapted to macOS. If it doesn't work, I'll try your suggestion. If it works I'm happy to raise a PR (or try your suggestion nevertheless, if you like your approach better). |
So my patch works, but I think yours is more elegant. I'll try it next. |
OK, if you are not seeing it, maybe it is something specific to Android. I will manually create the symlink for now and look into the underlying issue in the coming weeks. |
Yours works as well, so I suggest to merge #85163 - thanks for the quick handling! |
This is a partial revert of 10c48a7 with a fix for the symlink target name on MacOS See llvm#84637 (cherry picked from commit ec2b752)
This is a partial revert of 10c48a7 with a fix for the symlink target name on MacOS See llvm#84637 (cherry picked from commit ec2b752)
I can no longer reproduce with 18.1.2, which I just shipped for Android:
Was something merged to fix this or should I look into it, to make sure it wasn't some fluke that might break again? |
@finagolfin I'm not sure what is going on in your build system, but having libLLVM-18.so be a symlink to libLLVM.so is a (bug)[https://github.com//issues/82647]. However, this was fixed in 18.1.0-rc4. Do you have a complete build log for your build? |
Here is where the symlink is created on our CI for the Android AArch64 library, not sure if that's the level of detail you want though. I will spend some time looking into that CMake config to see what changed and why it behaves differently on Android. |
Can you update the build so that the logs record the full cmake command that was used? Without that, it's going to be hard to debug this. |
I will look into this manually and report back instead. |
I think this issue can be closed |
No, @tstellar says the current behavior is a bug, even though it works for me on Android now. I will look into why it behaves the way it does now and report back, then we can decide if anything needs to be done. |
I'm guessing this is related to bumping the minor version for the first time in a long time:
We build with
-DLLVM_LINK_LLVM_DYLIB=ON
to make sure this shared library is included, which is then linked against by the Rust compiler and so on also. I think the relevant CMake config is here, which I notice @tstellar recently modified.The text was updated successfully, but these errors were encountered: