# How to use juliac with imported packages?

**URL:** https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511
**Category:** General Usage
**Tags:** question
**Created:** [December 5, 2024, 6:52pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511 "2024-12-05T18:52:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![TheHedgehog2000](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@TheHedgehog2000](https://discourse.julialang.org/u/TheHedgehog2000)
#### Post date: [December 5, 2024, 6:52pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511/1 "2024-12-05T18:52:59Z")

</div>

I am trying to use juliac to turn some code into an executable. The following minimal example works:

```julia
module HelloWorld

Base.@ccallable function main()::Cint
    println(Core.stdout, "Hello, World!")
    return 0
end

end # End of module HelloWorld 

```

```julia
julia +nightly ~/.julia/juliaup/julia-nightly/share/julia/juliac.jl --output-exe test_juliac --experimental --trim test_juliac.jl

```

But if test\_juliac.jl uses any package, such as the following, I get “Package not found in current path”, even though I can then go into the REPL and use the package easily. Any ideas where this is happening and how to fix it?

```julia
module HelloWorld

using Plots

Base.@ccallable function main()::Cint
    println(Core.stdout, "Hello, World!")
    return 0
end

end # End of module HelloWorld 

```

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [December 5, 2024, 6:55pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511/2 "2024-12-05T18:55:09Z")

</div>

Try creating a Project.toml file including the packages you want to use, and then invoke juliac with `julia +nightly --project ... `

Here’s a slightly less minimal example

> **[GitHub - baggepinnen/static\_kalman: An experiment in static compilation of Julia](https://github.com/baggepinnen/static_kalman)**
>
> An experiment in static compilation of Julia

---

<div class="post-metadata">

### Author: ![TheHedgehog2000](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@TheHedgehog2000](https://discourse.julialang.org/u/TheHedgehog2000)
#### Post date: [December 5, 2024, 7:25pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511/3 "2024-12-05T19:25:06Z")

</div>

Thanks, indeed that seems to deal with the problem, but now I’m getting a segfault.

---

<div class="post-metadata">

### Author: ![TheHedgehog2000](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@TheHedgehog2000](https://discourse.julialang.org/u/TheHedgehog2000)
#### Post date: [December 5, 2024, 7:27pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511/4 "2024-12-05T19:27:33Z")

</div>

I’m also encountering other problems, I think related to certain packages. For instance, with Gtk4, I get:

````julia
ERROR: LoadError: could not load library ""
dlopen(.dylib, 0x0001): tried: '.dylib' (no such file)```
````

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [December 5, 2024, 7:33pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511/5 "2024-12-05T19:33:44Z")

</div>

This functionality is not yet released, and there are likely many rough corners and issues left to iron out before it provides a smooth experience.

To get my demos to work, I had to remove some package dependencies to avoid loading them. I also inserted frequent debug printouts throughout the entire module and main function to pinpoint where segmentation faults appear. One of my demos also require patches not yet on Julia master, so once again, do not expect a smooth experience quite yet 🙂

---

<div class="post-metadata">

### Author: ![TheHedgehog2000](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@TheHedgehog2000](https://discourse.julialang.org/u/TheHedgehog2000)
#### Post date: [December 5, 2024, 7:37pm UTC](https://discourse.julialang.org/t/how-to-use-juliac-with-imported-packages/123511/6 "2024-12-05T19:37:44Z")

</div>

Okay, thanks. I will mark your original comment as a solution since it does address the question about packages.
