openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
3.97k stars 3.47k forks source link

samba4 cross compile error... #9579

Closed adaaaaaa closed 5 years ago

adaaaaaa commented 5 years ago
  File "./buildtools/bin/waf", line 75, in <module>
    import Scripting
  File "/home/captain/openwrt/build_dir/hostpkg/samba-4.9.11/third_party/waf/wafadmin/Scripting.py", line 146
    except Utils.WafError,e:
                         ^
SyntaxError: invalid syntax
make[3]: *** [Makefile:474: /home/captain/openwrt/build_dir/hostpkg/samba-4.9.11/.configured] Error 1
make[3]: Leaving directory '/home/captain/openwrt/feeds/packages/net/samba4'
time: package/feeds/packages/samba4/host-compile#0.26#0.10#0.34
make[2]: *** [package/Makefile:107: package/feeds/packages/samba4/host/compile] Error 2
make[2]: Leaving directory '/home/captain/openwrt'
make[1]: *** [package/Makefile:103: /home/captain/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/captain/openwrt'
make: *** [/home/captain/openwrt/include/toplevel.mk:218:world] 错误 2

subtarget:X86_64

wongsyrone commented 5 years ago

The same here on Archlinux

panda-mute commented 5 years ago

@Andy2244

Andy2244 commented 5 years ago

mhh packages and faillogs look fine for the buildbots on 25.07 ?

Did a quick run for the x86_64 target via my package builder and this worked. The base image is based on debian:stretch-slim, my live dev system is based on ClearLinux and also worked.

Not sure what i can do here, this looks like a waf <-> distro problem to me, maybe try with just python 2.7 installed?

EdiTurn commented 5 years ago

Got same error during compile libtalloc.

panda-mute commented 5 years ago

This should be the issue of changing to python3.

panda-mute commented 5 years ago

I am using master branch source code compile, 4.9.11 is ok when openwrt build don't switch to python3.

You may check this https://github.com/openwrt/openwrt/commit/19938c8de7a062626796f53a2805608c0dd4edbd

Andy2244 commented 5 years ago

4.9.11 is ok when openwrt build don't switch to python3

I mean what python version is installed for the buildbots/sdk, since this still builds fine. I did not try to build 4.9.x with only python3 installed, since its not officially supported. Only 4.10/11 have python3 support, but those branches have some other major bugs atm and i need to wait for official fixes before i can try a switch again.

PS: Try this to ensure python2 is available: HOST_BUILD_DEPENDS:=python/host nfs-kernel-server/host e2fsprogs/host

EXcomZkko commented 5 years ago

Same here. (Debian Testing)

wongsyrone commented 5 years ago

For Python 3, I will try changing the line

except Utils.WafError,e:

to

except Utils.WafError as e:

and try again to see if other errors occur

Andy2244 commented 5 years ago

ok just confirmed on debian testing, the error is because openwrt did drop the python2 requirement on host for the sdk, so if you don't have python2 installed on host you get this error.

The fix is to ensure we have a valid python2 version for the build step via this makefile change: HOST_BUILD_DEPENDS:=python/host nfs-kernel-server/host e2fsprogs/host

PS: Will be fixed with the next update.

flipreverse commented 5 years ago

@Andy2244 This will fix the build issue. It, however, introduces another issue. Wiresless regdb won't build, because it calls the python binary which is a symlink to python2.7. This is due to the fact that samba4 adds python2 as a dependency. I fixed it by adding the following to /package/firmware/wireless-regdb/Makefile: include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk and changed $(PYTHON) $(PKG_BUILD_DIR)/db2fw.py $(PKG_BUILD_DIR)/regulatory.db $(PKG_BUILD_DIR)/db.txt to $(PYTHON3) $(PKG_BUILD_DIR)/db2fw.py $(PKG_BUILD_DIR)/regulatory.db $(PKG_BUILD_DIR)/db.txt

Andy2244 commented 5 years ago

Mhh thats strange the file uses #!/usr/bin/env python which is generally assumed to work with python2, while #!/usr/bin/env python3 is used for explicit python3 support. At least thats what i have seen on some python projects.

So given the age of the project i'm surprised it wont build with python2?

flipreverse commented 5 years ago

I'm sorry. I missed a point in my explanation. I forced wireles-regdb to use python3 since python2 is missing a module called builtins. The error when running build_dir/target-mips_24kc_musl/wireless-regdb-2019.06.03/regulatory.db is: No module named builtins.

Andy2244 commented 5 years ago

Yeah i guess thats the fix than, if it only builds with python3 anyway than it has to ensure it actually uses python3 and not rely on whatever symlink exists.

flipreverse commented 5 years ago

Ic. Who is responsible for fixing this? How should a fix might look like?

Andy Walsh notifications@github.com schrieb am Di., 30. Juli 2019, 22:26:

Yeah i guess thats the fix than, if it only builds with python3 anyway than it has to ensure it actually uses python3 and not rely on whatever symlink exists.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openwrt/packages/issues/9579?email_source=notifications&email_token=AAIEJETSHYLJ4OITLCY2NQ3QCCPZBA5CNFSM4IHIRBR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3FGWYY#issuecomment-516582243, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIEJEUCS6O5QS6X23VJXTTQCCPZBANCNFSM4IHIRBRQ .

Andy2244 commented 5 years ago

Maintainer is listed as Felix Fietkau nbd@nbd.name @nbd168 is that you? If so can you have a look at this please, regarding wireless-regdb?

panda-mute commented 5 years ago

@ynezz

ynezz commented 5 years ago

This https://github.com/ynezz/openwrt/commit/e523a9d1f4d3391ac8c173c6b5d687bce0c529e7 should make wireless-regdb use proper python(python3), so please try it and let me know if it's ok, thanks.

MartB commented 5 years ago

cant even build my openwrt so its not only samba its everything kinda, libtalloc is also affected