Ok, I have a consistent method of “solving” the crash behaviour. It’s not a solution to the bug but I think it may point the way to a means of fixing it.
The basic observation is that the crash doesn’t occur when loading each package’s respective .dll
libraries directly (i.e. via a dlopen
) but does occur when loading the dll
through their respective JuliaBinaryWrappers
package (e.g. XGBoost_jll.jl
). The common thread linking the examples seems to be:
- the wrapper loading aspect,
- using
CompilerSupportLibraries_jll
as a build dependency in thebuild_tarballs.jl
file, e.g:
Dependency("CompilerSupportLibraries_jll"; platforms=filter(!Sys.isbsd, platforms))
- and the use of OpenMP / GOMP /
libgomp-1.dll
within the wrapper C library.
So a method of “solving” the crash is to run the following before loading the package:
## "Solution" code:
import CompilerSupportLibraries_jll
using Libdl
dlclose(CompilerSupportLibraries_jll.libgomp_handle)
I’ve verified that this works for me with the following reproducible crash MWEs given here and in linked issues:
XGBoost.jl
using XGBoost
(X, y) = (randn(100,4), randn(100))
bst = xgboost((X, y), num_round=5, max_depth=6, objective="reg:squarederror")
LIBSVM.jl
# LIBSVM.jl (https://github.com/JuliaML/LIBSVM.jl/issues/95#issue-1517938994)
using LIBSVM
(X, y) = (randn(100,4), randn(100))
svmtrain(X', y)
BLIS.jl
# (https://github.com/JuliaLinearAlgebra/BLIS.jl/issues/23#issuecomment-1515754372)
using blis_jll
using LinearAlgebra
BLAS.lbt_find_backing_library("dgemm_", :ilp64) # for information
BLAS.lbt_forward(blis_jll.blis_path; clear=false, verbose=true)
BLAS.lbt_find_backing_library("dgemm_", :ilp64) # for information
A = rand(10,5); B = rand(5,8);
A * B
I guess the question now is why is the above “solution” effective?
It seems to be reverting or unloading the default libgomp
, possibly to a system version? I get the fallback dllist()
loading
"C:\\ProgramData\\Anaconda3\\Library\\mingw-w64\\bin\\libgomp-1.dll"
Is it working because otherwise there is some incompatibility with a GCC 12 version that julia 1.8.4 and above is loading by default?