new versions of gcc on Debian Linux

By: Adrian (a.delete@this.acm.org), September 20, 2022 8:44 pm
Room: Moderated Discussions
Andrey (andrey.semashev.delete@this.gmail.com) on September 20, 2022 9:35 am wrote:
> Adrian (a.delete@this.acm.org) on September 20, 2022 7:23 am wrote:
> > Michael S (already5chosen.delete@this.yahoo.com) on September 20, 2022 2:05 am wrote:
> > > anon2 (anon.delete@this.anon.com) on September 19, 2022 3:51 pm wrote:
> > > > Michael S (already5chosen.delete@this.yahoo.com) on September 19, 2022 2:45 pm wrote:
> > > > > Andrey (andrey.semashev.delete@this.gmail.com) on September 19, 2022 2:08 pm wrote:
> > > > > > Michael S (already5chosen.delete@this.yahoo.com) on September 19, 2022 10:28 am wrote:
> > > > > > > I realize that my question is not quite appropriate for RWT forum, but it
> > > > > > > seems today few knowledgeable posters are bored, so, may be, not too bad.
> > > > > > >
> > > > > > > I want to play with new gcc compilers (any variant of 11 and any variant of 12) on Linux. Normally I play
> > > > > > > with newish gcc on Windows under msys2, but tests I want to run today are specific to system-V AMD64 ABI.
> > > > > > > The most suitable distro that I have access to right now, on most capable machine with
> > > > > > > biggest amount of free space on blazing-fast SSD happens to be Debian 11 (Bullseye).
> > > > > > > Of course I tried to help myself with google, but something is not clicking. All suggestions
> > > > > > > I see are too complicated to my primitive Linux administration skills.
> > > > > > > The one way I likely could manage is building from source. But I can't believe that there is no simpler way.
> > > > > >
> > > > > > You could try installing g++-11 and g++-12 (not g++ - this would replace your default compiler) from Debian
> > > > > > 12 Bookworm. But do note that it will still replace some
> > > > > > gcc libraries with updated versions, which could break
> > > > > > your system. Take note which packages are replaced with
> > > > > > the updated ones so that you can later downgrade them
> > > > > > to restore the system to the previous state.
> > > > >
> > > > >
> > > > > Thank you.
> > > > > Unfortunately, your advice is yet another example of suggestion that is above my skills level.
> > > > >
> > > > > Coming from DOS/Windows background where any compiler is just another application
> > > > > program, I find a tight coupling between C compiler and operation system, that
> > > > > is so common in the Unix world, rather hard to comprehend. And to justify.
> > > > >
> > > > > > However, if the system is valuable, I would recommend setting
> > > > > > up a VM or container with Debian 12 or Ubuntu 22.04 (those have both gcc 11 and 12 in stock repos).
> > > > > >
> > > > >
> > > > > The system is not particularly valuable, but the test that I want
> > > > > to run is also not sufficiently valuable to go that far.
> > > > >
> > > > > More and more it seems that compiling from source is the simplest option.
> > > > > But it's not urgent so I'd wait for more suggestions.
> > > > >
> > > >
> > > > Try add this to /etc/apt/sources.list
> > > >
> > > >
> > > > deb http://deb.debian.org/debian/ unstable main contrib
> > > > deb-src http://deb.debian.org/debian/ unstable main contrib
> > > >

> > > >
> > > >
> > > > Then run these
> > > >
> > > >
> > > > apt-get update
> > > > apt-get -t unstable install gcc-12
> > > >

> > >
> > > Thank you.
> > > It was simple and pretty close to what I wanted.
> > >
> > > So far I observed only one undesirable effect: system-wide
> > > upgrade of binutils from version 2.35.2 to 2.38.90.
> > > On this particular experimental installation it is acceptable, but I still wonder
> > > how can I install newer tools in a way that does not affect "system" at all.
> >
> > I have never used Debian, but in many Linux distributions you can make a directory, mount there /proc, /sys
> > and /dev, chroot into it and install there the same Linux
> > distribution or another one, and also install there
> > whatever packages you want and test them or use them without modifying in any way your base system.
>
> It's not as simple as that. You need /etc, /bin, /usr and /var (at least major parts of them) to
> be able to run shell, basic shell tools like grep/sed/python/etc. and apt, which also requires network
> to work. Since you're going to install packages and you don't want to affect the host system, those
> directories must not be mounts but rather different copies or something like overlayfs.
>
> There is a pbuilder tool (or cowbuilder flavor of it) that prepares an environment image automatically,
> but it is better suited for building packages, not for interactive development.
>


In my experience, it is actually as simple as that.

Maybe there are Linux distributions with weirder requirements, but on all that I have used (I never use systemd), it is enough to do this sequence of commands:


mkdir /home/user/test_dir
cd /home/user/test_dir
mkdir dev etc root proc sys

mount -t proc none proc
mount --rbind /sys sys
mount --rbind /dev dev
cp /etc/resolv.conf etc

env -i HOME=/root TERM=$TERM /bin/chroot . bash -l


Copying resolv.conf from the host Linux system is enough to make networking work.

From the chrooted environment I can install whatever Linux distribution I want, unrelated to the host Linux distribution, and then I can use it. Because I install there another Linux distribution, it will contain everything that is needed, possibly using completely different programs or versions than in the host Linux distribution, e.g. it can be an unstable distribution, while the host can be a stable one.

I do this frequently, when I want to deploy a Linux system on a computer with a weak CPU, e.g. an Intel Atom, but I want to compile all the packages from sources, and I do not want to waste time on the slow target system.

So I make such a directory on my work computer, and I install there a different Linux distribution, and I compile the desired packages with options targeting the other CPU from the intended end system. After all is installed and configured as I like, possibly by using a script to automate the installation and configuration, I can just copy the content of the directory over the SSD or whatever storage device exists in the target computer or computers, if there are more identical systems, and it just works.











< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
new versions of gcc on Debian LinuxMichael S2022/09/19 10:28 AM
  new versions of gcc on Debian LinuxAndrey2022/09/19 02:08 PM
    new versions of gcc on Debian LinuxMichael S2022/09/19 02:45 PM
      new versions of gcc on Debian Linuxanon22022/09/19 03:51 PM
        new versions of gcc on Debian LinuxMichael S2022/09/20 02:05 AM
          new versions of gcc on Debian Linuxanon22022/09/20 02:55 AM
            new versions of gcc on Debian Linuxanon2022/09/20 12:06 PM
          new versions of gcc on Debian Linux-.-2022/09/20 07:02 AM
          new versions of gcc on Debian LinuxAdrian2022/09/20 07:23 AM
            new versions of gcc on Debian LinuxAndrey2022/09/20 09:35 AM
              new versions of gcc on Debian LinuxAdrian2022/09/20 08:44 PM
                new versions of gcc on Debian LinuxAndrey2022/09/21 03:45 AM
                  new versions of gcc on Debian LinuxAdrian2022/09/21 04:42 AM
          new versions of gcc on Debian LinuxMark C2022/09/20 08:15 AM
          new versions of gcc on Debian LinuxAndrey2022/09/20 09:46 AM
          new versions of gcc on Debian Linuxgoose2022/09/20 11:36 PM
      new versions of gcc on Debian LinuxAndrey2022/09/20 09:54 AM
        new versions of gcc on Debian Linuxnone2022/09/20 10:30 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? ūüćä