Compiling fails with make error

Hello,

I try to compile the master version of openwrt to get the newest modemmanager versions.
I have two machines one pi4 with raspbian and one PC with opensuse15.1. While compiling on raspbian works(but taking a long time), I don't get it on opensuse.

autoreconf: running: /home/thomas/openwrt/openwrt/staging_dir/host/bin/autoconf --include=m4 --include=. --prepend-include=/home/thomas/openwrt/openwrt/staging_dir/host/share/aclocal --force
autoreconf: running: /home/thomas/openwrt/openwrt/staging_dir/host/bin/autoheader --include=m4 --include=. --prepend-include=/home/thomas/openwrt/openwrt/staging_dir/host/share/aclocal --force
autoreconf: running: /home/thomas/openwrt/openwrt/staging_dir/host/bin/automake --add-missing --force-missing
Makefile.am:295: warning: source file 'cxx/dummy.cc' is in a subdirectory,
Makefile.am:295: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
autoreconf: Leaving directory `.'
(cd /home/thomas/openwrt/openwrt/build_dir/host/gmp-6.1.2/; if [ -x configure ]; then cp -fpR /home/thomas/openwrt/openwrt/scripts/config.{guess,sub} /home/thomas/openwrt/openwrt/build_dir/host/gmp-6.1.2// && CC="gcc" CFLAGS="-O2 -I/home/thomas/openwrt/openwrt/staging_dir/host/include " CXX="g++" CPPFLAGS="-I/home/thomas/openwrt/openwrt/staging_dir/host/include " LDFLAGS="-L/home/thomas/openwrt/openwrt/staging_dir/host/lib " CONFIG_SHELL="/usr/bin/env bash"  bash ./configure --target=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/home/thomas/openwrt/openwrt/staging_dir/host --exec-prefix=/home/thomas/openwrt/openwrt/staging_dir/host --sysconfdir=/home/thomas/openwrt/openwrt/staging_dir/host/etc --localstatedir=/home/thomas/openwrt/openwrt/staging_dir/host/var --sbindir=/home/thomas/openwrt/openwrt/staging_dir/host/bin --enable-static --disable-shared --disable-assembly --enable-cxx --enable-mpbsd ; fi )
configure: WARNING: unrecognized options: --enable-mpbsd
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking compiler gcc -O2 -I/home/thomas/openwrt/openwrt/staging_dir/host/include  -I/home/thomas/openwrt/openwrt/staging_dir/host/include ... no, mpn_lshift_com optimization 2, program does not run
checking ABI=x32
checking compiler gcc -O2 -I/home/thomas/openwrt/openwrt/staging_dir/host/include  -I/home/thomas/openwrt/openwrt/staging_dir/host/include ... no, mpn_lshift_com optimization 2, program does not run
checking ABI=32
checking compiler gcc -O2 -I/home/thomas/openwrt/openwrt/staging_dir/host/include  -I/home/thomas/openwrt/openwrt/staging_dir/host/include ... no, mpn_lshift_com optimization 2, program does not run
configure: error: could not find a working compiler, see config.log for details
make[3]: *** [Makefile:36: /home/thomas/openwrt/openwrt/build_dir/host/gmp-6.1.2/.configured] Error 1
make[3]: Leaving directory '/home/thomas/openwrt/openwrt/tools/gmp'
time: tools/gmp/compile#8.54#0.83#10.34
make[2]: *** [tools/Makefile:159: tools/gmp/compile] Error 2
make[2]: Leaving directory '/home/thomas/openwrt/openwrt'
make[1]: *** [tools/Makefile:155: /home/thomas/openwrt/openwrt/staging_dir/host/stamp/.tools_compile_yynyynnyyynyyyyynyynnyyyyyyyyyyyyyyyyyyyynynynyyyynnyyy] Error 2
make[1]: Leaving directory '/home/thomas/openwrt/openwrt'
make: *** [/home/thomas/openwrt/openwrt/include/toplevel.mk:227: world] Error 2
thomas@witz:~/openwrt/openwrt> 

How to fix this problem? I tried it also with tumbleweed, which has some newer a compiler and tools, but the problem is the same.

Regards,
Thomas

Try a Debian 9 VM, that's what the buildbots use and what should avoid any distro related issues. As alternative there should be a few OpenWrt docker containers that can act as dev environment, which may be quicker to setup/use if you have ever used docker.

I found a better solution. gmp is buggy.
https://gmplib.org/list-archives/gmp-bugs/2019-April/004536.html

So I looked into the package repository of opensuse. They patched gmp to get it work.
( gmp-6.1.2-conftest.patch)

The patch is also useful for openwrt.

How to apply the patch ?

After the first failed make. Otherwise the package that needs to be patched isn't there.