crystal-lang / distribution-scripts

40 stars 24 forks source link

Bumping LLVM version on macOS? #89

Closed maxfierke closed 3 years ago

maxfierke commented 3 years ago

My understanding from this line: https://github.com/crystal-lang/distribution-scripts/blob/e5f21df883d800e9e68f63b79cf796696f905cf1/omnibus/config/software/llvm.rb#L2 is that LLVM for the binary distribution uses LLVM 6. Is there a particular reason for holding this back on LLVM 6?

Would it be possible to bump this to something much newer, perhaps LLVM 10 (or ideally LLVM 11+)?

The reason I ask is that I believe either LLVM 10 or 11 is needed to target AArch64 (ARM64) on Darwin/macOS. If were to use a newer LLVM and also set -DLLVM_TARGETS_TO_BUILD=X86;AArch64 for the builds of LLVM used to build the distribution releases, we could use the official x86_64 binary release to bootstrap a ARM64 Homebrew build

bcardiff commented 3 years ago

LLVM 11 support is still not complete.

The LLVM binaries used for darwin/omnibus are built by the steps described in https://github.com/crystal-lang/distribution-scripts/blob/master/omnibus/config/software/llvm.rb . We built them in the CI to have a clean environment. Those artifacts are uploaded to S3 and are referenced by https://github.com/crystal-lang/distribution-scripts/blob/master/omnibus/config/software/llvm_bin.rb .

IIRC the main things we care are that CMAKE_BUILD_TYPE=MinSizeRel and BUILD_SHARED_LIBS=OFF to reduce the binary size and to link it statically.

Bumping the LLVM version requires updating those flags. I (think) I did that for LLVM 10 at https://github.com/crystal-lang/distribution-scripts/compare/build-llvm-10 but bumping xcode also introduced a dependency of some system lib (CoreFoundation) that was not present before on the LLVM 6 build. I never found whether if that would be an issue or not.


In the long run, I would like to move out of omnibus and probably investigate if a built using nix with all it goodness would be simpler to maintain and run locally without messing the local environment. This would require using patchelf to use the binaries outside a nix environment.


Thanks for the nudge to document a bit things here :-)

maxfierke commented 3 years ago

Closing this, since macOS is using LLVM 10 on master now