This week (probably today), Alpine is going to upgrade their GCC from version 6 to 8 in Alpine edge. pmOS is based on Alpine edge, hence we need to adjust our aports as well.
I expect breakage in the kernels for example, as older kernels explicitly check for the GCC version and then include a file based on what it found. Newer kernels only include one file if the compiler is GCC, independent of the version.
Here's an issue, so we can note down the progress of the upgrade.
Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
GCC has been upgraded for all arches now. I'm not entirely sure if we have to rebuild all our packages that required GCC to build, does anyone know? I assume most stuff will compile fine (I know for a fact Phosh and it's dependencies did) except most of the kernels.
I've started the branch feature/gcc8 today which currently contains regenerated gcc and binutils aports and a commit that renamed the compiler-gcc6.h file to compiler-gcc8.h in the FP2 kernel and adjusts the devicepkg-dev package to that filename. Sadly the kernel does not compile due to very helpful errors
(In general, if it's not much extra effort, it would be nice if we could turn compiler-gcc*.h into a regular .patch file now that we need to touch it everywhere anyway.)
Update: The patch (adjusted) fixes the compilation but the kernel doesn't boot and I even with earlyprintk I didn't see any output out of the serial connection so I'm saying "it doesn't work".
After throughout research, I can't find any patch or even any mention of the error message you've posted.
It would be nice if we could all kernels work with GCC8 in theory. But when it starts with something like that, it doesn't seem feasible, and it doesn't really seem worth wasting a lot of time on this.
So I'm going the route of keeping gcc6 around, exclusively for the legacy vendor kernels.
TODO:
create main/gcc6 based on Alpine's latest gcc6 aport
(only package gcc there, not g++? gcc would be enough for the kernels)
make sure they don't conflict: apk add gcc gcc6 gcc-armhf gcc6-armhf should work
adjust cross compiler code to detect gcc6 packages (use CC=gcc6 in the APKBUILDs?) and to use the appropriate cross compiler for them instead of the gcc8 one
make sure all 3.x kernels compile with the new gcc6 packaging
adjust default aportgen template for linux-*
see the todo list below
nice to have:
test case: gcc6 packages must have the same version
test case: linux aports that depend on gcc6 should have the same HOSTCC=... lines (see below)
I just noticed that Linux 3.16 is still being maintained over at kernel.org. Maybe a relevant patch can be found here; however I did not find one as I looked through the results. So unless somebody is able to fix the error @z3ntu reported, we'll need to go with the GCC6 aport solution.
I don't have serial for this device so I don't know if it even had the boot loader issues mentioned above
I haven't used this downstream kernel a long time since there is a mainline(-ish) kernel for this device. I used this kernel for Android and had it compiling on GCC 5.x (iirc) before I stopped using it. There's more GCC related patches in the commit history but I don't remember all the details. The branch is here: https://github.com/Decatf/android_kernel_samsung_p4/tree/aosp-ng-gcc8
bd0772df2132bf56cda78e7204facf434cd5aa40 sounds like a good solution to getting rid of the compiler-N.h files. But it is unlikely that this would resolve the boot problem, right?
I'm making good progress with adding support for GCC6, see the checkboxes above.
The pmbootstrap aportgen gcc6-armhf etc. code lives in the feature/aportgen-gcc6 branch right now, and the changes necessary were rather simple. It's still WIP though, the resulting gcc6-armhf package is conflicting with gcc6 right now:
ERROR: gcc6-armhf-6.4.0-r0: trying to overwrite usr/bin/gcc6 owned by gcc6-6.4.0-r0.ERROR: gcc6-armhf-6.4.0-r0: trying to overwrite usr/gcc6/lib/libcc1.so owned by gcc6-6.4.0-r0.ERROR: gcc6-armhf-6.4.0-r0: trying to overwrite usr/gcc6/lib/libcc1.so.0 owned by gcc6-6.4.0-r0.ERROR: gcc6-armhf-6.4.0-r0: trying to overwrite usr/gcc6/lib/libcc1.so.0.0.0 owned by gcc6-6.4.0-r0.ERROR: gcc6-armhf-6.4.0-r0: trying to overwrite usr/gcc6/bin/gcc6 owned by gcc6-6.4.0-r0.ERROR: gcc6-armhf-6.4.0-r0: trying to overwrite usr/gcc6/bin/cc owned by gcc6-6.4.0-r0.
I'll continue working on this as soon as I find time for it. If somebody else wants to play with this in the meantime, take a look at the TODOs and go ahead!
Little status update, MRs coming as soon as this works.
Cross compilers can be generated now, they compile and they don't conflict.
gcc6 doesn't get installed to usr/bin/gcc6 anymore. Instead, all gcc6 programs get symlinked to /usr/bin/gcc6-... - that way they don't conflict with anything.
I've added gcc6 to the builddepends, and check for that in the Python code of pmbootstrap. When that is the case, it installs the gcc6 cross compiler.
So all in all it's pretty close to working as PoC. I need to fine tune the Linux APKBUILD now, so it really uses the cross compiler, and maybe a few other fixes.
I've compiled a modified linux-samsung-i9100 with GCC6 successfully \o/
To reproduce that (should work the same for other devices):
Use latest pmaports repository
Generate cross compiler aports: pmbootstrap aportgen gcc6-armhf (mind the 6!)
Modify your linux-* aport:
add gcc6 to makedepends
modify the "HOSTCC" lines as follows:
-HOSTCC="${CC:-gcc}"-HOSTCC="${HOSTCC#${CROSS_COMPILE}}"++# old kernel needs GCC6+CC="gcc6-$CC"+HOSTCC="gcc6-gcc"+CROSS_COMPILE="gcc6-$CROSS_COMPILE"
That's enough for today next up comes streamlining, such as providing this by default in new linux aport templates, and updating the existing aports. Maybe the CC line is not needed for example, this can probably be streamlined a bit.
Alright, the cross compilers are building now. That's really it for today. If someone wants to compile their kernel, it should be possible by modifying the linux APKBUILD as mentioned above.
I'll take a break of this tomorrow (sunday), and then get back at it on monday.
If someone has time and interest to help out, the following would be helpful:
check if a kernel generated that way is actually booting
prepare a merge request, that updates all old vendor kernels to compile with GCC6 as outlined above
@danct12 reported in the channel that the z00vd kernel boots up with gcc8. It's a 3.18.x based kernel, the kernel @z3ntu tested for the fairphone 2 is based on 3.4.0. My conclusion from this is, that it's probably a good idea to make using the latest GCC the default for new kernels. If they do boot, we don't need to install the GCC6 dependency to compile them, and at one point in the future we'll have 4.x kernels coming in, which won't need gcc6 either.
I've set all 3.x kernels to compile with GCC6 in this branch: fix/vendorkernels-use-gcc6. Typically the patch for one APKBUILD looks like this:
-makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev xz dtbtool"-HOSTCC="${CC:-gcc}"-HOSTCC="${HOSTCC#${CROSS_COMPILE}}"+makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev xz dtbtool gcc6"++# Compiler: this kernel was only tested with GCC6. Feel free to make a merge+# request if you find out that it is booting working with newer GCCs as+# well. See <https://postmarketos.org/vendorkernel> for instructions.+CC="gcc6-$CC"+HOSTCC="gcc6-gcc"+CROSS_COMPILE="gcc6-$CROSS_COMPILE"
I'm compiling all kernels in that branch manually to make sure that they work as expected
Then I'll merge it and change the default aportgen code to use GCC8 by default.
Right now, "pmbootstrap aportgen linux-..." creates broken aports that don't work with either GCC6 or GCC8. This is the last important piece to this issue and will be resolved by the following two merge requests:
They only work together and can be used already if somebody wants to create a new linux aport right now.
I'll merge these next monday, if someone wants to they can be reviewed in the meantime. (I'm still operating in this "emergency fix mode" until we are through with this issue, so porting new devices is working again. After that, I'll put my commits up for proper review like everyone else again).
TODO:
test the kernel on the lg-mako
merge both MRs
increase the pmbootstrap and pmaports versions (and their checks), so people don't get additional breakage by only updating one of the repositories
PS: I've tried to do the proof of concept with the i9100 first, but its kernel has problems when not using a different build directory, and I'm spending a lot of time on this issue already so I chose to go with lg-mako.