Skip to contentSkip to conversation

How to control host gcc version?

Buildroot Grant Edwards 2 participants 5 messages Sep 10, 2024

lore
Share & tools
lore
#0 lore raw

I'm trying to build a root filesystem using a vendor-supplied copy of buildroot 2020.02.07.

Unfortunately, some of the packages that buildroot wants to build for the host (e.g. m4) are so old they won't compile with my host's version of gcc (13.3). [I've got m4 installed on the host, but buildroot still wants to build its own.]

I can install older versions of gcc, but I can't figure out how to tell buildroot what host toolchain to use. There must be an option for that, but I've been searching through the manual and haven't found it.

How do I tell buildroot what host gcc to use (e.g. 'gcc-11' instead of 'gcc')?

--
Grant

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw
Quoted 2 lines · Grant Edwards

How do I tell buildroot what host gcc to use (e.g. 'gcc-11' instead of 'gcc')?

Ah, found it:

8.6. Environment variables

Buildroot also honors some environment variables, when they are passed to make or set in the environment:

HOSTCXX, the host C++ compiler to use

HOSTCC, the host C compiler to use

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 10 lines · On Tue, 10 Sep 2024 19:10:29 -0000 (UTC) Grant Edwards…

Ah, found it:

8.6. Environment variables

Buildroot also honors some environment variables, when they are passed to make or set in the environment:

HOSTCXX, the host C++ compiler to use

HOSTCC, the host C compiler to use

Indeed. But in your case, what you probably should do is use a Docker container. You can use the utils/docker-run script to easily run the build in a docker container.

Basically do:

./utils/docker-run make

and it will do the Buildroot build in our "reference" Debian bullseye Docker container. If you're not happy with this container, you can do:

IMAGE=<your-docker-image> ./utils/docker-run make

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 16 lines · Thomas Petazzoni via buildroot
Quoted 9 lines · On Tue, 10 Sep 2024 19:10:29 -0000 (UTC) Grant Edwards…

Ah, found it:

8.6. Environment variables

Buildroot also honors some environment variables, when they are passed to make or set in the environment:

HOSTCXX, the host C++ compiler to use
HOSTCC, the host C compiler to use

Indeed. But in your case, what you probably should do is use a Docker container. You can use the utils/docker-run script to easily run the build in a docker container.

Quoted 6 lines

Basically do:

./utils/docker-run make

and it will do the Buildroot build in our "reference" Debian bullseye Docker container.

Thanks! I'll definitely take a look at that. I don't currently have my development hosts set up with docker support, but it's looking like we're probably headed that way for other projects too.

Quoted 3 lines

If you're not happy with this container, you can do:

IMAGE=<your-docker-image> ./utils/docker-run make

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 7 lines · Thomas Petazzoni via buildroot
Quoted 4 lines · On Tue, 10 Sep 2024 19:10:29 -0000 (UTC) Grant Edwards…

[...]

HOSTCXX, the host C++ compiler to use
HOSTCC, the host C compiler to use

Quoted 7 lines

Indeed. But in your case, what you probably should do is use a Docker container. You can use the utils/docker-run script to easily run the build in a docker container.

Basically do:

./utils/docker-run make

It looks like 2020.02.7 doesn't have a docker-run.

It turns out it's not the gcc version that's "too new", it's the glibc version that's "too new", and Gentoo doesn't support having multiple versions of that installed. :)

I'm going to have to manually upgrade buildroot's m4 package from 4.18 to 4.19.

Once I get the vendor "supported" buildroot configuration built and running, I'll look into upgrading to a newer version of buildroot -- perhaps one with a refrence docker image for building it.

--
Grant

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot