# Creating fully self-contained and pre-compiled library

**URL:** <https://discourse.julialang.org/t/creating-fully-self-contained-and-pre-compiled-library/131374>\
**Category:** General Usage\
**Created:** [August 5, 2025, 1:40pm UTC](https://discourse.julialang.org/t/creating-fully-self-contained-and-pre-compiled-library/131374 "2025-08-05T13:40:46Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![asprionj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asprionj/32/6856_2.png) [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Post date:** [August 6, 2025, 10:20am UTC](https://discourse.julialang.org/t/creating-fully-self-contained-and-pre-compiled-library/131374/4 "2025-08-06T10:20:18Z")

</div>

Thanks for the hints. Forgot to note that currently I’m developing on Windows (but will later deploy on linux; but want to have a proof-of-concept on Windows first). So I downloaded the portable nightly binaries (from today, 05:06) and tried to compile the hello-world example. That is, just the following in a .jl file:

```julia
function @main(args::Vector{String})::Cint
    println(Core.stdout, "Hello, World!")
    return 0
end

```

Compilation works fine, and I can see that the generated .exe depends on `libjulia.dll` and `libjulia-internal.dll`. So, put these two right next to the .exe such that they are found.

When I run the .exe, it errors out. Could get the following message (when I double-click the .exe instead of calling it from bash/cmd):

 ![error message upon running the juliac-generated .exe](https://global.discourse-cdn.com/julialang/original/3X/4/e/4efa8c523f0e09f9133f47e7844aa4e6c365e311.png)

Sorry for the German. It says that the entrypoint with that very cryptic name cannot be found in `libjulia-internal.dll`. Any ideas what is going wrong?

* * *

**Edit 1** : went deeper into analysing dependencies. `libjulia-internal` depends on `...\mingw64\bin\libstdc++-6`. So, I happened to have mingw64 installed / on the path and was not aware that this was required for `juliac`. For some reasons I had da very old version of it installed (from 2012 or so), but also changing to a recent one (14.2.0) does not solve the problem (but a different entrypoint is not found). For this version, it does not have available:

- `std::__once_functor`
- `std::__get_once_mutex()`
- `std::__set_once_functor_lock_ptr(std::unique_lock<std::mutex>*)`

I then found the sentence “The msys2 libstdc+±6.dll appears to not have the needed symbols while the one distributed with Julia does.” in [this thread](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/41). So, due to my installation of mingw64 being on the path, these libs are loaded.

If I remove my mingw64 installation from the PATH, four mingw64-libs are not found (`atomic-1`, `gcc_s_seh-1`, `winpthread-1`, `stdc++-6`). If I use those from the `/bin` folder of julia, I get a step further, namely calling the .exe providing console output about what else is missing (funnily I cannot find that these are missing using a dependency analyser on my .exe).

In the end, **I get the .exe for the hello-world example to work** (🙂) if these libs from `<julia-root>/bin` are available (besides the `hello.exe`):

- hello.exe (1.648 MB)
- libatomic-1.dll (0.256 MB)
- libgcc\_s\_seh-1.dll (0.932 MB)
- libjulia-internal.dll ( **14.556 MB** )
- libjulia.dll (0.214 MB)
- libopenlibm.dll (0.523 MB)
- libpcre2-8.dll (0.802 MB)
- libstdc+±6.dll ( **25.018 MB** )
- libwinpthread-1.dll (0.323 MB)

For all binary-size guys out there, that’s 42.6 MB of libraries (almost exclusively made up by the two highlighted-in-bold-font ones).

* * *

**Edit 2** : I was calling the .exe from bash (on mingw64) before. Then the above libs are sufficient. If called from cmd/powershell, it complains about two other libs not being available, but still prints the “Hello world!” to the console. These libs are:

- libgmp-10.dll (1.054 MB)
- libmpfr-6.dll (2.505 MB)

---

_[View the full topic](https://discourse.julialang.org/t/creating-fully-self-contained-and-pre-compiled-library/131374)._
