On Thu, Mar 12, 2020 at 5:11 PM Paul Smith <p...@mad-scientist.net> wrote:
>
> On Wed, 2020-03-11 at 17:15 +0000, Jonathan Wakely wrote:
> > My thinking was to build GCC inside the container, then package up the
> > results and install that on your dev machines (outside a container).
> > But actually that won't work because you'd also need to package the
> > glibc from the container, and at that point you're basically back to
> > using a sysroot.
>
> Yes.  It's actually much simpler to use RPMs for this, and far more
> accurate.  I have a vague memory of trying to extract the necessary files
> from a live system, sometime in the past.  Hopefully I only attempted this
> for a few minutes before realizing that getting the RPMs was a far more
> reliable and efficient way to generate a sysroot :).
>
> Thanks!
>

FWIW, the Docker approach is exactly the approach we use at our
company to build recent GCC versions on CentOS5 in our case. What is
needed indeed are the -static-libgcc / -static-libstdc++ flags. Other
than that, it works perfectly. The binaries we ship run on CentOS5
upwards. These are built within a Docker container as well.

For local development, I sync the CentOS5 sysroot that we build in the
container to my local machine running Arch Linux (others at our
company use Ubuntu, Slackware) and I use that to build our software
outside the container. You need to run `mkheaders` that is bundled
with GCC to make this work but other than that it works perfectly and
has so for many years.

Reply via email to