-
-
Notifications
You must be signed in to change notification settings - Fork 197
Description
My platform is a Windows 10 64-bit system.
I installed juliaup using cargo and then used juliaup to install the 64-bit Julia version 1.11.3+0.x64.w64.mingw32.
I have also installed Visual Studio 2019 on my computer, which includes the Microsoft Visual C++ (MSVC) toolchain and MinGW64.
However, when I was compiling a 32-bit DLL for C# to call, I found that the compilation always failed with an error related to the cpu_target parameter.
Therefore, I don't know which value to choose.
For example, the following are possible values:
i686-pc-windows-msvc;
x86_64-linux-gnu;
x86_64-apple-darwin;
x86_64-w64-mingw32;
x86_64-unknown-freebsd11.1;
x86_64-unknown-linux-musl;
x86_64-pc-windows-gnu;
x86_64-linux-gnu;
x86_64-apple-darwin;
x86_64-w64-mingw32;
x86_64-unknown-freebsd11.1;
x86_64-unknown-linux-musl;
x86_64-pc-windows-gnu;
i686-linux-gnu;
i686-apple-darwin;
i686-w64-mingw32;
i686-unknown-freebsd11.1;
i686-unknown-linux-musl;
i686-pc-windows-gnu
I tried using i686-pc-windows-msvc and i686-pc-windows-gnu and i686-w64-mingw32, but both attempts failed!
The compilation error message is as follows:
PackageCompiler: bundled libraries:
├── Base:
│ ├── libLLVM-16jl.dll - 81.921 MiB
│ ├── libatomic-1.dll - 262.406 KiB
│ ├── libdSFMT.dll - 115.094 KiB
│ ├── libgcc_s_seh-1.dll - 767.164 KiB
│ ├── libgfortran-5.dll - 11.162 MiB
│ ├── libgmp-10.dll - 1.053 MiB
│ ├── libgmp.dll - 1.054 MiB
│ ├── libgmpxx-4.dll - 293.766 KiB
│ ├── libgmpxx.dll - 293.766 KiB
│ ├── libgomp-1.dll - 1.646 MiB
│ ├── libjulia-codegen.dll - 103.563 MiB
│ ├── libjulia-internal.dll - 13.003 MiB
│ ├── libmpfr-6.dll - 2.526 MiB
│ ├── libmpfr.dll - 2.527 MiB
│ ├── libopenlibm.dll - 384.609 KiB
│ ├── libpcre2-16-0.dll - 711.891 KiB
│ ├── libpcre2-16.dll - 711.891 KiB
│ ├── libpcre2-32-0.dll - 684.148 KiB
│ ├── libpcre2-32.dll - 684.016 KiB
│ ├── libpcre2-8-0.dll - 774.789 KiB
│ ├── libpcre2-8.dll - 773.922 KiB
│ ├── libpcre2-posix-3.dll - 127.914 KiB
│ ├── libquadmath-0.dll - 1.136 MiB
│ ├── libssp-0.dll - 144.766 KiB
│ ├── libstdc++-6.dll - 25.187 MiB
│ ├── libuv-2.dll - 984.719 KiB
│ ├── libwinpthread-1.dll - 330.039 KiB
│ ├── libz.dll - 232.336 KiB
│ ├── libjulia.dll - 226.492 KiB
├── Stdlibs:
│ ├── OpenBLAS_jll
│ │ ├── libopenblas64_.dll - 37.669 MiB
│ ├── libblastrampoline_jll
│ │ ├── libblastrampoline-5.dll - 2.249 MiB
Total library file size: 293.001 MiB
⠋ [00m:00s] PackageCompiler: creating compiler .ji image (incremental=false)ERROR: Invalid CPU name "i686-pc-windows-msvc".
✖ [00m:00s] PackageCompiler: creating compiler .ji image (incremental=false)
ERROR: failed process: Process(`'C:\Users\xxx\.julia\juliaup\julia-1.11.3+0.x64.w64.mingw32\bin\julia.exe' --color=yes --startup-file=no --pkgimages=no --cpu-target i686-pc-windows-msvc --output-ji 'C:\Users\xxx\AppData\Local\Temp\jl_LVRilg\corecompiler.ji' 'C:\Users\xxx\.julia\juliaup\julia-1.11.3+0.x64.w64.mingw32\share\julia\base\compiler\compiler.jl'`, ProcessExited(1)) [1]
My test file (Julia4CSharp.jl) is as follows:
module Julia4CSharp
export add_numbers
function add_numbers(a::Int, b::Int)
return a + b
end
end # module
Then execute the compilation using the following command line:
julia> using PackageCompiler
julia> project_path = joinpath(@__DIR__, "Julia4CSharp")
"D:\\Julia Projects\\SomeExamples\\Julia4CSharp"
julia> module_path = joinpath(project_path, "src", "Julia4CSharp.jl")
"D:\\Julia Projects\\SomeExamples\\Julia4CSharp\\src\\Julia4CSharp.jl"
julia> include(module_path)
WARNING: replacing module Julia4CSharp.
Main.Julia4CSharp
julia> create_library(project_path, "Julia4CSharp.dll",
precompile_execution_file = module_path,
cpu_target = "i686-pc-windows-msvc",
force = true
)
Then the error mentioned above occurred.
Since my C# WinForm application is in 32-bit mode, I have no choice but to use Julia in 64-bit to cross-compile it into a 32-bit DLL.