Closed yuyichao closed 5 years ago
+1 to armv6, if possible
Current blocking issues for nightly update.
[x] Make sure we are compiling with LTO using gcc 6.2
TL:DR. The relavant part of the command line to use for now is LLVM_CMAKE='-DCMAKE_CXX_FLAGS=-flto -DCMAKE_C_FLAGS=-flto -DCMAKE_EXE_LINKER_FLAGS=-flto -DCMAKE_SHARED_LINKER_FLAGS=-flto -DCMAKE_AR=$$(which gcc-ar) -DCMAKE_RANLIB=$$(which gcc-ranlib) -DCMAKE_NM=$$(which gcc-nm)' make LLVM_USE_CMAKE=1 LLVM_LTO=1
and I've tested it to make sure it works around all known issues I've seen.
Reasons we needs such a complicated command line are,
LLVM_ENABLE_LTO
which is 3.9 only.ar
and ranlib
. These aren't necessary when I tested with the stock gcc and binutils on arch linux.CFLAGS
, CXXFLAGS
and LDFLAGS
to llvm with cmake build. This causes the LLVM_LTO
flag from https://github.com/JuliaLang/julia/pull/19028 to be no-op, which both means we don't need that PR for now and that we need to specify the flags manually.... After this is fixed the command above should still work and can be simplified to LLVM_CMAKE='-DCMAKE_AR=$$(which gcc-ar) -DCMAKE_RANLIB=$$(which gcc-ranlib) -DCMAKE_NM=$$(which gcc-nm)' make LLVM_USE_CMAKE=1 LLVM_LTO=1
(and if we can figure out how to configure gcc correctly the env can be removed altogether).[x] Merge https://github.com/JuliaLang/julia/pull/18996
This is the only change that blocks compilation so I'm waiting for other changes to be merged first so that we don't ship a nightly that does not work in certain configuration.
The slave is currently offline for me to debug the issue last night and it already has a correctly compiled LLVM cached (the one I compiled manually) so as long as the command above is implemented in the buildbot setup script we can merge https://github.com/JuliaLang/julia/pull/18996 and ready to update the nightly.
I just breifly tried setting MARCH=armv6
locally and it's complaining because it picks up the -march flag from my llvm compilation........ I'll try to compile a LLVM and test it later. It would also be nice if we can have a armv6 box to test if the compiled binary works.
Update:
There's a new issue with the cmake build of llvm 3.8.1 since it links libLTO.so which we don't ship (Thanks @vchuravy and @maleadt for the hint and the fix). This looks like an upstream bug and adding -DLLVM_LINK_LLVM_DYLIB=On
works around it. The first commit in https://github.com/JuliaLang/julia/pull/18863 addresses the same issue.
The final command line I used was LLVM_CMAKE='-DLLVM_LINK_LLVM_DYLIB=On -DLLVM_HOST_TRIPLE=armv7l-unknown-linux-gnueabihf -DLLVM_DEFAULT_TARGET_TRIPLE=armv7l-unknown-linux-gnueabihf -DCMAKE_CXX_FLAGS=-flto -DCMAKE_C_FLAGS=-flto -DCMAKE_EXE_LINKER_FLAGS=-flto -DCMAKE_SHARED_LINKER_FLAGS=-flto -DCMAKE_AR=$$(which gcc-ar) -DCMAKE_RANLIB=$$(which gcc-ranlib) -DCMAKE_NM=$$(which gcc-nm)' make -j8 TAGGED_RELEASE_BANNER="Official http://julialang.org/ release" JULIA_CPU_TARGET=generic JULIA_CPU_CORES=4 JULIA_TEST_MAXRSS_MB=600 MARCH=armv7-a release LLVM_USE_CMAKE=1
. The specified triples should also fix the uname issue mentioned above although the build seems to work without.
Remaining TODO's (Assuming the new nightly is fine.....):
LLVM_CMAKE='-DLLVM_HOST_TRIPLE=armv7l-unknown-linux-gnueabihf -DLLVM_DEFAULT_TARGET_TRIPLE=armv7l-unknown-linux-gnueabihf'
)ARMv6 support should probably move to it's own issue.
regarding adding tests, in the current arrangement if tests fail on any of the test builders then no binaries get built at all. we can't use that setup with arm, we're not blocking x86 binaries on arm bugs. so running tests should also wait until the buildbot setup is refactored.
The need for gcc trapper of ar
, ranlib
, nm
is fixed. I did recompile binutils and gcc but I think what actually fixes it is to symlink the lto plugin into the binutils plugin directory (Ref https://github.com/archlinuxarm/PKGBUILDs/blob/527636ea075312c64aff6dad8ddc2b33933c8d62/core/gcc/PKGBUILD#L180-L183). The test build passed on the buildbot so nuking the buildbot should be fine now.
It'll still be nice to set the correct host triple, (which might actually be a regression in LLVM's cmake system).
Cool, good catch. Is the ARM builder being managed by the same set of ansible scripts, should we record the need to do that somewhere so it's easy to re-provision if we ever need to?
@staticfloat for that. I think there's automatic script to do this and maybe he sent me a link to the repo (maybe https://github.com/staticfloat/julia-ansible-scripts ?).
For the record the command line I used are
binutils
./configure --prefix=/home/debian/local --enable-lto --enable-plugins --disable-werror --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --enable-threads --enable-shared --with-pic --enable-ld=default --enable-gold --enable-deterministic-archives
The --enable-lto --enable-plugins --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf
is likely the only important (arm/lto specific) part.
gcc
../gcc_source/gcc-6.2.0/configure --prefix=/home/debian/local --with-gas=/home/debian/local/bin/gas --enable-host-shared --enable-threads=posix --enable-languages=c,c++,fortran,lto --disable-multilib --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --enable-lto --enable-plugin --disable-werror
and the important (arm/lto specific) part is likely --enable-languages=c,c++,fortran,lto --disable-multilib --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --enable-lto --enable-plugin
I also needs to clear my CFLAGS
since it triggers some Werror
in gcc's dependencies that can't be turned off easily.
And with the above flags gcc installs the lto plugins to libexec
by default and ln -s ~/local/libexec/gcc/armv7l-unknown-linux-gnueabihf/6.2.0/liblto_plugin.so ~/local/lib/bfd-plugins
puts it to where binutils
expects.
Confirmed that GCC 7 eliminates the need for us to do any LTO or AR/RANLIB overriding
Closed by #111
As @tkelman requested, here's a list of implemented/planned/proposed changes to how arm builders works.
uname -m
isarmv8l
instead ofarmv6l
orarmv7l
. This is only an issue when compiling any dependencies (noticeably clang and gcc) that picks up the target arch automatically fromuname -m
. Both of them should be overwritable. We can possibly figure this out fromARCH
but I'm not sure what's the most robust way to do it.... In order to make sure the binary is compiled for the right arch, I think we can keep the old builder and run a few simple tests on it using the binary we compiled to make sure that the binary is good to use. From my brief testing just now it seems that the LLVM was probably not compiled with LTO and it is somehow using neon instructions.@staticfloat, @ViralBShah