Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Compiling the gcc-9_9.2.1 Sid package

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
poddingue
Posts: 6
Joined: 2019-11-07 12:26

Compiling the gcc-9_9.2.1 Sid package

#1 Post by poddingue »

Hi there,

I have an ARM machine (based on the RK3399 SoC) with a version of Debian Stretch.

Code: Select all

linaro@captation-techforum-rk3399-4GB:~$ cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Code: Select all

linaro@captation-techforum-rk3399-4GB:~$ uname -m
aarch64

Code: Select all

linaro@captation-techforum-rk3399-4GB:~$ dpkg --print-architecture
armhf

Code: Select all

linaro@captation-techforum-rk3399-4GB:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
As I'm trying to compile recent versions of softwares on it, I have to upgrade some of the packages by recompiling them on the machine, starting from Sid source packages (silly, I know).
Anyway, most of the times, everything is going well, but when I decided to tackle with gcc gcc-9_9.2.1, that did not go well.
I am able to compile gcc-9.2.0 source code on this machine, but as for doing it the debian way, I'm lost.
Most of the time, I just use

Code: Select all

sudo -E dpkg-buildpackage -us -uc -d
and it just works. Sometimes, I have to do a

Code: Select all

dpkg-source --commit
because of some requirements not up to the task, or to add specific cflags...
But this time, I get the suggestion to do the commit again and again and again, and for sure, there must be another way of compiling and packaging gcc on my machine.

Any idea?

Thanks a lot.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiling the gcc-9_9.2.1 Sid package

#2 Post by stevepusser »

Hmmm---I'm pretty sure that you first have to build an early Debian gcc-7 from snapshot.debian.org, then use that to build a later version of gcc-7 from snapshots that meets the build-depends of an early version of gcc-8 from snapshots, then possibly use that gcc-8 to build the current version of gcc-8 in Buster. I did do that over a few days for i386 and amd64 MX Linux backports, but I also disabled the self-tests for each build, because they took many more times longer than just the compiling. http://mxrepo.com/mx/experimental/pool/test/g/ I've used gcc-8 since then to build MX backport packages that required it to build, such as the current telegram-desktop from Sid on a Stretch base.

Unfortunately, I didn't also build arm versions while I was doing that, mainly because I could not get non-x86 cross compiling to work in pbuilder or sbuild at that time (I do have it working now).

Anyway, I'm guessing that you'll have to repeat the same procedure for earlier versions of gcc-9 using gcc-8 to build, and current upstream versions then using those gcc-9s to build. I don't know how fast your machine is, but it is quite a job. You might get the OBS to build each version for you, then hook the repos in a chain so each can use the older gcc for the next build, but I've never done that on that platform. The OBS will build arm packages--their armv71 is Debian's armhf, and aarch64 is arm64...I just uploaded Sid's new Chromium on it for Buster builds, which should take hours and hours there. https://build.opensuse.org/package/show ... m/chromium

If you could start from Buster instead of Stretch somehow, that would eliminate a lot of the work.
MX Linux packager and developer

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiling the gcc-9_9.2.1 Sid package

#3 Post by stevepusser »

Also, I also backport lots of packages from Sid to a Stretch base for MX Linux, and haven't encountered one yet that required gcc-9, and only a few that required gcc-8.

For those, it may also be possible to use the clang compiler instead, which is a lot easier to backport, though it takes quite a while. I've managed to backport clang-8/the llvm-8 toolchain to Stretch without too much trouble.
MX Linux packager and developer

poddingue
Posts: 6
Joined: 2019-11-07 12:26

Re: Compiling the gcc-9_9.2.1 Sid package

#4 Post by poddingue »

Thanks a lot for these detailed answers.
I will try to go the way you indicated.

Unfortunately, I cant upgrade to Buster, because I'm stuck with the distribution the manufacturer gave (such a pain in the neck to flash the image onto this device!).
Anyway... Do you know if there is a "standard" procedure to build on Stretch all the installed packages from Buster sources, so that I could upgrade to Buster with the packages built on this very machine?
Or even for Sid?
I guess the wildest part would be knowing which comes first...

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiling the gcc-9_9.2.1 Sid package

#5 Post by stevepusser »

If it's a form of Debian on that machine, it might be possible to upgrade in-place to Buster, though it's better if you get the system first in a state as close to vanilla Debian as possible, and it becomes more difficult if it's a derivative with its own separate repositories.
MX Linux packager and developer

