# Issue with XGBoost.jl and LIBSVM.jl when Julia 1.8.4

**URL:** <https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396>\
**Category:** General Usage\
**Tags:** packages\
**Created:** [January 1, 2023, 9:43pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396 "2023-01-01T21:43:35Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [April 25, 2023, 4:59am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/28 "2023-04-25T04:59:45Z")

</div>

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:

1. the wrapper loading aspect,
2. using `CompilerSupportLibraries_jll` as a build dependency in the `build_tarballs.jl` file, e.g:

```julia
Dependency("CompilerSupportLibraries_jll"; platforms=filter(!Sys.isbsd, platforms))

```

1. 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:

```julia
## "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**
>
> ```julia
> using XGBoost
> (X, y) = (randn(100,4), randn(100))
> bst = xgboost((X, y), num_round=5, max_depth=6, objective="reg:squarederror")
> 
> ```

> **LIBSVM.jl**
>
> ```julia
> # 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**
>
> ```julia
> # (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

```julia
"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?

---

_[View the full topic](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396)._
