Modify

Opened 7 years ago

Last modified 4 years ago

#8627 new defect

mklibs fails with python3

Reported by: tibor.vago@… Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Trunk
Keywords: python mklibs Cc:

Description

IPKG_TMP=/pub/temp/openwrt/tmp/ipkg IPKG_INSTROOT=/pub/temp/openwrt/build_dir/target-arm_v4_uClibc-0.9.31/root-gemini IPKG_CONF_DIR=/pub/temp/openwrt/staging_dir/target-arm_v4_uClibc-0.9.31/etc IPKG_OFFLINE_ROOT=/pub/temp/openwrt/build_dir/target-arm_v4_uClibc-0.9.31/root-gemini /pub/temp/openwrt/staging_dir/host/bin/opkg --offline-root /pub/temp/openwrt/build_dir/target-arm_v4_uClibc-0.9.31/root-gemini --force-depends --force-overwrite --force-postinstall --add-dest root:/ --add-arch all:100 --add-arch gemini:200 install /pub/temp/openwrt/bin/gemini/packages/swap-utils_2.13.0.1-4_gemini.ipk
Installing swap-utils (2.13.0.1-4) to root...
Configuring swap-utils.
IPKG_TMP=/pub/temp/openwrt/tmp/ipkg IPKG_INSTROOT=/pub/temp/openwrt/build_dir/target-arm_v4_uClibc-0.9.31/root-gemini IPKG_CONF_DIR=/pub/temp/openwrt/staging_dir/target-arm_v4_uClibc-0.9.31/etc IPKG_OFFLINE_ROOT=/pub/temp/openwrt/build_dir/target-arm_v4_uClibc-0.9.31/root-gemini /pub/temp/openwrt/staging_dir/host/bin/opkg --offline-root /pub/temp/openwrt/build_dir/target-arm_v4_uClibc-0.9.31/root-gemini --force-depends --force-overwrite --force-postinstall --add-dest root:/ --add-arch all:100 --add-arch gemini:200 install /pub/temp/openwrt/bin/gemini/packages/hwclock_2.13.0.1-4_gemini.ipk
Installing hwclock (2.13.0.1-4) to root...
Configuring hwclock.
make[3]: Leaving directory `/pub/temp/openwrt/package/util-linux-ng'
make[2]: Leaving directory `/pub/temp/openwrt'
make[2]: Entering directory `/pub/temp/openwrt'
make[3]: Entering directory `/pub/temp/openwrt'
make[3]: *** No rule to make target `package/preconfig'.  Stop.
make[3]: Leaving directory `/pub/temp/openwrt'
make[2]: [package/rootfs-prepare] Error 2 (ignored)
rm -rf /pub/temp/openwrt/tmp/mklibs-progs /pub/temp/openwrt/tmp/mklibs-out
# first find all programs and add them to the mklibs list
find /pub/temp/openwrt/staging_dir/target-arm_v4_uClibc-0.9.31/root-gemini -type f -perm +100 -exec file -r -N -F '' {} + | awk ' /executable.*dynamically/ { print $1 }' > /pub/temp/openwrt/tmp/mklibs-progs
# find all loadable objects that are not regular libraries and add them to the list as well
find /pub/temp/openwrt/staging_dir/target-arm_v4_uClibc-0.9.31/root-gemini -type f -name \*.so\* -exec file -r -N -F '' {} + | awk ' /shared object/ { print $1 }' >> /pub/temp/openwrt/tmp/mklibs-progs
mkdir -p /pub/temp/openwrt/tmp/mklibs-out
/pub/temp/openwrt/staging_dir/host/bin/mklibs.py -D -d /pub/temp/openwrt/tmp/mklibs-out --sysroot /pub/temp/openwrt/staging_dir/target-arm_v4_uClibc-0.9.31/root-gemini -L /lib -L /usr/lib -L /usr/lib/ebtables --ldlib /lib/ld-uClibc.so.0 --target arm-openwrt-linux-uclibc `cat /pub/temp/openwrt/tmp/mklibs-progs` 2>&1
  File "/pub/temp/openwrt/staging_dir/host/bin/mklibs.py", line 59
    print string.join(msg)
               ^
SyntaxError: invalid syntax
make[2]: *** [package/rootfs-prepare] Error 1
make[2]: Leaving directory `/pub/temp/openwrt'
make[1]: *** [/pub/temp/openwrt/staging_dir/target-arm_v4_uClibc-0.9.31/stamp/.package_rootfs-prepare] Error 2
make[1]: Leaving directory `/pub/temp/openwrt'
make: *** [world] Error 2

Attachments (0)

Change History (7)

comment:1 Changed 7 years ago by tibor.vago@…

My host system is Arch Linux x86_64 with python-2.6 + python-2.7 + python-3.1 and python3 is the default.

comment:2 Changed 6 years ago by qianyilong@…

Same issue seen here. I also happen to be using Arch x86_64.

comment:3 Changed 6 years ago by me@…

Faced with the same issue on gentoo with python3.2 as default and 2.7 as deps for some packages/ Following step helps:
assuming cwd is build dir (~/openwrt/trunk in my case) making local override for python version & search path
ln -s /usr/bin/python2 tmp/python
PATH=tmp:$PATH
that's all, next
make
finalizes the build process
Hence - probably it's feasible to add something like
[ "python -V 2>&1|awk '{print$2}'|sed 's/\..\+//'" -gt 2 ] && [ -x /usr/bin/python2 ] && ln -s /usr/bin/python2 <bin override path>/python
to prereq check script?

comment:4 Changed 6 years ago by earendil_fr@…

You can use the following solution :
replace the first line

#! /usr/bin/env python 

with this line

#! /usr/bin/env python2

It’s force to use python2 when your system settings use python3 by default

comment:5 Changed 5 years ago by anonymous

Check this out for Python 3 on OpenWRT
https://forum.openwrt.org/viewtopic.php?id=36958

comment:6 Changed 4 years ago by Carlos Ferreira <carlosmf.pt@…>

Python3 compiles and works well as seen on the OpenWRT forum link. It actually works better than Python 2.7.

I use it for communication protocol prototypes.

comment:7 Changed 4 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.