poddingue
Posts: 6
Joined: 2019-11-07 12:26

Re: Compiling the gcc-9_9.2.1 Sid package

#6 Post by poddingue »

So I managed to compile GCC 9.2.0, but now, I'd like to compile and install the Debian GCC 9.2.1 package.

Code: Select all

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/9.2.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../gcc-9.2.0/configure --enable-languages=c,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 9.2.0 (GCC)
What are the commands to enter?

Code: Select all

    sudo -E dpkg-buildpackage -us -uc -d
won't work because it can't find gmp mpc and mpfr, but if I add them to the directory, I get

Code: Select all

dpkg-source: info: you can integrate the local changes with dpkg-source --commit
dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/gcc-9_9.2.1-17.diff.P9iu4C
dpkg-buildpackage: error: dpkg-source -b gcc-9-9.2.1 gave error exit status 2
So... What is the way of building this package, by supplying the mpc and so on locations to configure?

Thanks.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiling the gcc-9_9.2.1 Sid package

#7 Post by stevepusser »

You'll have to learn to backport Debian packages first, and the version in Sid also requires you to have a backport of an earlier Debian gcc-9 available in order to build it.

It's a long and difficult process to do so, which is probably why the MX Stretch repos have the only Debian Stretch packages of gcc-7 and gcc-8 that I've been able to find. They don't include the earlier builds of gcc-7 and gcc-8 I had to use to build those--like Debian, I had to pull the ladder up after me after I climbed up there.

Again, what code exactly demands that you have gcc-9?
Last edited by stevepusser on 2019-11-14 20:46, edited 1 time in total.
MX Linux packager and developer

poddingue
Posts: 6
Joined: 2019-11-07 12:26

Re: Compiling the gcc-9_9.2.1 Sid package

#8 Post by poddingue »

My, oh my! :shock:
Thanks for being that patient with me, Steve.
I got it, I'm very very far from succeeding in compiling the latest gcc for Sid on Stretch.

No other software demands the latest gcc, but some of the issues I was facing with ffmpeg compilation for example have gone since I compiled/installed the 9.2.0.

I am a day dreamer and wanted to upgrade my stretch distro with a Sid one, one package at a time, as Sid does not exist for my machine.

User avatar
sunrat
Administrator
Administrator
Posts: 6474
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 474 times

Re: Compiling the gcc-9_9.2.1 Sid package

#9 Post by sunrat »

poddingue wrote:I am a day dreamer and wanted to upgrade my stretch distro with a Sid one, one package at a time, as Sid does not exist for my machine.
If you want Sid you should just install it as described in the wiki - https://wiki.debian.org/DebianUnstable#Installation
Doing it one package at a time sounds like a Very Bad Idea.
To convert your current Stretch system, first make a full system backup so you can recover if it doesn't work correctly. That should take ~5 minutes. Then change the sources to "unstable" and do

Code: Select all

apt update && apt full-upgrade
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

poddingue
Posts: 6
Joined: 2019-11-07 12:26

Re: Compiling the gcc-9_9.2.1 Sid package

#10 Post by poddingue »

I upgraded and everything went fine, thanks.
Now, I will recompile the packages I need to hopefully get better use of the processor features.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiling the gcc-9_9.2.1 Sid package

#11 Post by stevepusser »

I backported the latest ffmpeg 4.2.1 to a Stretch base for MX 17 Linux without much difficulty using the stock gcc-6, so gcc is not the problem. Debian patches many packages to fix build issues on non-x86 architectures, so you might be missing out on those. I think you should read this: http://forums.debian.net/viewtopic.php?t=38976

MX ffmpegs: http://mxrepo.com/mx/testrepo/pool/test/f/ffmpeg/

It still holds true, though we're up to Debian 10 now, so some of the versioning has changed. I also have managed to get pbuilder and sbuild working for my package builds, so I can build my packages in "clean room" chroot environments, and convert those from vanilla Debian to MX Linux or back again in a few seconds, just by adding or removing repos from those chroots. I also have armhf and arm64 cross-compiling builds working for pbuilder and sbuilds, finally, so if you have a really fast x86 machine, you can use that to build packages for your slower ARM devices.
MX Linux packager and developer

poddingue
Posts: 6
Joined: 2019-11-07 12:26

Re: Compiling the gcc-9_9.2.1 Sid package

#12 Post by poddingue »

Thanks.

Post Reply