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

I get the following exception:

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.
  [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.
 [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> 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
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake-avx512)

Any ideas what causes this?

Error messages in English would be more useful :slightly_smiling_face:

How did you install Julia?

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

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

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

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.

I solved it using Libdl.dlopen and Libdl.dlsym explicitly for the ccalls.