oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.38k stars 1.64k forks source link

Compiling sulong fails in macOS 10.12 #1634

Open mardukbp opened 5 years ago

mardukbp commented 5 years ago

As per mx_sulong.py sulong requires LLVM <= 8. However, macOS 10.12 ships with LLVM 9. Compilation fails with

unknown argument: '-disable-O0-optnone'

After installing LLVM 8 the compilation proceeds successfully. mx_sulong.py should check whether the installed LLVM version is larger than 8 and tell the user to downgrade.

rschatz commented 5 years ago

LLVM 9 is not yet released.

The version numbers of LLVM on macOS are confusing. The 9 refers to the XCode version. It's not actually LLVM 9, it's Apple's fork, and it's hard to find out what version it really is. Since it doesn't support -disable-O0-optnone, I assume it's quite old, afaik that option was introduced in LLVM 5.

That being said, just for building Sulong, you shouldn't need any LLVM installed at all, since we ship our own LLVM build with GraalVM. That should also be used for building internally.

The only thing that is still built with an external LLVM are the tests, to make sure it also works with other versions. We're working on making this dependency optional, but we're not quite there yet. If you run just mx build to build Sulong, the tests shouldn't be built by default. If you want to build and run the tests, we recommend installing LLVM from Homebrew for now.

mardukbp commented 5 years ago

Thanks for the info on LLVM/Clang versioning on macOS. Actually, I am building FastR, which clones the graal repo and builds Sulong. The compilation failed with the above error and it succeeded upon installation of LLVM 8 with Homebrew.

I think that mx_sulong.py should consider certain versions of XCode as old versions of Clang and consequently not call it with the flag -disable-O0-optnone.