You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The find_library function in libdl.jl makes two calls to dlopen while searching for a library. It has been discovered that this causes problems when looking for the ROCm library libamdhip64.so on Fedora 40 Linux. ROCm links with LLVM, and calling dlopen on it twice causes LLVM to crash and report some inconsistency in its settings:
: CommandLine Error: Option 'disassemble' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
The problem is not specific to Julia. It can be reproduced in C by calling dlopen on the library, then dlcose, then dlopen again. See this post.
My guess is that as called in find_library, dlopen follwed by dlcose leaves some state from the library in the process's working memory, and this state causes confusion when dlopen is called on the library again.
Can find_library be re-implemented so as not to actually call dlopen and dlclose on the file once it's been found?
In general, programs will call find_library followed by dlopen, so if it's possible for find_library to change the state of the process so that a call to dlopen afterward might see leftover state and crash, it makes sense to me that find_library needs to be rewritten to not call dlopen at all.
The text was updated successfully, but these errors were encountered:
We probably should consider deprecating that. There is never a reason a user should be calling it before dlopen, as the user should just call dlopen instead. This function is from long before we had LazyLibrary and precompile such and we were experimenting with ways of making ccall work more reliably.
That is true, that usage is probably fine, but you might be better suited there to calling dlopen+dlpath directly instead? But notably there you wouldn't do that during precompile (since you'll corrupt the cache file due to the unsafe modification of preferences while loading) and therefore also wouldn't typically use dlopen directly afterwards either (as it isn't compatible with the already loaded MPI)
The
find_library
function inlibdl.jl
makes two calls todlopen
while searching for a library. It has been discovered that this causes problems when looking for the ROCm librarylibamdhip64.so
on Fedora 40 Linux. ROCm links with LLVM, and callingdlopen
on it twice causes LLVM to crash and report some inconsistency in its settings:See this thread for where the problem shows up.
The problem is not specific to Julia. It can be reproduced in C by calling
dlopen
on the library, thendlcose
, thendlopen
again. See this post.My guess is that as called in
find_library
,dlopen
follwed bydlcose
leaves some state from the library in the process's working memory, and this state causes confusion whendlopen
is called on the library again.Can
find_library
be re-implemented so as not to actually calldlopen
anddlclose
on the file once it's been found?In general, programs will call
find_library
followed bydlopen
, so if it's possible forfind_library
to change the state of the process so that a call todlopen
afterward might see leftover state and crash, it makes sense to me thatfind_library
needs to be rewritten to not calldlopen
at all.The text was updated successfully, but these errors were encountered: