Bug 13856 - Samba 4.10.0 cross-compile issue when compiling Heimdal
Samba 4.10.0 cross-compile issue when compiling Heimdal
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build
4.10.0
All All
: P5 normal
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-03-22 12:57 UTC by Neil MacLeod
Modified: 2019-07-29 05:43 UTC (History)
3 users (show)

See Also:


Attachments
4.9.5 configuration (5.92 KB, text/plain)
2019-04-03 00:29 UTC, Neil MacLeod
no flags Details
4.10.0 configuration (5.95 KB, text/plain)
2019-04-03 00:29 UTC, Neil MacLeod
no flags Details
4.9.5 build log (Successful) (551.38 KB, text/plain)
2019-04-03 00:31 UTC, Neil MacLeod
no flags Details
4.10.0 build log (Failure) (250.24 KB, text/plain)
2019-04-03 00:31 UTC, Neil MacLeod
no flags Details
Samba 4.10.6 build failure (248.92 KB, application/octet-stream)
2019-07-09 19:15 UTC, Neil MacLeod
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Neil MacLeod 2019-03-22 12:57:03 UTC
We build Samba for LibreELEC, a custom Linux distribution, cross-compiling with our own gcc-8.3.0 toolchain.

We patch gcc to detect incorrect build host include usage when building for the target[1].

We are able to build Samba 4.9.5 with Heimdal 7.5.0[2] without issue (successful build log[3]) - all is good.

However, we are seeing a cross-compile problem with Samba 4.10.0[4], which now triggers a cross-compilation failure when building the "embedded" Heimdal.

Specifically, /usr/include/heimdal is being used by the Samba 4.10.0 build process which is incorrect when cross-compiling, and this did not happen with Samba 4.9.5.

This is the Samba 4.9.5 configuration: http://ix.io/1DXj

And this is the Samba 4.10.0 configuration: http://ix.io/1DXi (I'm including the fix for https://bugzilla.samba.org/show_bug.cgi?id=13844)

Any ideas why this cross-compile problem happens with Samba 4.10.0 but does NOT happen with Samba 4.9.5?

Note: The "link" error and truncation warnings may also be of interest - the truncation warning is also present in 4.9.5 (search for "_heim_time2generalizedtime").

1. https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/lang/gcc/patches/gcc-crosscompile-badness.patch
2. https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/devel/heimdal/package.mk
3. http://ix.io/1E26
4. http://ix.io/1E1W
Comment 1 David Disseldorp 2019-03-22 13:22:15 UTC
As discussed on IRC, the explicit include path added via source4/heimdal_build/wscript_build appears to be responsible for the failure, but I don't know why it wasn't causing issues with the 4.9 build.

I'm also a little confused as to why heimdal is even built, given the --without-winbind --without-ads --without-ad-dc configure invocation.
Comment 2 Andrew Bartlett 2019-04-03 00:12:58 UTC
(In reply to David Disseldorp from comment #1)
We still use the internal heimdal unless --with-system-mitkrb5 or --with-system-heimdalkrb5

This specifically allowed us to upgrade our minimum kerberos requirement because we could fall back on the internal one (a bit like the way we use third_party).
Comment 3 Neil MacLeod 2019-04-03 00:29:19 UTC
Created attachment 15036 [details]
4.9.5 configuration
Comment 4 Neil MacLeod 2019-04-03 00:29:51 UTC
Created attachment 15037 [details]
4.10.0 configuration
Comment 5 Neil MacLeod 2019-04-03 00:31:21 UTC
Created attachment 15038 [details]
4.9.5 build log (Successful)
Comment 6 Neil MacLeod 2019-04-03 00:31:50 UTC
Created attachment 15039 [details]
4.10.0 build log (Failure)
Comment 7 Neil MacLeod 2019-07-09 19:15:08 UTC
Created attachment 15296 [details]
Samba 4.10.6 build failure

This is still a problem when building 4.10.6.

4.9.11 builds fine.
Comment 8 andieq 2019-07-10 13:20:32 UTC
(In reply to Neil MacLeod from comment #7)

You need this patch for musl as well: https://github.com/Andy2244/openwrt-extra/blob/master/samba4/patches/006-samba-4-10-musl_rm_unistd_incl.patch

Just got 4.10.6 working for openwrt, so maybe compare our version/patches with your LibreELEC version.
Comment 9 Neil MacLeod 2019-07-10 17:21:06 UTC
Hi @andieq, many thanks for the suggestion but unfortunately it had no effect - Samba 4.10.x continues to fail as before. To be honest I wasn't expecting it to fix this issue as we build with glibc.

This is my Samba 4.10 development branch:

https://github.com/LibreELEC/LibreELEC.tv/compare/master...MilhouseVH:le10_samba-4.10.0

There's not much change from 4.9.11, but Samba 4.10.x no longer cross-compiles due to the WAF build system pulling in the host includes rather than from the sysroot. Note that this failure is a custom modification to gcc so you may not see it in your build system:

https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/lang/gcc/patches/gcc-crosscompile-badness.patch

We are using an external Heimdal (heimdal-7.7), but that hasn't changed from 4.9.x.

I don't think additional cross-answers are required by 4.10, the cross-answers file I'm using is here:

https://github.com/MilhouseVH/LibreELEC.tv/blob/17eb8c954d1742e7b89e4bdb36e8714af7f34156/packages/network/samba/config/samba4-cache.txt

Looking at your repo it appears you didn't need to make any cross-answer modifications.
Comment 10 andieq 2019-07-11 08:15:22 UTC
(In reply to Neil MacLeod from comment #9)

Ah just noticed the "link" redefinition, which i also got on musl, so had to grab the Alpine patch for it. Was assuming you guys also use musl, sorry this dind't work for you.

Yeah no cross-answer changes, i needed the 2 waf cross-compile patches, the gnutls patch and the musl one. Other than that "waf install --destdir" wasn't working anymore, so now have to manually grab everything from /bin....

I also could not get the AD_DC version building, because it pulls in mixed lib's (target/host) on it trying to build the "python embedded interpreter". Something is different from python2 to 3....