Closed jessicarod7 closed 9 months ago
Incidentally there is a GitHub action that provides compiled toolchains: https://github.com/koreader/koxtoolchain/releases/tag/2021.12 That's not an objection, but I am curious what about that you found lacking. :-)
Mainly to make it easier to use on Windows and Mac, where running the toolchain is a bit harder.
I don't do containers, so this is all Greek to me ;).
Mainly to make it easier to use on Windows and Mac, where running the toolchain is a bit harder.
That somewhat ties in with my other question relating to the full images which include everything including the tc.
Anyway, did you want to rebase it into a few tidier commits or shall I just squash it all?
I also don't have much container experience/interest, but what is the advantage over our existing docker images? They also have the toolchain in a container. And if there is an advantage, should we use these instead?
I also don't have much container experience/interest, but what is the advantage over our existing docker images? They also have the toolchain in a container. And if there is an advantage, should we use these instead?
The way I interpret this is for using the tc outside of KOReader development… although realistically I'd say they don't have all that much extra baggage compared to what you'd stick in a generic development image anyway, give or take some extra LuaRocks stuff. build-essential, git, autoconf, etc., you want those anyway.
And if there is an advantage, should we use these instead?
There could potentially be an advantage to using something like as a base layer instead of compiling them in as an additional layer, but I'm inclined to think it's a difference without distinction.
Mainly to make it easier to use on Windows and Mac, where running the toolchain is a bit harder.
That somewhat ties in with my other question relating to the full images which include everything including the tc.
@Frenzie I had noticed that warning at the bottom about needing to use the crosstool-ng suggestions for macOS, and more challenges on Windows. Especially with the switch to Apple Silicon, I figured having the container with the necessary components would be simpler for users than setting up a VM.
Anyway, did you want to rebase it into a few tidier commits or shall I just squash it all?
Yeah, I can squash the commits. There were a couple permissions issues I realized weren't working properly so I just adjusted those last night.
The way I interpret this is for using the tc outside of KOReader development… although realistically I'd say they don't have all that much extra baggage compared to what you'd stick in a generic development image anyway, give or take some extra LuaRocks stuff. build-essential, git, autoconf, etc., you want those anyway.
This was my main inspiration, I was experimenting with cross-compiling for my Kobo. I was using Fedora so the largest difference was package names, and I put this together to make the process easier for myself.
The container also includes build-essentials and the other dependencies, so they're still available for the user (plus root access if additional packages are needed).
And if there is an advantage, should we use these instead?
There could potentially be an advantage to using something like as a base layer instead of compiling them in as an additional layer, but I'm inclined to think it's a difference without distinction.
I'm not familiar with the KOReader development process, but I don't think it would be a significant benefit there. There are some odd configs I've had to make (like entrypoint.sh) which work well enough for interactive use but would probably break in a CI.
Okay, but the point is https://github.com/koreader/virdevenv already exists and this is redundant. ;-)
@Frenzie I had noticed that warning at the bottom about needing to use the crosstool-ng suggestions for macOS, and more challenges on Windows. Especially with the switch to Apple Silicon, I figured having the container with the necessary components would be simpler for users than setting up a VM.
That is, this can be solved by a minor adjustment to that text down there. And Docker is a VM on Mac and Windows.
@cam-rod I think they're being OOM-killed maybe? https://github.com/koreader/koxtoolchain/actions/runs/7679060826/job/20929563935
Okay, but the point is https://github.com/koreader/virdevenv already exists and this is redundant. ;-)
That is, this can be solved by a minor adjustment to that text down there. And Docker is a VM on Mac and Windows.
Ah, I wasn't aware of that repo, thanks for pointing it out. If it makes more sense, I can add a couple notes pointing people to the other repo and how to use it for cross-compiling other apps.
@cam-rod I think they're being OOM-killed maybe? https://github.com/koreader/koxtoolchain/actions/runs/7679060826/job/20929563935
Actually it seems to be a GCC/C++17 error? Trimmed logs:
2024-01-27T14:03:52.4348862Z [ERROR] /home/runner/work/koxtoolchain/koxtoolchain/build/nickel/.build/arm-nickel-linux-gnueabihf/src/gcc/gcc/reload1.c:89:24: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
2024-01-27T14:03:52.6724405Z [ERROR] make[2]: *** [Makefile:1061: reload1.o] Error 1
2024-01-27T14:03:52.6725590Z [ERROR] make[2]: *** Waiting for unfinished jobs....
2024-01-27T14:03:54.1655900Z [ERROR] make[1]: *** [Makefile:3952: all-gcc] Error 2
2024-01-27T14:03:54.1699251Z [ERROR] >>
2024-01-27T14:03:54.1710790Z [ERROR] >> Build failed in step 'Installing pass-1 core C gcc compiler'
2024-01-27T14:03:54.1721427Z [ERROR] >> called in step '(top-level)'
2024-01-27T14:03:54.1731674Z [ERROR] >>
2024-01-27T14:03:54.1743237Z [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@376]
2024-01-27T14:03:54.1754273Z [ERROR] >> called from: do_gcc_core_backend[scripts/build/cc/gcc.sh@745]
2024-01-27T14:03:54.1765815Z [ERROR] >> called from: do_cc_core_pass_1[scripts/build/cc/gcc.sh@209]
2024-01-27T14:03:54.1777071Z [ERROR] >> called from: main[scripts/crosstool-NG.sh@707]
2024-01-27T14:03:54.1799110Z [ERROR] >>
2024-01-27T14:03:54.1813023Z [ERROR] >> For more info on this error, look at the file: 'build.log'
2024-01-27T14:03:54.1825421Z [ERROR] >> There is a list of known issues, some with workarounds, in:
2024-01-27T14:03:54.1838517Z [ERROR] >> https://crosstool-ng.github.io/docs/known-issues/
2024-01-27T14:03:54.1851510Z [ERROR] >>
2024-01-27T14:03:54.1864793Z [ERROR] >> NOTE: Your configuration includes features marked EXPERIMENTAL.
2024-01-27T14:03:54.1877909Z [ERROR] >> Before submitting a bug report, try to reproduce it without enabling
2024-01-27T14:03:54.1891275Z [ERROR] >> any experimental features. Otherwise, you'll need to debug it
2024-01-27T14:03:54.1904460Z [ERROR] >> and present an explanation why it is a bug in crosstool-NG - or
2024-01-27T14:03:54.1916604Z [ERROR] >> preferably, a fix.
2024-01-27T14:03:54.1929460Z [ERROR] >>
2024-01-27T14:03:54.1942424Z [ERROR] >> If you feel this is a bug in crosstool-NG, report it at:
2024-01-27T14:03:54.1955465Z [ERROR] >> https://github.com/crosstool-ng/crosstool-ng/issues/
2024-01-27T14:03:54.1967525Z [ERROR] >>
2024-01-27T14:03:54.1980590Z [ERROR] >> Make sure your report includes all the information pertinent to this issue.
2024-01-27T14:03:54.1993336Z [ERROR] >> Read the bug reporting guidelines here:
2024-01-27T14:03:54.2006924Z [ERROR] >> http://crosstool-ng.github.io/support/
2024-01-27T14:03:54.2018679Z [ERROR]
2024-01-27T14:03:54.2096578Z [ERROR] (elapsed: 8:30.74)
2024-01-27T14:03:54.2096915Z
2024-01-27T14:03:54.2116844Z gmake: *** [/home/runner/work/koxtoolchain/koxtoolchain/build/CT_NG_BUILD/bin/ct-ng:261: build] Error 2
2024-01-27T14:03:54.2123800Z [08:32] /
2024-01-27T14:03:54.2141572Z ##[error]Process completed with exit code 2.
2024-01-27T14:03:54.2227276Z Post job cleanup.
2024-01-27T14:03:54.3273552Z [command]/usr/bin/git version
2024-01-27T14:03:54.3330170Z git version 2.43.0
2024-01-27T14:03:54.3371655Z Temporarily overriding HOME='/home/runner/work/_temp/eff2ff97-5b10-41bd-9298-97dc4ad8f8e2' before making global git config changes
2024-01-27T14:03:54.3372765Z Adding repository directory to the temporary git global config as a safe directory
2024-01-27T14:03:54.3376960Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/koxtoolchain/koxtoolchain
2024-01-27T14:03:54.3420519Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2024-01-27T14:03:54.3464079Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2024-01-27T14:03:54.3716230Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2024-01-27T14:03:54.3750380Z http.https://github.com/.extraheader
2024-01-27T14:03:54.3760213Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2024-01-27T14:03:54.3801253Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2024-01-27T14:03:54.4331492Z Cleaning up orphan processes
It only affects the nickel
build - I can also see the failure in my local container build, but gen-tc.sh
didn't check the exit code so it failed silently. Crosstool added a flag in 1.26 (crosstool-ng/crosstool-ng#1551) to set the C++ version.
Ah, I wasn't aware of that repo, thanks for pointing it out. If it makes more sense, I can add a couple notes pointing people to the other repo and how to use it for cross-compiling other apps.
Ah, well, I'm fine reverting this in favor of a note, probably easier to maintain anyway. But I do appreciate the effort. 👍
alright np, I'll open a PR for that when I get the change
Yeah, the nickel TC is very very finicky ;).
And there are already containerized variants of it
This compiles each of the toolchains into a container image, and then uploads them to ghcr.io. It's a bit simpler than needing to install the dependencies and compile the toolchain, which can take a while.
I've successfully cross-compiled and ran a program on my Kobo. The workflow-generated images from those tests are in this package. If this PR gets merged, the Action can be manually dispatched to create a package owned by
koreader
, and would automatically run on future releases.This change is