Running a compiled DLL on a different platforms it give me error

ERROR: Target architecture mismatch. Please delete or regenerate sys.{so,dll,dylib}.

I compiled my user image following command from the command line (In directory C:\Julia-0.5.0\bin):

julia.exe “C:/Julia-0.5.0/build_sysimg_tim.jl” libFOO native “C:/Julia-0.5.0/userimg.jl” --force

Then I got a libFOO.dll that I call from the C language with using julia.h and I have the executable file Project.exe. This EXE file run on my computer, but when copy EXE with needed DLLs to another platform I getting the above mentioned error.

Compiled on processor:
Intel(R) Xeon(R) CPU E5-2430L v2 @ 2.40GHz, 2400 Mhz, 12 Core(s), 12 Logical Processor(s)

Tested on processors:
Intel(R) Core™ i5-4300U CPU @ 1.90GHz, 2494 Mhz, 2 Core(s), 4 Logical Processor(s)
and Intel(R) Core™ i7-6700HQ CPU 2.6GHz

Any advice is welcome, thanks.

To work across different processor models within the same architecture, specify a specific (older) CPU vintage; replacing native with core2 should work. native will use the highest instruction set available on the processor where the image is compiled.

see http://docs.julialang.org/en/stable/devdocs/sysimg/#build_sysimg

1 Like

Yes, core2 is sufficient.Thanks

However on newer processor (Intel(R) Core™ i7-6700HQ CPU 2.6GHz) I have always mentioned error. I tried both switches “core2” also “native” for cpu_target. Without success :frowning:

Do the nightly binaries work?

I tried to test it with nightly build (julia-0.6.0-29a35637b4-win64) but unsuccessfully. I could not install package WinRPM without error and when run compile script it is cyclic repeated.

julia.exe “C:/Julia-0.6.0-dev/build_sysimg_tim.jl” libFOO core2 “C:/Julia-0.6.0-dev/userimg.jl” --force

Any other ideas?

What errors are you seeing in each case (always the same, or one of the similarly worded ones)?

The matching of architectures is usually handled by jl_preload_sysimg_so, and gets largely disabled if you’ve specified a target architecture. Maybe confirm that jl_options.image_file is being set correctly in your exe?

If it gives me error is still the same. I create run exe with own.dll and after opening on the above-mentioned processor I got error "Target architecture mismatch… ". When I try to open the DLL by Julia C API program fell in function jl_init_with_image with a similar type of ERROR:
Unhandled exception at 0x0000000064F3C4BA (libjulia.dll) in TIM.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x000000FEC0D33FF8).

I could not open the DLL, but at the moment after further build it mysteriously works.

Maybe it’s Windows update because I use still the same procedure compilation. In the near future I will make a minimal reproducible example mainly due to compile a custom packages.