Created attachment 12058 [details] samba-4.4.3/bin/config.log (gzipped) After some tweaking, I got samba configuring correctly for cross compile using --cross-answers. Unfortunately samba fails to compile correctly and fails with /bin/sh: /builddir/samba-4.4.3/bin/asn1_compile: cannot execute binary file: Exec format error /bin/sh: /builddir/samba-4.4.3/bin/asn1_compile: cannot execute binary file: Exec format error /bin/sh: /builddir/samba-4.4.3/bin/asn1_compile: cannot execute binary file: Exec format error Waf: Leaving directory `/builddir/samba-4.4.3/bin' Build failed: -> task failed (err #126): {task: HEIMDAL_KX509_ASN1_ASN1 kx509.asn1 -> asn1_kx509_asn1.x,kx509_asn1.hx,kx509_asn1-priv.hx} -> task failed (err #126): {task: HEIMDAL_DIGEST_ASN1_ASN1 digest.asn1 -> asn1_digest_asn1.x,digest_asn1.hx,digest_asn1-priv.hx} -> task failed (err #126): {task: HEIMDAL_HDB_ASN1_ASN1 hdb.asn1 -> asn1_hdb_asn1.x,hdb_asn1.hx,hdb_asn1-priv.hx} -> task failed (err #126): {task: HEIMDAL_GSSAPI_ASN1_ASN1 gssapi.asn1 -> asn1_gssapi_asn1.x,gssapi_asn1.hx,gssapi_asn1-priv.hx} If I understand correctly in source4/heimdal_build/wscript_build line 914 the build system is told to build ans1_compile with "use_hostcc" but it looks like this option is ignored. -- Enno Boland
Trying to compile samba 4.4.3 with Debian 8 jessie and all test are OK, but first fails # smbclient -L localhost -U% Domain=[SAMDOM] OS=[Windows 6.1] Server=[Samba 4.4.3] tree connect failed: NT_STATUS_CONNECTION_DISCONNECTED With 4.4.2 seems to work How can I solve?
additional info https://thingsdomakesense.wordpress.com/2016/05/04/problem-upgrading-from-samba-4-4-2-to-samba-4-4-3-ad-dc/
That's a different issue, this is about _cross_ compiling
Ok, created a new bug https://bugzilla.samba.org/show_bug.cgi?id=11910 Thanks
I too needed to cross-compile Samba for aarch64 (ARM64) and was unable to do so because of exactly the same issue. Unable (or just too stupid) to wrap my head around that insane Waf machinery, I replaced asn1_compile (and compile_et) with wrapper scripts. The whole procedure, in short: CC=aarch64-linux-gnu-gcc buildtools/bin/waf configure \ --prefix=/opt/sambax --disable-python --without-ad-dc --without-ads \ --without-ldap --without-acl-support --without-pam --cross-compile \ --cross-execute="/usr/bin/qemu-aarch64 /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 --library-path /usr/aarch64-linux-gnu/lib/" Note: I needed to disable both PAM and ACL support, as it was unable to find both libraries during the build (although development headers were installed!). And that --disable-python switch has been introduced after samba-4.6.9, but is only usable in the 4.7 releases. Let's try to build samba-4.7.4 now: CC=aarch64-linux-gnu-gcc buildtools/bin/waf build --cross-compile \ --cross-execute="/usr/bin/qemu-aarch64 /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 --library-path /usr/aarch64-linux-gnu/lib/" And this breaks of course with the error mentioned in this bug. Install the wrapper scripts: $ mv bin/default/source4/heimdal_build/asn1_compile{,.orig} $ mv bin/default/source4/heimdal_build/compile_et{,.orig} $ ln -s /usr/local/bin/asn1_compile bin/default/source4/heimdal_build/asn1_compile $ ln -s /usr/local/bin/compile_et bin/default/source4/heimdal_build/compile_et The wrapper scripts basically do this: $ cat /usr/local/bin/asn1_compile #!/bin/sh /usr/bin/qemu-aarch64 /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 --library-path /usr/aarch64-linux-gnu/lib/ \ /usr/local/src/samba-git/bin/default/source4/heimdal_build/asn1_compile.orig $@ With that in place, the next call to "build" should work: CC=aarch64-linux-gnu-gcc buildtools/bin/waf build --cross-compile \ --cross-execute="/usr/bin/qemu-aarch64 /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 --library-path /usr/aarch64-linux-gnu/lib/" Note: the build still broke because of two unrelated PAM compilation errors but with two patches applied[0] (resp. reverted[1]), the samba-4.7.4 build completed. [0] https://lists.samba.org/archive/samba-technical/2011-September/079270.html [1] https://lists.samba.org/archive/samba/2017-December/212930.html
We should probably just fail to compile with the internal Heimdal for the cross-compile and suggest --with-system-mitkrb5 as this is likely what the caller wants anyway.
(naturally patches to fix this are also most welcome)