See https://github.com/jcmvbkbc/crosstool-NG/issues/55
I am running Manjaro (Arch) Linux with 4.18.0-1 kernel. I tried setting my environment vars and ./configure to use gcc, g++, and cpp 8.1.1+20180531-1 and 7.3.1+20180406-2 and with both I got the same errors mentioned here. I also tried 5.4.1-1 but got a different error, I didn't save the logs in that case.
The 8.1.1 and 7.3.1 errors occur during the pass 2 core C gcc compile step. They all seem to be with the wide-int.h header file for gcc-5.2.0. Errors include, but are not limited to:
error: too many template-parameter-lists
error: invalid use of incomplete type 'struct wi::int_traits
error: incomplete type 'wi::int_traits
...and other similar errors.
I turned debug logging on with verbosity at the highest possible level - the build.log is attached in a .zip file. It expands to just over 10MB. This is from host gcc version 7.3.1.
esp32-crosstoolng-build-debugenabled.zip
Please let me know if any more information is required or if this is better a fit for the jcmvbkbc repo. Thanks.
Hi @jasonc0, at the moment we use Debian Jessie (when building toolchains for Linux), and Debian Stretch (when building toolchains for Mac/Windows). Such old version is used to allow folks who have older glibc versions to run resulting binaries (e.g. https://github.com/espressif/arduino-esp32/issues/950).
I suspect that our version of crosstool-NG is missing some patches to allow GCC 5.2 to be built on more recent host GCC versions. We are in the process of switching to crosstool-NG master branch, and also switching to a more recent GCC version for the target. Once that is done, i think you will be able to build the toolchain using host GCC 7.3. In the meantime, you may use an older version of host GCC (e.g. via docker).
Hi @jasonc0 and @igrr , I'm facing the same trouble too, always I try to build the ct-ng file, it shows to me a ERROR 2.
Here is my build.log.
I'm using:
LSB Version: n/a
Distributor ID: ManjaroLinux
Description: Manjaro Linux
Release: 17.1.11
Codename: Hakoila`
And GCC:
gcc (GCC) 8.1.1 20180531
I installed Manjaro recently, so I don't have the GCC 7.3 package, and when I use the ./ct-ng build CC=gcc-7.3 CXX=gcc-7.3 command, it fails in the ncurses step. That is the folowing build.log of this error.
What can I do to build it without error?
You might be able to get a little further by installing the gcc 7 package using pacman and also ncurses 5 from AUR using yaourt but it sounds like you'll then get the same error as myself. Perhaps try building with crosstool in an Ubuntu vm or with docker as suggested. Personally I just downloaded the precompiled tarball from espressif. I can't stand Ubuntu or Debian personally, they take "stable" too far and so every package is 5 versions old...
I had the same problem compiling with gcc 8.1.1 under arch linux. I found a workaround that let me compile and install the esp32 toolchain (i'm not sure if it works properly, needs some tests). The problem/solution was explained here :
https://stackoverflow.com/questions/3595859/too-many-template-parameter-lists-error-when-specializing-a-member-function
There are several consecutive template definitions in wide-int.h that should be adapted as described in stackoverflow. Just removed the consecutive "template<> template<....>" definitions and the error disappeared. I'll test the toolchain in the following days, but i believe that it should work.
I also use Arch Linux (Manjaro) with gcc 8.1.1 and experienced the same problems building the toolchain as follows:
Download crosstool-NG and build it:
cd ~/esp # OK
git clone -b xtensa-1.22.x https://github.com/espressif/crosstool-NG.git # OK
cd crosstool-NG # OK
./bootstrap && ./configure --enable-local && make install # OK
Build the toolchain:
./ct-ng xtensa-esp32-elf # OK
./ct-ng build # ERROR - Build fails at this point (see below build fail output messages)
chmod -R u+w builds/xtensa-esp32-elf # This point is never reached
On my system, there are 2 wide-int.h files:
first one here:
/home/luc/crosstool-NG/.build/src/gcc-5.2.0/gcc/wide-int.h
and the second other one here:
/home/luc/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0.80.g64433a-5.2.0/lib/gcc/xtensa-esp32-elf/5.2.0/plugin/include/wide-int.h
Both files are exactly the same.
@nuvalo wrote:
There are several consecutive template definitions in wide-int.h that should be adapted as described in stackoverflow. Just removed the consecutive "template<> template<....>" definitions and the error disappeared. I'll test the toolchain in the following days, but i believe that it should work.
Did you check that the toolchain works using that workaround?
Can you explain more how to modify wide-int.h?
It is not clear to me what to do. What parts exactly of the code shall be removed?
Shall the two wide-int.h files be modified?
Thanks
Rather than modifying wide-int.h as suggested @nuvalo, I used an older version of gcc to run ./ct-ng build successfully.
I encountered the compiling issues with gcc version 8.3.0 (Debian 8.3.0-6).
I had no compiling issues using gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1).
To check gcc version: gcc -v
To install gcc version 6: sudo apt install g++-6 gcc-6
To switch between gcc6 and gcc8:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 2 --slave /usr/bin/g++ g++ /usr/bin/g++-6
sudo update-alternatives --config gcc
For my purposes, I applied this patch to GCC 5.2.0, which allowed it to compile via GCC 8.3.0 with seemingly no ill effects.
Most helpful comment
For my purposes, I applied this patch to GCC 5.2.0, which allowed it to compile via GCC 8.3.0 with seemingly no ill effects.