# PackageCompiler.jl complaining that MbedTLS.jl might not be relocatable

**URL:** <https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878>\
**Category:** Web Stack\
**Tags:** package-compiler\
**Created:** [February 19, 2020, 8:55pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878 "2020-02-19T20:55:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [February 19, 2020, 8:55pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878/1 "2020-02-19T20:55:52Z")

</div>

Hi,

I’m trying to use [`PackageCompiler.jl`](https://github.com/JuliaLang/PackageCompiler.jl) with a project that uses [`HTTP.jl`](https://github.com/JuliaWeb/HTTP.jl) (which depends on `MbedTLS.jl`), and it’s complaining that MbedTLS.jl is not relocatable (and the program also crashes, although I haven’t convinced myself yet that those are the same issue).

I think that using a `_jll` package solves this problem because of the way libraries are accessed (i.e., the path is not hard-coded into the program… but please correct me if I’m wrong). If so, is it possible to update [`MbedTLS.jl`](https://github.com/JuliaLang/MbedTLS.jl) to use the MBedTLS library provided by [`MbedTLS_jll.jl`](https://github.com/JuliaBinaryWrappers/MbedTLS_jll.jl)?

The libraries are slightly different versions (2.13.1 vs 2.16.0), and I don’t know how much of an issue that is.

Any insight on this issue would be appreciated–thanks!

Cheers,  
Kevin

---

<div class="post-metadata">

**Author:** ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Post date:** [February 19, 2020, 10:46pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878/2 "2020-02-19T22:46:12Z")

</div>

This doesn’t answer the question about relocatability but in case it’s helpful, I’ve been successfully using PackageCompiler.jl to build system images with HTTP.jl baked in over the last couple of months. Didn’t have any issues with MbedTLS. This was on Linux. We were creating a Docker image that could run a julia app without incurring jit overhead everytime we spin up a container.

---

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [February 20, 2020, 5:23am UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878/3 "2020-02-20T05:23:09Z")

</div>

Thanks, that’s useful information. Just to clarify, do you create the app within the docker image, and then run it from where you create it?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [February 20, 2020, 7:38am UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878/4 "2020-02-20T07:38:38Z")

</div>

> [@kevin.squire](#):
>
> I think that using a `_jll` package solves this problem because of the way libraries are accessed (i.e., the path is not hard-coded into the program… but please correct me if I’m wrong).

This is true.

---

<div class="post-metadata">

**Author:** ![visr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/visr/32/17204_2.png) [@visr](https://discourse.julialang.org/u/visr)\
**Post date:** [February 20, 2020, 12:56pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878/5 "2020-02-20T12:56:30Z")

</div>

I just tried PackageCompiler.jl for a test app using GDAL (which has a GDAL\_jll) and NetCDF (which currently still uses CondaBinDeps, pending [https://github.com/JuliaPackaging/Yggdrasil/pull/513](https://github.com/JuliaPackaging/Yggdrasil/pull/513)).

GDAL alone worked on the first try (this is quite amazing tbh, given my PyInstaller experiences). For NetCDF I ripped BinDeps out in a local dev, and replaced it with a simple `const libnetcdf = "libnetcdf"`. Then I went to the conda bin dir and copied the `netcdf.dll` and it’s dependencies to the compiled app’s bin dir, and it worked!

---

<div class="post-metadata">

**Author:** ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Post date:** [February 20, 2020, 4:47pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-complaining-that-mbedtls-jl-might-not-be-relocatable/34878/6 "2020-02-20T16:47:12Z")

</div>

Yes, we build everything into the docker image and then just run the code inside containers launched from that image. To clarify a little more, I think my use of the word app was maybe a bit misleading. We build a julia system image into a docker image and then have a top level julia script as the image’s entrypoint. So when we launch the container it runs the top level script, which runs julia code that’s baked into the system image. The point of building everything into the system image is just to avoid compilation when the container starts up.
