Cannot compile 21.02 branch from git (fails to compile gcc?)

Hello,

So, I have been keeping some languag packages for OpenWRT here,
mostly for fun:

(There are even BASIC and Algol compilers/interpreters there!)

Anyway -- I used to compile the 19.07 branch from git without problems.

When I saw that 21.02 was out, I moved to the openwrt-21.02 branch, and tried compiling again. And strangely, it won't compile gcc. It doesnt seem to find any headers:

checking whether we are using the GNU C++ compiler... no
checking whether x86_64-pc-linux-gnu-g++ accepts -g... no
checking for x86_64-pc-linux-gnu-gnatbind... no
checking for gnatbind... gnatbind
checking for x86_64-pc-linux-gnu-gnatmake... no
checking for gnatmake... gnatmake
checking whether compiler driver understands Ada... no
checking how to run the C++ preprocessor... /lib/cpp
checking for grep that handles long lines and -e... /home/jeronimo/pkg/openwrt-19.07/staging_dir/host/bin/grep
checking for egrep... /home/jeronimo/pkg/openwrt-19.07/staging_dir/host/bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... no
checking how to run the C preprocessor... gcc -E
checking for inline... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... unknown
checking for _LARGE_FILES value needed for large files... unknown
checking size of void *... 0
checking size of short... 0
checking size of int... 0
checking size of long... 0
checking for long long... no
checking for int8_t... no
checking for int16_t... no
checking for int32_t... no
checking for int64_t... no
checking for long long int... no
checking for intmax_t... no
checking for intptr_t... no
checking for uint8_t... no
checking for uint16_t... no
checking for uint32_t... no
checking for uint64_t... no
checking for unsigned long long int... no
checking for uintmax_t... no
checking for uintptr_t... no
configure: error: uint64_t or int64_t not found
make[3]: *** [Makefile:4193: configure-gcc] Error 1
make[3]: Leaving directory '/home/jeronimo/pkg/openwrt-19.07/build_dir/toolchain-mips_24kc_gcc-8.4.0_musl/gcc-8.4.0-initial'
make[2]: *** [Makefile:37: /home/jeronimo/pkg/openwrt-19.07/build_dir/toolchain-mips_24kc_gcc-8.4.0_musl/gcc-8.4.0-initial/.built] Error 2
make[2]: Leaving directory '/home/jeronimo/pkg/openwrt-19.07/toolchain/gcc/initial'
time: toolchain/gcc/initial/compile#1.94#1.46#5.09
ERROR: toolchain/gcc/initial failed to build.
make[1]: *** [toolchain/Makefile:97: toolchain/gcc/initial/compile] Error 1
make[1]: Leaving directory '/home/jeronimo/pkg/openwrt-19.07'`
make: *** [/home/jeronimo/pkg/openwrt-19.07/include/toplevel.mk:230: toolchain/install] Error 2

What could have been happening?
The method I used for compiling is

make clean && make tools/clean && make toolchain/clean
make menuconfig
./scripts/feeds update -a
./scripts/feeds install -a
make tools/install
make toolchain/install

you can try to manually point to the correctly include dir using env variables.

the -I option might work too.

I certainly have them -- I used to build the other branch from source... And I build a lot of software using gcc. That's strange.

Try starting with a clean slate first. By the looks of it it seems like you're just using your old 19.07 environment.

Sounds like your buildhost is incompatible with the current gcc compilation requirements.
What is your host?
You should use something current like Ubuntu 20.04 or similar.

But you should also follow the advice and clean up the buildroot. Do "make dirclean", and rebuild the toold and toolchain. ( You seem to have done most of the steps individually, but you might do the normal make routine)

Additional idea is to remove .config to ensure that you start the OpenWrt config side from scratch.

1 Like

I would also suggest re-checking your build pre-reqs on host.. That looks almost like build-tools isn't installed..

1 Like

Ok I tried, and it failed again...

I did

sudo apt install asciidoc bash binutils  bzip2 flex git-core g++ gcc util-linux gawk help2man intltool libelf-dev zlib1g-dev make libncurses5-dev libssl-dev patch python2-dev unzip wget gettext xsltproc zlib1g-dev

I also got a fresh git checkout (hence a new .config).

But it still fails... This is Debian sid, so I'd expect it to have all recent dependencies. It's "sid" so not totally stable, but missing headers is something I wouldn't expect. Also, the headers are there!

-rw-r--r-- 1 root root 11893 May  1 17:56 /usr/include/inttypes.h
-rw-r--r-- 1 root root 8474 May  1 17:56 /usr/include/stdint.h
-rw-r--r-- 1 root root 42804 May  1 17:56 /usr/include/unistd.h
$ dpkg -S /usr/include/inttypes.h
libc6-dev:amd64: /usr/include/inttypes.h

Debian sid?

That might then be too new, so that some additional prerequisites are needed :frowning:

We use a rather special collection of tools for cross-compilation purposes, so the fact that you use brand new OS might cause some hiccups.

There is sometimes problems either with a too new OS or a too old OS...

Some ideas for you: build-essential, gcc-multilib

See also https://openwrt.org/docs/guide-developer/build-system/install-buildsystem#debianubuntu

Ps.
I have built 19.07, 21.02 and master succesfully with Ubuntu 20.10, and currently I use Ubuntu 21.04 for master and 21.02.

I use this:

### Prerequisites for buildroot
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev
sudo apt-get install gawk gcc-multilib flex git gettext libssl-dev
sudo apt-get install python3-distutils

See my buildroot init script here: https://www.dropbox.com/sh/ew0gap0crn30wyk/AADtatdA4-LgPogj-2EKNhQPa/owrt2102-r16063-08cfc7a0d3-20210505?dl=0&lst=&preview=R7800-owrt2102-r16063-08cfc7a0d3-20210505-0846-newBuildroot.sh&subfolder_nav_tracking=1

Thank you! I have tried your suggestions, but I already have all of those installed.
Next thing I'm trying is to do everything with a different user account (so as to check if something in my environment could be the problem). I'm waiting for it to finish...

Which also failed. I'll try to get a different machine...

There is no problem with compiling contemporary OpenWrt (incl. openwrt-21.02) on top of sid.

1 Like

It worked on a different machine, so it's OK for now. Thanks to all who helped!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.