ApplicationBuilder.jl
ApplicationBuilder.jl copied to clipboard
"ERROR: Unable to find compatible target in system image" when building
I am trying to build the example on MacOS with Julia 1.1 (self-built). This does not work:
julia> build_app_bundle("/Users/eschnett/.julia/packages/ApplicationBuilder/kMUzZ/examples/hello.jl", appname="hello")
Using calculated bundle_identifier: 'com.eschnett.hello'
~~~~~~ Creating mac app in "/Users/eschnett/src/jl/HelloWorld/builddir/hello.app" ~~~~~~~
~~~~~~ Compiling a binary from '/Users/eschnett/.julia/packages/ApplicationBuilder/kMUzZ/examples/hello.jl'... ~~~~~~~
Julia program file:
"/Users/eschnett/src/jl/HelloWorld/builddir/hello.app/Contents/MacOS/applicationbuilderutils.jl"
C program file:
"/Users/eschnett/.julia/packages/ApplicationBuilder/kMUzZ/src/program.c"
Build directory:
"/Users/eschnett/src/jl/HelloWorld/builddir/hello.app/Contents/MacOS"
ERROR: Unable to find compatible target in system image.
ERROR: failed process: Process(`/Users/eschnett/julia-1.1/bin/julia --compiled-modules=yes --cpu-target=x86-64 --optimize=3 -g0 --output-o=hello.a --track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --track-allocation=none --sysimage-native-code=yes --sysimage=/Users/eschnett/julia-1.1/lib/julia/sys.dylib --compiled-modules=yes --optimize=2 /Users/eschnett/.julia/packages/PackageCompiler/oT98U/sysimg/run_julia_code.jl`, ProcessExited(1)) [1]
Ah, sorry, it's because --cpu-target=x86-64
is incompatible with self-built julia. You can either:
- Use a shipped julia binary, or
- Change the cpu target to
cpu_target="native"
in build_app_bundle(). But If you do this, then your app will be significantly less portable to other machines (it will only run on other machines with identical cpus).
- [ ] We should add this information to the README
@NHDaly Thanks to the above information, I was finally able to build an executable with PackageCompiler.jl
, (within a singularity container) that could run on our computing cluster. Both the cpu_target="x86_64"
(seems to work with underscore, as in the output of gcc -dumpmachine
) and the "is incompatible with self-built julia" pieces of information were crucial to make this work.
Indeed, I had initially tried to use the cpu_target
option with the julia version present in my workstation, and I got the error message that lead me to this issue. When done during the %post phase of the singularity container build, this worked, likely because the official docker image on which my container is based contains a "shipped julia binary".
Definitely worth adding these important pieces information in the README of PackageCompiler.jl
, in my opinion.
Now, I shoud try ApplicationBuilder.jl
to see if I can make something able to run without a container.
Thanks.
(The deps/build.jl
and the singularity definition file are available at commit 09c31ab0 of https://gitlab.pasteur.fr/bli/qaf_demux/tree/master/Julia/QafDemux)
Note that using the same CPU target that Julia itself uses is likely a good idea: https://github.com/KristofferC/PackageCompilerX.jl/blob/1aedf81497fe195cca28d7e6287a189e1fb26518/src/PackageCompilerX.jl#L13