Hi there!
I hope this is the right place to ask this question.
I wrote a custom module “MOD”, and eventually I want to compile this module and its functions into a DLL, which functions I can call from a LabView program.
For the moment, I develop on Ubuntu 18.04. As a test, I tried to generate a *.so file. I tested the module extensively with Julia 1.2, but I also run it with Julia 1.5 without any problems.
Now I saw that PackageCompiler can do what I want, and it even provides a description how to compile a library (sysimage) without PackageCompiler.
However, when I run
using PackageCompiler
activate .
include("src/MOD.jl")
using .MOD
create_sysimage(:MOD; sysimage_path="Sysimage.so", incremental=false, precompile_execution_file="build-tools/precompile-script.jl")
I get the error message: ERROR: package(s) MOD not in project.
Off course my module “MOD” is not handled by the package manager, but it is a module defined in the file src/MOD.jl which looks a bit like this:
module MOD
using DataFrames;
using LinearAlgebra: pinv
using DSP: conv
# ...
# Include functions
include("functions.jl")
# ...
end # module
What can I do that PackageCompiler recognizes my custom module?
Alternatively I tried to compile the library without PackageCompiler. In a first step to create the object file:
julia --startup-file=no --output-o Sysimage.o -J"/julia/dir/lib/julia/sys.so" custom_sysimage.jl
where the script custom_sysimage.jl
looks like
Base.init_depot_path()
Base.init_load_path()
include("./src/MOD.jl")
using .MOD
using DataFrames
using CSV
data = DataFrame(CSV.File("dummy.csv"))
MOD.run(data)
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
data=0;
ans=0;
However, with this approach, I get the error:
ERROR: LoadError: could not load library "libfftw3.so.3"
libfftw3.so.3: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden
(english: Cannot open the shared object file: file or directory not found)
However, when I start a julia session and do
include("./src/MOD.jl")
using .MOD
using DataFrames
using CSV
data = DataFrame(CSV.File("dummy.csv"))
MOD.run(data)
It runs without any error message.
All these examples were performed with Julia 1.5.
Can anybody guide me what is going wrong and how I can manage to compile these functions into a .*so and finally into a DLL object? Currently I have no clue where I should start.
Furthermore, if I have some mistakes in my design, and it should be designed in some other way in order to reach my goal, please let me know!