Skip to content

Conversation

RyanHir
Copy link
Contributor

@RyanHir RyanHir commented Aug 30, 2020

The compiler given in the raspberrypi/tools are fairly old and all the supported versions of Ubuntu and Debian have either the supported version or newer of the compiler offered before.

This can be seen at here for Ubuntu 16.04 and here for Debian Stretch. Both of which is the oldest supported versions of their respective distro.

While this is not essential, I think that this will help get users setup quicker as it already has the proper paths set.

@lurch
Copy link
Contributor

lurch commented Sep 1, 2020

ping @pelwell

@pelwell
Copy link
Contributor

pelwell commented Sep 1, 2020

It seems to work, but we should probably retain the old method for platforms that aren't Debian-based.

Any concerns, @popcornmix?

@popcornmix
Copy link
Contributor

I think this makes sense. The standard repo toolchains will work just fine (and in fact are required for aarch64 builds).

@pelwell
Copy link
Contributor

pelwell commented Sep 1, 2020

The rest of the instructions assume apt, so I withdraw the request to not delete the previous version.

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 1, 2020

The other thing is the documentaton specifically says that it uses Ubuntu and already uses APT so perhaps if we dont want to use the repo tools then we should also change the other instructions or move to a container like build to have a common environment.

While I personally like the idea of using Docker or Podman, i dont think most people wont so for the time being I think we should continue to target Ubuntu (and Debian derivatives)

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 1, 2020

And in the case we do want to add support for other distros such as Fedora or Arch. I would not expect it to be that much of a problem to have distro specific instructions as most of the build is distro agnostic.

```bash
echo PATH=\$PATH:~/tools/arm-bcm2708/arm-linux-gnueabihf/bin >> ~/.bashrc
source ~/.bashrc
```
If you are using a 32-bit operating system (for example, our Raspberry Pi Desktop for PC), then you may need to install an additional set of libraries:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the above-mentioned cross-compilers available in "Raspberry Pi Desktop for PC" ? If they are, does that mean the additional zlib1g-dev:amd64 mentioned below isn't needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that the compilers are in the 32bit repo's as seen here https://packages.debian.org/stretch/i386/gcc-arm-linux-gnueabihf/download and after spinning up a vm the tools are there when needed. I am not familiar with zlib1g so I will leave that up to @native-api as he appears to be knowledgeable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i took another look at the dependencies and it appears that zlib1g is required when pulling the cross compiler as seen here.

My only concern is that when installing on a 32bit platform it will install the 32bit version of zib1g so for some unknown reason that the amd64 version is required i think that could be a bug with the build system? i am grasping at straws at this point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting so much faith in me but I've never compiled the Pi kernel with 32-bit tools :-)
All my knowledge comes from diagnosing the problem that I've linked to in my PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the zlib1g-dev:amd64 was only needed on the "32-bit Raspberry Pi Desktop for PC" because the compiler-tools being installed from the tools-repo were themselves actually 64-bit (and so needed the 64-bit zlib). See #1413

But as the compiler-tools (installed from the repo) will now be 32-bit, then the compilers will only need the 32-bit zlib.

At least, that's the way I understand it, but @pelwell and @XECDesign probably understand it better than I do!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the clarification! That makes the most sense!

@lurch
Copy link
Contributor

lurch commented Sep 1, 2020

ping @native-api I think this PR might mean that the CCache instructions (added in #1630 ) could be removed too?

@native-api
Copy link
Contributor

@lurch Yes, Apt packages use tarballs under the hood to hold files which preserve timestamps upon restore. So the CCache workaround would no longer be needed if Apt packages are used instead of a Git checkout.

@native-api
Copy link
Contributor

@lurch I would still double-check though. It's possible that the packages create something on the fly (like symlinks) in the postinstall step which may or may not have the same timestamps and/or confuse Ccache.

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 1, 2020

I would like to confirm @native-api findings as when i install the compiler on my Debian Sid installation i get a binary that was modified days ago not minutes. So i have reason to believe that ccache will not complain.

ryan@think:~$ ls -l $(whereis arm-linux-gnueabihf-gcc | awk '{print $2}')
lrwxrwxrwx 1 root root 26 Jul 21 09:16 /usr/bin/arm-linux-gnueabihf-gcc -> arm-linux-gnueabihf-gcc-10

Copy link
Contributor Author

@RyanHir RyanHir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this change removes some packages from the first pull and allow the meta-package for cross compiling to pull the packages via the --install-recommends.

@lurch
Copy link
Contributor

lurch commented Sep 3, 2020

Is there any guarantee that --install-recommends will always install all the packages needed? Might be better to be explicit? 🤷

@lurch
Copy link
Contributor

lurch commented Sep 3, 2020

Also, do you want to remove the ccache parts?

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 3, 2020

--install-recommends will work unless the maintainer removes the package from the meta-package so maybe that should be revisited.

i have left the ccache part as I was not sure what was wanted, but i presume it is not needed anymore as we have confirmed the binaries hold their timestamp. I will work on that now.

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 3, 2020

Would there be benifit by using the build-essential meta-package as it is quite static and contains libc6-dev, make, and the host platform compilers which will be needed for menuconfig which is talked about later.

A new debian or ubuntu install will not contain the host gcc and the meta package will only install the target gcc. With this configuration then the instructions at https://github.com/raspberrypi/documentation/blob/master/linux/kernel/configuring.md are missing information.

@lurch
Copy link
Contributor

lurch commented Sep 3, 2020

Hmmm, now that the "Install toolchain" section is just sudo apt install crossbuild-essential-armhf it probably makes sense to just include that in the "Install required dependencies" section? (i.e. append crossbuild-essential-armhf to the end of the other "apt install" line)

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 3, 2020

Looking at it, i will agree it would just be better to be all one command

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 4, 2020

Would there be benefit for adding a note for non Debian/Ubuntu users about what minimum version of the cross compiler that they should install?

@lurch
Copy link
Contributor

lurch commented Sep 4, 2020

The page already talks about running Ubuntu inside a VM, so probably not any need for non Debian/Ubuntu instructions? 🤷

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 4, 2020

perhaps but the instructions are almost completly distro agnostic, if we just gave a list of generic packages like...

 * git
 * bc
 * bison
 * flex
 * gcc-armhf >= 4.9.5

for those who have like a alpine build server of sorts. This is kinda far fetched so if it was wanted then i guess another pull request will do. might as well keep this PR clean.

@lurch
Copy link
Contributor

lurch commented Sep 4, 2020

The more detailed the documentation is (e.g. listing specific versions of specific packages), the more of a maintenance burden it becomes if / when it has to change 😉

I suspect somebody setting up an Alpine Linux build server will already have the technical know-how to convert the Ubuntu instructions to their distro of choice?

@RyanHir
Copy link
Contributor Author

RyanHir commented Sep 7, 2020

I presume so :D

@naushir
Copy link
Contributor

naushir commented Sep 10, 2020

These changes to the instructions are needed for the 5.9 kernel tree, otherwise the build complains about using an old compiler. It probably ought to be merged as soon as possible.

@JamesH65
Copy link
Contributor

Going to merge this, think it makes sense as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants