I watched this talk on juliac which I am eager to try out but I can’t figure out how. I looked through the dev docs and the relevant PR, but no such luck, so am posting here.
To get started I ran this:
juliaup update nightly
juliaup default nightly
Then, the first (naive) thing I tried was the exact syntax from the talk
# main.jl
module MyApp
Base.@ccallable function myfunc()::Cint
println(Core.stdout, "Hello, world!")
return 0
end
end
julia juliac.jl --output-exe main --trim main.jl
to which I realised that juliac.jl
is an actual file somewhere and not a special subcommand. I found it sitting in ~/.julia/juliaup/julia-nightly/share/julia/juliac.jl
so went with that. Here’s the first error:
> julia ~/.julia/juliaup/julia-nightly/share/julia/juliac.jl \
--output-exe main --trim main.jl
ERROR: julia: --trim is an experimental feature, you must enable it with --experimental
Failed to compile main.jl
Ok, so I tried adding --experimental
on the end:
> julia ~/.julia/juliaup/julia-nightly/share/julia/juliac.jl \
--output-exe main --trim --experimental main.jl
Unexpected argument `--experimental`
Weird. Where should --experimental
go? Maybe as an argument to julia
itself? This is what I tried next:
> julia --experimental \
~/.julia/juliaup/julia-nightly/share/julia/juliac.jl \
--output-exe main --trim main.jl
ERROR: julia: --trim is an experimental feature, you must enable it with --experimental
Failed to compile main.jl
Even weirder. Maybe I am supposed to pass --trim
to the julia binary too?
> julia --experimental --trim \
~/.julia/juliaup/julia-nightly/share/julia/juliac.jl \
--output-exe main main.jl
ld: warning: ignoring duplicate libraries: '-ljulia'
Undefined symbols for architecture arm64:
"_main", referenced from:
<initial-undefines>
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Compilation failed.
I also tried putting all the flags in both spots, but got back to the first error:
> julia --experimental --trim \
~/.julia/juliaup/julia-nightly/share/julia/juliac.jl \
--output-exe main --trim main.jl
ERROR: julia: --trim is an experimental feature, you must enable it with --experimental
Failed to compile main.jl
Does anybody know how to get this cool new feature working? Maybe it doesn’t yet support arm64, or perhaps it’s not compatible with juliaup, or perhaps I just need to do something like fix my $LD_LIBRARY_PATH
to point to the right julia library files?
[disclaimer: I understand juliac is highly experimental etc and don’t expect full support on it yet; just was curious to check it out!]