swampdog
Posts: 379
Joined: Fri Dec 04, 2015 11:22 am

Re: New major release of GCC

Wed Jun 03, 2020 9:58 am

ejolson wrote:
Thu May 28, 2020 8:33 pm
swampdog wrote:
Thu May 28, 2020 7:56 pm
How times have changed. My first PC was one of those "sticklebrick" air cooled pentium pro dual core cpu's with a huge 256Mb of ram.
Do you still have the Pentium Pro?
I think so. It hasn't been fired up in years and its under a pile of junk. Hopefully it's not rusted because I kept it to reuse the case one day.

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Tue Jun 09, 2020 5:49 pm

jahboater wrote:
Thu May 28, 2020 8:16 pm
I wonder if the build could be done in a ramdisk on an 8GB Pi4 ?
Has anyone tried this yet? My Pi 4 8GB just arrived today (only 5 days late not bad). And was wondering if anyone gave this a go?

jahboater
Posts: 5671
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Tue Jun 09, 2020 5:52 pm

DarkElvenAngel wrote:
Tue Jun 09, 2020 5:49 pm
jahboater wrote:
Thu May 28, 2020 8:16 pm
I wonder if the build could be done in a ramdisk on an 8GB Pi4 ?
Has anyone tried this yet? My Pi 4 8GB just arrived today (only 5 days late not bad). And was wondering if anyone gave this a go?
I tried and it failed.
On my 16GB x86 PC I always do the build in a ramdisk and it works fine - in about 20 mins!
8GB on the Pi is just too small. I tried a 6GB and a 7GB ramdisk.
Pi4 8GB running PIOS64

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Tue Jun 09, 2020 6:27 pm

jahboater wrote:
Tue Jun 09, 2020 5:52 pm
DarkElvenAngel wrote:
Tue Jun 09, 2020 5:49 pm
jahboater wrote:
Thu May 28, 2020 8:16 pm
I wonder if the build could be done in a ramdisk on an 8GB Pi4 ?
Has anyone tried this yet? My Pi 4 8GB just arrived today (only 5 days late not bad). And was wondering if anyone gave this a go?
I tried and it failed.
On my 16GB x86 PC I always do the build in a ramdisk and it works fine - in about 20 mins!
8GB on the Pi is just too small. I tried a 6GB and a 7GB ramdisk.
Would it work if only the build directory were on the RAM disk? Since no writing ever happens to the source tree, this could still be much faster.

Off topic but PM's are disabled. Since you have the 8GB model, would you mind checking whether it's possible to boot from an extra boot partition while the SD card is in 50 MB/sec mode using

$ sudo systemctl reboot N

where N is a single digit indicating the partition number of the partition you want to boot from?

To check this, it is enough to follow the first 5 or so posts in the thread

viewtopic.php?f=36&t=274553

and verify whether

sdhci.debug_quirks2=4

is required in cmdline.txt or not. Please be careful with the links to Fraggle Rock as they might take the entire day.

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Tue Jun 09, 2020 11:32 pm

The results are in

Code: Select all


real	239m4.187s
user	717m49.018s
sys	73m17.924s

tmpfs           5.0G  4.4G  700M  87% /home/pi/gcc-10.1.0/obj
              total        used        free      shared  buff/cache   available
Mem:          7.7Gi       340Mi       2.3Gi       4.4Gi       5.1Gi       2.7Gi
Swap:          99Mi          0B        99Mi
I did the build with c c++ and fortran

No over clock and I had my Argon One case set the fan to 50% for the entire compile time temp topped out at 46.

I'm not sure how to interrupt the output of time in this case.

jahboater
Posts: 5671
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Wed Jun 10, 2020 12:19 am

Code: Select all

real	239m4.187s
user	717m49.018s
sys	73m17.924s
Is that right?
The elapsed time is less than the user CPU time?
Pi4 8GB running PIOS64

plugwash
Forum Moderator
Forum Moderator
Posts: 3601
Joined: Wed Dec 28, 2011 11:45 pm

Re: New major release of GCC

Wed Jun 10, 2020 12:54 am

Perfectly normal if you have more than one CPU core.

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Wed Jun 10, 2020 2:34 am

jahboater wrote:

