Building OpenWrt fails because of Python3 and Perl

Hello,

I have the problem that since a few weeks building OpenWrt from master fails for me. I first thought that this was maybe some bad commit but at this point somebody else must have noticed that and I haven't seen any issue report it so I guess it must be me. But I'm not sure what I do wrong. My normal way to build is to do

git pull -r
./scripts/feeds update -a
./scripts/feeds install -af
make menuconfig
make -j 8 defconfig download clean world

But I can't get this to work and the error messages that are thrown are not that helpfull
Here is my build log with V=s https://filehorst.de/d/edAkxrcp
Maybe somebody can point me in the right direction

Thanks for help

P.S. I would have seen this more in Installing and Using OpenWRT than in For Developers but text said for already-build OpenWrt firmware so I post it here, sorry if this was wrong.

If you need something else beside build log feel free to ask for it and I will provide it.

First, run make clean && make -j1 V=sc

When it errors, give us the last few lines...

The rest is not useful. This way forces single-threaded building, so the error stops the build when it happens, rather than when all the rest of the parallel tasks are finished. And yes, you could grep thru the file, but you dumped a 21.5mb text file on a non-english site that pops video ads.. I'm not enticed to jump through hoops, but I am willing to help you figure out what the error is via the above instructions.

1 Like

Hi,
thanks for the reply. What other website would you recommend to upload log files which are 20 mb?

Here the last few lines.

make[3]: *** [Makefile:134: /home/user/build_openwrt_h2/openwrt/build_dir/target-x86_64_musl/glib-2.70.0/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 127
make[3]: Leaving directory '/home/user/build_openwrt_h2/openwrt/feeds/packages/libs/glib2'
time: package/feeds/packages/glib2/compile#0.43#0.20#0.49
    ERROR: package/feeds/packages/glib2 failed to build.
make[2]: *** [package/Makefile:116: package/feeds/packages/glib2/compile] Error 1
make[2]: Leaving directory '/home/user/build_openwrt_h2/openwrt'
make[1]: *** [package/Makefile:110: /home/user/build_openwrt_h2/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/user/build_openwrt_h2/openwrt'
make: *** [/home/user/build_openwrt_h2/openwrt/include/toplevel.mk:230: world] Error 2```

pastebin usually works very well.

Pastbin errors with a 413
Github works though https://gist.github.com/TheB1gG/1dbd3ab3f99ba70f5f5b72ea929278e8

bash: line 1: /home/user/build_openwrt_h2/openwrt/staging_dir/host/bin/python: No such file or directory

Add a PKG_BUILD_DEPENDS:=python3/host to your Makefile to install Python3 as a HOST tool.

1 Like

Hi Grommish,
thanks for the reply. I did that but it still says that perl [host] and python3 [host] failed to build
Here is the new log https://gist.github.com/TheB1gG/45cb8779da9d0377a650c59c48a5169f

echo '1' | cmp -s - /home/user/build_openwrt_h2/openwrt/staging_dir/target-x86_64_musl/pkginfo/libatomic.version || { echo '1' > /home/user/build_openwrt_h2/openwrt/staging_dir/target-x86_64_musl/pkginfo/libatomic.version;  } 
lib/buildcustomize.pl: .
BEGIN failed--compilation aborted.
Failed to build miniperl. Please run make minitest

Try this:
make -j1 V=sc package/feeds/packages/perl/host/{clean,compile} and see why perl is tossing a fit.

Or, check the perl script it's trying to run in the package you're building and see what the failure is. This could be a package issue rather than a perl issue.

1 Like

following your guidance I was able to identify nmap-full as the problem for perl but what causes the fail for python3 I don't know
Here current log https://gist.github.com/TheB1gG/7670b10d77d0ce6b926bb1ac5231fd50

make -j1 V=sc package/feeds/packages/glib2/{clean,compile}

1 Like

Here is the log https://gist.github.com/TheB1gG/d85dc36c07e3613a900998b44a39a3b5

PKG_BUILD_DEPENDS:=libiconv/host
HOST_BUILD_DEPENDS:=libiconv/host libffi/host pcre/host

glib2 doesn't seem to require python/host, or assumes it will be put in place by the time it's being called.

Ok.. Let's brute this for testing I guess.

make package/feeds/packages/python3/host/compile && make -j1 package/feeds/packages/glib2/compile V=sc

1 Like

Interesting.. I just built it out without issue.

What are you building against? master, 21.02, 19.x? What distro are you using?

Building master on debian bookworm wsl2

Do me a favor, do ll staging_dir/host/bin/python*

Python/Python3 is a build environment pre-req for Debian/Ubuntu, so the build system links to your host's install

grommish@DESKTOP-AW:~/openwrt$ ll staging_dir/host/bin/python*
lrwxrwxrwx 1 grommish grommish 18 Aug 31 00:16 staging_dir/host/bin/python -> /usr/bin/python3.8*
lrwxrwxrwx 1 grommish grommish 18 Aug 31 00:16 staging_dir/host/bin/python3 -> /usr/bin/python3.8*

Do you have all the build environment packages installed?

sudo apt update
sudo apt install build-essential ccache ecj fastjar file g++ gawk \
gettext git java-propose-classpath libelf-dev libncurses5-dev \
libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \
python3-distutils python3-setuptools python3-dev rsync subversion \
swig time xsltproc zlib1g-dev 

See if it installs anything new?

ls -lah staging_dir/host/bin/python*
lrwxrwxrwx 1 user user 18 Mar 21  2021 staging_dir/host/bin/python -> /usr/bin/python3.7
lrwxrwxrwx 1 user user 18 Mar 21  2021 staging_dir/host/bin/python3 -> /usr/bin/python3.7

That is strange I have python2-dev installed. And yes I have installed all packages listed in the wiki.

a little bit late, I know, but I just stumbled upon this thread via Google:
For me the solution was
make dirclean
Why? because I had just updated my distro and with it my python3 version.
The symlink was pointing to python 3.8 while python 3.10 was installed.
And so it was pointing to something that didn't exist.

1 Like

Appreciate you following up with this information, as I also stumbled across this in my own way, and this was exactly my problem also. Thanks so much! Love all the resources that can be found on this forum.

Debian bookworm. OpenWrt needs python3.9

Symlinking to python 3.11 solve the problem:

sudo ln -s /usr/bin/python3.11 /usr/bin/python3.9