Yes, except that I added "d" to the --enable-languages list.
Code: Select all
#!/bin/bash # # This is the new GCC version to install. # VERSION=9.1.0 # # For the Pi or any computer with less than 2GB of memory. # if [ -f /etc/dphys-swapfile ]; then sudo sed -i 's/^CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/' /etc/dphys-swapfile sudo /etc/init.d/dphys-swapfile restart fi if [ -d gcc-$VERSION ]; then cd gcc-$VERSION rm -rf obj else wget ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$VERSION/gcc-$VERSION.tar.xz tar xf gcc-$VERSION.tar.xz rm -f gcc-$VERSION.tar.xz cd gcc-$VERSION contrib/download_prerequisites fi mkdir -p obj cd obj # # Now run the ./configure which must be checked/edited beforehand. # Uncomment the sections below depending on your platform. You may build # on a Pi3 for a target Pi Zero by uncommenting the Pi Zero section. # To alter the target directory set --prefix=<dir> # # Pi3+, Pi3, and new Pi2 ../configure --enable-languages=c,d,c++,fortran --with-cpu=cortex-a53 \ --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \ --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-checking=no # Pi Zero's #../configure --enable-languages=c,d,c++,fortran --with-cpu=arm1176jzf-s \ # --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \ # --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-checking=no # x86_64 #../configure --disable-multilib --enable-languages=c,d,c++,fortran --enable-checking=no # Odroid-C2 AArch64 #../configure --enable-languages=c,d,c++,fortran --with-cpu=cortex-a53 --enable-checking=no # Old Pi2 #../configure --enable-languages=c,d,c++,fortran --with-cpu=cortex-a7 \ # --with-fpu=neon-vfpv4 --with-float=hard --build=arm-linux-gnueabihf \ # --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-checking=no # # Now build GCC which will take a long time. This could range from # 4.5 hours on a Pi3B+ up to about 50 hours on a Pi Zero. It can be # left to complete overnight (or over the weekend for a Pi Zero :-) # The most likely causes of failure are lack of disk space, lack of # swap space or memory, or the wrong configure section uncommented. # The new compiler is placed in /usr/local/bin, the existing compiler remains # in /usr/bin and may be used by giving its version gcc-6 (say). # if make -j `nproc` then echo read -p "Do you wish to install the new GCC (y/n)? " yn case $yn in [Yy]* ) sudo make install ;; * ) exit ;; esac fi
I'm not an expert, but at first glance, to me, it seems cleaner and more modern than C++, yet still very powerful.
That rather depends what your hobby is.which are the pros and cons about D vs. C++ for hobby users?
Code: Select all
[email protected]:~ $ gdc -v Using built-in specs. COLLECT_GCC=gdc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/arm-linux-gnueabihf/9.1.0/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../configure --enable-languages=c,d,c++,fortran --with-cpu=arm1176jzf-s --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-checking=no Thread model: posix gcc version 9.1.0 (GCC)
I have different compile time options, and my Pi 3B+ took just over an hour to generate GCC 9.1. Works perfectly for now
I don't know, but the old compiler (GCC 6.3 on the Pi) is available as gcc-6
I've been using the following code for a few years now without any problems. The salient option for speed is the "--disable-bootstrap". Instead of 3 passes it only passes once. The 3 compilation passes are on by default and its primary function is to ensure that non-GCC compilers produce matching results. I've just complied the latest Linux Kernel 5.1.0 on my Raspberry Pi using GCC 9.1.0 e.g.
Code: Select all
#!/bin/sh unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE CFLAGS="-Ofast -fno-fast-math -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard" \ ../gcc-9.1.0/configure -v \ --with-system-zlib \ --disable-bootstrap \ --with-mode=arm \ --prefix=/usr/local/gcc-9.1.0 \ --enable-languages=c,c++ \ --disable-multilib \ --program-suffix=-9.1.0 \ --with-arch=armv8-a \ --with-float=hard \ --with-fpu=neon-fp-armv8 \ --build=arm-linux-gnueabihf \ --host=arm-linux-gnueabihf \ --target=arm-linux-gnueabihf make -j4 sudo make install sudo update-alternatives --remove-all gcc-ar sudo update-alternatives --remove-all gcc-nm sudo update-alternatives --remove-all gcc-ranlib sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++ sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-9.1.0/bin/g++-9.1.0 20 sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-9.1.0/bin/gcc-9.1.0 20 sudo update-alternatives --install /usr/bin/gcc-ranlib gcc-ranlib \ /usr/local/gcc-9.1.0/bin/gcc-ranlib-9.1.0 20 sudo update-alternatives --install /usr/bin/gcc-nm gcc-nm /usr/local/gcc-9.1.0/bin/gcc-nm-9.1.0 20 sudo update-alternatives --install /usr/bin/gcc-ar gcc-ar /usr/local/gcc-9.1.0/bin/gcc-ar-9.1.0 20
I have no doubt. LLVM too.For the general case, D should run on RISC-V since GCC supports it.
Free PDF copy of the book located here: http://ddili.org/ders/d.en/Programming_in_D.pdfjahboater wrote: ↑Mon May 06, 2019 5:47 pmI'm not an expert, but at first glance, to me, it seems cleaner and more modern than C++, yet still very powerful.
Why don't you just try writing a sample program in both?
The D compiler is called "gdc" (Gnu D Compiler) by the way. "man gdc" should give you some info.
This book is good:
https://www.amazon.co.uk/Programming-Tu ... 181&sr=8-5
Does this option help? (from man gdc).
Code: Select all
-fno-druntime Implements <https://dlang.org/spec/betterc.html>. Assumes that compilation targets an environment without a D runtime library. This is equivalent to compiling with the following options: gdc -nophoboslib -fno-exceptions -fno-moduleinfo -fno-rtti
Two passes is better than one, it makes sure that is built with the version it is designed to be built with. Plus your new compiler wouldn't itself be built using any new-fangled optimisations the new compiler has. By just doing one pass the new compiler could be buggy and it won't have any new optimisations applied (it can apply them to code it generates but the compiler itself won't have been compiled with them).jahboater wrote: ↑Tue May 07, 2019 4:29 pmThanks.
Sounds all that's needed anyway if the current installed compiler is a recent GCC (say you are upgrading from 8.3 to 9.1).
With the three passes, I guess the final version is built with itself, and that thoroughly tests itself too.
I'll have to get around to building for my RPi & PC, A million is quite a lot for a front end, I wonder if it generates GIMPLE for the back end rather than GENERIC (the C and C++ front ends do)? Darn, I'm going to have to take a squiz at the source and see now . I remember playing around with D for a few weeks way back when it was first released but never did anything in it.jahboater wrote: ↑Sun May 12, 2019 10:55 amPaeryn,
That all makes sense, thanks.
That is, until you build it on a Pi Zero
The three stage build takes over 50 hours on the p0, but (surprisingly) it works perfectly.
Just leave it running over the weekend.
FYI, the new D front end added around one million lines of code ...
See this old post:Paeryn wrote: ↑Sun May 12, 2019 1:03 pmI'll have to get around to building for my RPi & PC, A million is quite a lot for a front end, I wonder if it generates GIMPLE for the back end rather than GENERIC (the C and C++ front ends do)? Darn, I'm going to have to take a squiz at the source and see now . I remember playing around with D for a few weeks way back when it was first released but never did anything in it.
So only 860k LOC really.Adding the D support touches more than three thousand files (most of which is test suite cases) and 859,714 lines of code.... Yes, the better part of a million new lines.
I tried building gcc 9.1 on my Mac the other day and it was very difficult, and in fact isn't working yet.nairn62 wrote: ↑Tue May 07, 2019 12:18 pmI have different compile time options, and my Pi 3B+ took just over an hour to generate GCC 9.1. Works perfectly for now