Code: Select all

real	239m4.187s
user	717m49.018s
sys	73m17.924s
Is that right?
The elapsed time is less than the user CPU time?
Sure hope so. I would have thought it would be faster. If I read it right it took just about 4 hours?

So my first time through on my Pi 4 4G was about 7h with the same as card and setting. 3 hours saved if I read the output properly.

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Wed Jun 10, 2020 3:39 am

DarkElvenAngel wrote:
Wed Jun 10, 2020 2:34 am
jahboater wrote:

Code: Select all

real	239m4.187s
user	717m49.018s
sys	73m17.924s
Is that right?
The elapsed time is less than the user CPU time?
Sure hope so. I would have thought it would be faster. If I read it right it took just about 4 hours?

So my first time through on my Pi 4 4G was about 7h with the same as card and setting. 3 hours saved if I read the output properly.
It seems the 8GB Pi takes 12 minutes longer compared to the 2GB model

viewtopic.php?f=33&t=273441#p1657703

and 29 minutes longer compared to the 4GB model

viewtopic.php?f=33&t=273441&start=25#p1657716

Could the extra time be part of the 64-bit advantage?

It took over 12 hours here for a 64-bit build using make -j8 on a non-Pi 8-core single-board computer, mostly because the poor thing started thrashing swap and ran at about 3% CPU much of the time.

Are you able to use UTF-8 identifiers on your new gcc installation? I'm having trouble with the example in the release notes on mine. Do I need to set a build or compile option?

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Wed Jun 10, 2020 4:35 am

ejolson wrote:
Wed Jun 10, 2020 3:39 am
DarkElvenAngel wrote:
Wed Jun 10, 2020 2:34 am
jahboater wrote:

Code: Select all

real	239m4.187s
user	717m49.018s
sys	73m17.924s
Is that right?
The elapsed time is less than the user CPU time?
Sure hope so. I would have thought it would be faster. If I read it right it took just about 4 hours?

So my first time through on my Pi 4 4G was about 7h with the same as card and setting. 3 hours saved if I read the output properly.
It seems the 8GB Pi takes 12 minutes longer compared to the 2GB model

viewtopic.php?f=33&t=273441#p1657703

and 29 minutes longer compared to the 4GB model

viewtopic.php?f=33&t=273441&start=25#p1657716

Could the extra time be part of the 64-bit advantage?

It took over 12 hours here for a 64-bit build using make -j8 on a non-Pi 8-core single-board computer, mostly because the poor thing started thrashing swap and ran at about 3% CPU much of the time.

Are you able to use UTF-8 identifiers on your new gcc installation? I'm having trouble with the example in the release notes on mine. Do I need to set a build or compile option?
I'm running 32 bit also my build output was to a ram disk. I have not tried UTF-8 I did try out the code analyzer that's a nice feature.

jahboater
Posts: 5671
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Wed Jun 10, 2020 8:12 am

ejolson wrote:
Tue Jun 09, 2020 6:27 pm

To check this, it is enough to follow the first 5 or so posts in the thread

viewtopic.php?f=36&t=274553
If you can precise all that stuff it into a short set of instructions I can...
I have a spare SD card.
Pi4 8GB running PIOS64

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Wed Jun 10, 2020 3:30 pm

jahboater wrote:
Wed Jun 10, 2020 8:12 am
ejolson wrote:
Tue Jun 09, 2020 6:27 pm

To check this, it is enough to follow the first 5 or so posts in the thread

viewtopic.php?f=36&t=274553
If you can precise all that stuff it into a short set of instructions I can...
I have a spare SD card.
Thanks, I post a link to a short set of instructions to this thread later.

Have you managed to use any UTF-8 identifiers with version 10.1 of gcc? I am still having trouble with that.

jahboater
Posts: 5671
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Wed Jun 10, 2020 3:46 pm

ejolson wrote:
Wed Jun 10, 2020 3:30 pm
Have you managed to use any UTF-8 identifiers with version 10.1 of gcc? I am still having trouble with that.
No, sorry I have not tried.
I'll stick with 7-bit ASCII ........
Pi4 8GB running PIOS64

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Wed Jun 10, 2020 6:30 pm

