PackageCompiler.jl icon indicating copy to clipboard operation
PackageCompiler.jl copied to clipboard

ccallable function does not produce a plot

Open karlemilstrecker opened this issue 2 years ago • 1 comments

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 <stdio.h> #include "~/XYZLib/include/julia_init.h" #include "~/XYZLib/include/XYZ.h"

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

throws the error

InitError(mod=:OpenSpecFun_jll, 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

karlemilstrecker avatar May 27 '23 06:05 karlemilstrecker

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

KristofferC avatar Jun 09 '23 06:06 KristofferC