# InitError: could not load library "libstdc++-6.dll"

**URL:** <https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447>\
**Category:** New to Julia\
**Tags:** question, error\
**Created:** [May 19, 2021, 2:04pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447 "2021-05-19T14:04:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [May 19, 2021, 2:04pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/1 "2021-05-19T14:04:07Z")

</div>

I get the following exception:

```julia
julia> import JuMP
[Info: Precompiling JuMP [4076af6c-e467-56ae-b986-b466b2749572]
ERROR: LoadError: InitError: could not load library "libstdc++-6.dll"
%1 ist keine zulässige Win32-Anwendung.
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl .\libdl.jl:114
  [2] dlopen (repeats 2 times)
    @ .\libdl.jl:114 [inlined]
  [3] __init__ ()
    @ CompilerSupportLibraries_jll C:\Julia\Julia-1.6.1_64bit\share\julia\stdlib\v1.6\CompilerSupportLibraries_jll\src\CompilerSupportLibraries_jll.jl:55
  [4] _include_from_serialized(path::String, depmods::Vector{Any})        
    @ Base .\loading.jl:674
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base .\loading.jl:760
  [6] _tryrequire_from_serialized(modkey::Base.PkgId, build_id::UInt64, modpath::String)
    @ Base .\loading.jl:689
  [7] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base .\loading.jl:749
  [8] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:998
  [9] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:914
 [10] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:901
 [11] include
    @ .\Base.jl:386 [inlined]
 [12] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base .\loading.jl:1213
 [13] top-level scope
    @ none:1
 [14] eval
    @ .\boot.jl:360 [inlined]
 [15] eval(x::Expr)
    @ Base.MainInclude .\client.jl:446
 [16] top-level scope
    @ none:1
during initialization of module CompilerSupportLibraries_jll
in expression starting at .julia\packages\JuMP\Xrr7O\src\JuMP.jl:11
ERROR: Failed to precompile JuMP [4076af6c-e467-56ae-b986-b466b2749572] to .julia\compiled\v1.6\JuMP\jl_D8E2.tmp.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
   @ Base .\loading.jl:1360
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base .\loading.jl:1306
 [4] _require(pkg::Base.PkgId)
   @ Base .\loading.jl:1021
 [5] require(uuidkey::Base.PkgId)
   @ Base .\loading.jl:914
 [6] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:901

```

```julia
julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake-avx512)

```

Any ideas what causes this?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 19, 2021, 5:01pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/2 "2021-05-19T17:01:42Z")

</div>

> [@ohmsweetohm1](#):
>
> Any ideas what causes this?

Error messages in English would be more useful 🙂

How did you install Julia?

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [May 19, 2021, 5:43pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/3 "2021-05-19T17:43:50Z")

</div>

I do not get your point. I just downloaded it from the website and installed it.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [May 19, 2021, 5:45pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/4 "2021-05-19T17:45:30Z")

</div>

Something like: % 1 is not a valid Win32 application.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [July 16, 2021, 11:57am UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/5 "2021-07-16T11:57:46Z")

</div>

I’m still having the issue even with a fresh install of Julia 1.6.2.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [September 7, 2021, 12:16pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/6 "2021-09-07T12:16:28Z")

</div>

I narrowed the problem down.  
The `libstdc++-6.dll` is from an other piece of software I am calling from Julia via `ccall`.  
For this I modified the `DL_LOAD_PATH` and added the `bin` directory where the dll is.  
I do the modification of the `DL_LOAD_PATH` inside a ` __init__ ` of a module that I import.  
This seems to mess up something.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [September 9, 2021, 9:46am UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libstdc-6-dll/61447/8 "2021-09-09T09:46:11Z")

</div>

I solved it using `Libdl.dlopen` and `Libdl.dlsym` explicitly for the `ccall`s.