jahboater wrote:
Wed Jun 10, 2020 3:46 pm
ejolson wrote:
Wed Jun 10, 2020 3:30 pm
Have you managed to use any UTF-8 identifiers with version 10.1 of gcc? I am still having trouble with that.
No, sorry I have not tried.
I'll stick with 7-bit ASCII ........
That sounds reasonable. It seems I was accidentally calling the system compiler rather than the newly installed gcc. Now that the correct compiler is used, with no further options I can compile and run

Code: Select all

#include <stdio.h>

static const int π = 3;
int get_naïve_pi() {
  return π;
}

int main(){
    printf("pi = %d\n",get_naïve_pi());
    return 0;
}
and obtain the output

Code: Select all

$ ./a.out
pi = 3
as well as

Code: Select all

#include <stdio.h>

int main(){
    int aaa=1;
    int аaa=2;
    int aаa=3;
    printf("aaa=%d\n",aaa);
    printf("аaa=%d\n",аaa);
    printf("aаa=%d\n",aаa);
    return 0;
}
and obtain the output

Code: Select all

$ ./a.out
aaa=1
аaa=2
aаa=3
Now to check how to turn it off. Also, is there a way to configure vim to highlight all non-ASCII characters?

User avatar
PeterO
Posts: 5828
Joined: Sun Jul 22, 2012 4:14 pm

Re: New major release of GCC

Wed Jun 10, 2020 6:40 pm

Had to resort to "hexdump -C" to find the Unicode Characters 'CYRILLIC SMALL LETTER A' (U+0430) in there !#
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Wed Jun 10, 2020 6:40 pm

PeterO wrote:
Wed Jun 10, 2020 6:40 pm
Had to resort to "hexdump -C" to find the Unicode Characters 'CYRILLIC SMALL LETTER A' (U+0430) in there !#
PeterO
Insert into .vimrc the following:

Code: Select all

:syntax match nonascii "[^\x00-\x7F]"
:highlight nonascii guibg=Red ctermfg=2
Then the code for the previous example appears as

Image

and it's again clear what's going on. It makes me stop to wonder why Plan 9 never caught on.
Last edited by ejolson on Wed Jun 10, 2020 8:51 pm, edited 1 time in total.

Heater
Posts: 15832
Joined: Tue Jul 17, 2012 3:02 pm

Re: New major release of GCC

Wed Jun 10, 2020 6:59 pm

Are we talking about the insanity of allowing Unicode/UTF-8 into C/C++ source code?

God help us from that.

An example of the possible chaos I created in JS a few years ago:

Code: Select all

let ﻝ = {
    ﺍ: function () {
        return ("Hello world!");
    }
}

let msg = ﻝ.ﺍ();
console.log(msg);

ف = (2 + 3) * (3 + 3)
console.log(ف);
Memory in C++ is a leaky abstraction .

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Wed Jun 10, 2020 7:21 pm

Heater wrote:
Wed Jun 10, 2020 6:59 pm
Are we talking about the insanity of allowing Unicode/UTF-8 into C/C++ source code?
It seems so. More information is at

viewtopic.php?t=118161

which finally resulted in

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67224

Note that similar Unicode support is available in Microsoft C, clang and pcc and dates back to Plan 9 in 1992. My contribution is described in

http://pcc.ludd.ltu.se/ftp/pub/pcc-docs ... 8-ver3.pdf

Since UTF-8 left out important PETSCII characters, Fido did not approve of the project and refused to help with the copy editing. Thus, there are a few minor typos in the document linked above.

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Tue Jun 30, 2020 3:25 am

Maybe you guys can clear this up for me, I'm trying to figure out why I have all these binaries that when I look at the default install most are symlinks to arm-linux-gnu(blah blah). Can I replace gcc for example with such a symlink?

This is my installed GCC 10

Code: Select all

