JuliaLang / PackageCompilerX.jl

MIT License
85 stars 15 forks source link

win: compiler chain as artifact dependency #81

Closed Petr-Hlavenka closed 4 years ago

Petr-Hlavenka commented 4 years ago

Hi Kristoffer, I'd like to ask you if it would be possible to get the compiler chain in the form of _jll depencency - similar way the PackageCompiler.jl uses WinRPM to get the build environment. The automatic approach (esp. on windows) is a huge benefit to the ease-of-use and user adoption. Would it make sense to depend on Yggdrasil's mingw build for windows platform?

KristofferC commented 4 years ago

Yes, it makes sense to do and I have tried it myself https://github.com/KristofferC/Clang_jll.jl. I didn't get it to work on Windows though. But if Yggdrasil has a mingw that just works on Windows to link with libjulia, we should use it for sure.

davidanthoff commented 4 years ago

This is something that did work in the old https://github.com/JuliaLang/PackageCompiler.jl. The downside of course was that it used WinRPM. But what about this idea: couldn't we on a pristine machine install the old PackageCompiler on Windows, then just take all the binaries that it got from WinRPM and repackage them in a new artifact file and use that? Not the most elegant solution, but at least in principle that should work?

aminya commented 4 years ago

There is also https://github.com/JuliaBinaryWrappers/LLVM_jll.jl

davidanthoff commented 4 years ago

@staticfloat mentioned on slack that LLVM_jll.jl might not be ready to work for this scenario?

aminya commented 4 years ago

I am not sure about the status. But @maleadt mentioned that

Adding a dependency on LLVM_jll requires you to pick a version, which in turn is going to pull in binaries according to that version, and not by matching the LLVM version that Julia provides. In that case, there will be incompatibilities between, e.g., the IR delivered by Julia and the LLVM library from LLVM_jll to process that IR.

https://github.com/tshort/StaticCompiler.jl/issues/7 https://github.com/tshort/StaticCompiler.jl/pull/19#issuecomment-576641378

So we issue is to download the same LLVM version as Julia.

staticfloat commented 4 years ago

LLVM_jll is insufficient, because it doesn't contain mingw; even though we ship the libstdc++ runtime library and you could probably find the C runtime library on the system you're compiling on, we don't ship the headers, so it wouldn't work fully if you needed to actually compile rather than just link. We would probably be better off constructing a little mini "portable compiler shard" JLL package.

As far as matching LLVM versions, there are two ways to go about it. The first, which would work right now, is to have PackageCompilerX.jl be locked to a single Julia version: it only supports Julia 1.3, and is locked to LLVM_jll v8. Bam. Problem solved. Supporting multiple Julia versions would then be as easy as having a branch per version, each with its own LLVM_jll dependency with the appropriate version specified.

We're working on a system to have LLVM_jll be an automatically-shipped part of the Julia stdlib. That might solve some of these problems, but it's not going to land in 1.4. Perhaps in 1.5.

KristofferC commented 4 years ago

https://github.com/JuliaComputing/PackageCompilerX.jl/pull/91