Embedding Julia : Error on init : Unable to find compatible target in cached code image. Target 0 (goldmont): Rejecting this target due to use of runtime-disabled features

On Windows 11 with Visual Studio 2022 I can embed Julia (version is 1.10.2) and that works fine. When I test the code inside a sandbox or on a different new computer, the initialisation fails and the error I get is :

Unable to find compatible target in cached code image.
Target 0 (goldmont): Rejecting this target due to use of runtime-disabled features

Anybody a clue?

It is unclear to me what you are doing. Can you please elaborate what you are mean with “embed”?

It is a c++ program where I can call Julia functions.
The line where I get the error message is

    jl_init_with_image(JuliaHomeDir, JuliaSysImage);

In my development environment it works fine. If I test the code on the same computer but in a sandbox, I get the above error message

How do you create JuliaSysImage? Presumably you have differences in the architectures or instruction sets between your workstation and the target, and may need to generate the sysimage for a common architecture.

The sys image is created with the PackageCompiler, I have a CJM.jl that contains the functions for the system image.

The jl script that I use to create the image is
using Pkg
Pkg.add(“PackageCompiler”)
using PackageCompiler

pkg.activate(“CJM”)
Pkg.develop(path=“CJM”)
PackageCompiler.create_sysimage([:CJM],sysimage_path=“…\bin64\Julia\bin\CJM.dll”)
Pkg.activate(“”)

Architecture should not play a role, since when I test it in a sandbox, it is basically using the same computer hardware, only the windows environment is fresh.

And I also get this when I use jl_init() with no parameters, when it is using its own system image.

Not sure if it is required to recreate the sys image when running on a different machine, even if I restrict those machine to be Windows 10/11 / 64bit