$ ll /usr/local/bin/
total 259M
drwxr-xr-x  2 root root 4.0K May  8 15:21 .
drwxr-xr-x 11 root root 4.0K May  8 15:19 ..
-rwxr-xr-x  4 root root 6.1M May  8 15:19 arm-linux-gnueabihf-c++
-rwxr-xr-x  4 root root 6.1M May  8 15:19 arm-linux-gnueabihf-g++
-rwxr-xr-x  3 root root 6.1M May  8 15:21 arm-linux-gnueabihf-gcc
-rwxr-xr-x  3 root root 6.1M May  8 15:21 arm-linux-gnueabihf-gcc-10.1.0
-rwxr-xr-x  2 root root 166K May  8 15:21 arm-linux-gnueabihf-gcc-ar
-rwxr-xr-x  2 root root 166K May  8 15:21 arm-linux-gnueabihf-gcc-nm
-rwxr-xr-x  2 root root 166K May  8 15:21 arm-linux-gnueabihf-gcc-ranlib
-rwxr-xr-x  2 root root 6.1M May  8 15:19 arm-linux-gnueabihf-gfortran
-rwxr-xr-x  4 root root 6.1M May  8 15:19 c++
-rwxr-xr-x  1 root root 6.1M May  8 15:21 cpp
-rwxr-xr-x  4 root root 6.1M May  8 15:19 g++
-rwxr-xr-x  3 root root 6.1M May  8 15:21 gcc
-rwxr-xr-x  2 root root 166K May  8 15:21 gcc-ar
-rwxr-xr-x  2 root root 166K May  8 15:21 gcc-nm
-rwxr-xr-x  2 root root 166K May  8 15:21 gcc-ranlib
-rwxr-xr-x  1 root root 5.3M May  8 15:20 gcov
-rwxr-xr-x  1 root root 3.1M May  8 15:21 gcov-dump
-rwxr-xr-x  1 root root 3.3M May  8 15:21 gcov-tool
-rwxr-xr-x  2 root root 6.1M May  8 15:19 gfortran
-rwxr-xr-x  1 root root  640 Mar  9 14:49 github-markup
-rwxr-xr-x  1 root root  598 Mar  9 15:52 gollum
-rwxr-xr-x  1 root root  613 Mar  9 14:56 htmldiff
-rwxr-xr-x  1 root root  610 Mar  9 14:49 kramdown
-rwxr-xr-x  1 root root  607 Mar  9 14:56 ldiff
-rwxr-xr-x  1 root root 186M May  8 15:19 lto-dump
-rwxr-xr-x  1 root root  610 Mar  9 14:49 mustache
-rwxr-xr-x  1 root root  610 Mar  9 14:52 nokogiri
-rwxr-xr-x  1 root root  648 Mar  9 17:16 posix-spawn-benchmark
-rwxr-xr-x  1 root root  590 Mar  9 14:49 rackup
-rwxr-xr-x  1 root root  596 Mar  9 14:52 rougify
-rwxr-xr-x  1 root root  586 Mar  9 14:49 tilt
It's not really about the space used and more of why do I need the same binary with different names if a symlinks will do.

I'd like to know if I can recompile GCC 10 for the newer Pi boards and have it be okay installed with the hard float version. Right now that would not work. My end game is to write a script that will change the /usr/bin/gcc and similar to point to what ever compiler I want as the system default.

I'm suspecting there will be a problem with this idea.

swampdog
Posts: 379
Joined: Fri Dec 04, 2015 11:22 am

Re: New major release of GCC

Thu Jul 02, 2020 10:43 am

I don't know the reason why gcc is installed as multiple copies but I suspect it has to do with the more complex configuration options. You might want multiple compilers (and crosses) all sat in the same folder (or not) and there are hard coded paths.

Changing the system compiler to be a symlink will break a lot of stuff and it can be subtle enough for you to not realise, possibly ever at all. Much better to have your script override the system compiler. eg:

Code: Select all

foo@pi18:~ $ cat /usr/local/sd/bin/sd-qt
#!/bin/bash

PATH=/usr/local/QT/5.12.5/bin:$PATH \
LD_LIBRARY_PATH=/usr/local/QT/5.12.5/lib64:/usr/local/QT/5.12.5/lib:/usr/local/QT/5.12.5/lib/qtcreator \
LLVM_INSTALL_DIR=/usr/local/QT/5.12.5 \
QTC_ENABLE_LIBTOOLING=1 \
QTDIR=/usr/local/QT/5.12.5 \
MANPATH=/usr/local/QT/5.12.5/share/man \
INFOPATH=/usr/local/QT/5.12.5/share/info \
"$@"

