JuliaLang / PackageCompiler.jl

Compile your Julia Package
https://julialang.github.io/PackageCompiler.jl/dev/
MIT License
1.41k stars 189 forks source link

ccallable function does not produce a plot #817

Open karlemilstrecker opened 1 year ago

karlemilstrecker commented 1 year ago

This simple example

model XYZ export pt using Plots Base.@ccallable function pt()::Cvoid x=range(1,10,100) plot(x,x) end end # module XYZ

running within the c-app

_#include

include "~/XYZLib/include/julia_init.h"

include "~/XYZLib/include/XYZ.h"

int main(int argc, char *argv[]){ init_julia(argc, argv); pt();
shutdownjulia(0); printf("Success!\n"); }

throws the error

_InitError(mod=:OpenSpecFunjll, error=ErrorException("Artifact "OpenSpecFun" was not installed correctly. Try using Pkg; Pkg.instantiate() to re-install all missing resources.")) error at /usr/local/lib/libEXAlib.dylib (unknown line)

while this simple example works fine within the same c-app

module XYZ export pt using CSV, DataFrames Base.@ccallable function pt()::Cvoid datafile = "somedata.csv" data = CSV.read(datafile, delim=",", DataFrame) for i in range(1, nrow(data)) println("i = ", data.t[i]) end end end # module XYZ

I also tried other plot-packages like GADFLY. The errors were more or less the same.

Julia Version 1.8.5 Commit 17cfb8e65ea (2023-01-08 06:45 UTC) Platform Info: OS: macOS (x86_64-apple-darwin21.4.0) CPU: 8 × Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, skylake) Threads: 1 on 8 virtual cores

Installed by using brew installer

KristofferC commented 1 year ago

Could be related to https://github.com/JuliaLang/PackageCompiler.jl/issues/786, ref https://github.com/JuliaLang/PackageCompiler.jl/pull/750