Code: Select all

foo@pi18:~ $ gcc -v 2>&1 | grep ^gcc
gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)

foo@pi18:~ $ sd-qt gcc -v 2>&1 | grep ^gcc
gcc version 9.2.0 (GCC)
Have to resort to my PC for this..

Code: Select all

foo@sdu /kvm $ clang --version
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

foo@sdu /kvm $ sd-qt clang --version
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/QT/5.12.5/bin

foo@sdu /kvm $ which lld

foo@sdu /kvm $ sd-qt which lld
/usr/local/QT/5.12.5/bin/lld
Basically the above works the same way as 'distcc' and 'ccache' work in that they expect the compilation environment to be able to handle a compiler specification containing whitespace (aka CC='ccache gcc' or even CC='sdqt ccache gcc').

Additionally, if you make the system compiler "modal" and set it off doing something lengthy you then can't use the original system compiler until the lengthy thing has completed. The above arrangement allows all compilers to run simultaneously doing their thing.

Bear in mind more fundamental issues of design. There's a "mariadb" in 'sd-qt' PATH for instance. Should I require it, I could put in a different "binutils": that's often forgotten and is one place where failure (if you're lucky) or bizarre faults (unlucky) crop up.

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Thu Jul 02, 2020 1:26 pm

DarkElvenAngel wrote:
Tue Jun 30, 2020 3:25 am
My end game is to write a script that will change the /usr/bin/gcc and similar to point to what ever compiler I want as the system default.

I'm suspecting there will be a problem with this idea.
I think Debian alternatives includes the ability to change the default version of the compiler using symbolic links.

https://wiki.debian.org/DebianAlternatives

User avatar
jojopi
Posts: 3230
Joined: Tue Oct 11, 2011 8:38 pm

Re: New major release of GCC

Thu Jul 02, 2020 2:59 pm

DarkElvenAngel wrote:
Tue Jun 30, 2020 3:25 am

Code: Select all

-rwxr-xr-x  4 root root 6.1M May  8 15:19 arm-linux-gnueabihf-c++
-rwxr-xr-x  4 root root 6.1M May  8 15:19 arm-linux-gnueabihf-g++
-rwxr-xr-x  4 root root 6.1M May  8 15:19 c++
-rwxr-xr-x  4 root root 6.1M May  8 15:19 g++

-rwxr-xr-x  3 root root 6.1M May  8 15:21 arm-linux-gnueabihf-gcc
-rwxr-xr-x  3 root root 6.1M May  8 15:21 arm-linux-gnueabihf-gcc-10.1.0
-rwxr-xr-x  3 root root 6.1M May  8 15:21 gcc
It's not really about the space used and more of why do I need the same binary with different names if a symlinks will do.
Those are actually hard links, as you can see from the link counts, and confirm with ls -li. Changing to symlinks would be marginally less efficient.

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Thu Jul 02, 2020 4:13 pm

Thanks jojopi,

I learned something I didn't know that hard links don't show up the same as soft links.

DarkElvenAngel
Posts: 746
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Thu Jul 02, 2020 4:25 pm

Okay so now I'm building the compiler to deal with just a Pi 4 or 3 but I don't think the two can live side by side. Do I have any options here or is this lost cause?

ejolson
Posts: 5163
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Thu Jul 02, 2020 4:42 pm

DarkElvenAngel wrote:
Thu Jul 02, 2020 4:25 pm
Okay so now I'm building the compiler to deal with just a Pi 4 or 3 but I don't think the two can live side by side. Do I have any options here or is this lost cause?
I would recommend installing different builds of the gcc compiler in separate directories, such as

/usr/local/gcc-pi4
/usr/local/gcc-zero

Note that the main thing (besides the default settings) that change between different types of Pi computers is the runtime support library. For example, the library for the Pi4 will use 32-bit division to emulate 64-bit division operations while the library for the Zero will do something quite different.

Depending on which Pi is being used, you would then want to set ldconfig to load the correct library in either

/usr/local/gcc-pi4/lib

or

/usr/local/gcc-zero/lib

You could use a script and the

LD_LIBRARY_PATH

environment variable to do the same for non-setuid binary executables.

Return to “C/C++”