Bug 14100 - samba 4.10.7 fails to compile on systems with glibc >= 2.30
Summary: samba 4.10.7 fails to compile on systems with glibc >= 2.30
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.10.7
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2019-08-22 17:08 UTC by Timo Gurr
Modified: 2020-03-31 04:47 UTC (History)
3 users (show)

See Also:

samba-glibc.tar.bz2 (464.28 KB, application/x-bzip)
2019-08-23 15:03 UTC, Timo Gurr
no flags Details
patch to remove stropts.h include from network.h (324 bytes, patch)
2019-08-27 13:47 UTC, Reuben Farrelly
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timo Gurr 2019-08-22 17:08:57 UTC
Upstream release notes for glibc 2.30 https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html state that <stropts.h> has been removed:

* The obsolete and never-implemented XSI STREAMS header files <stropts.h>
  and <sys/stropts.h> have been removed.

which results in a build failure of lib/replace:

In file included from ../../source4/heimdal_build/krb5-types.h:8,
                 from ../../source4/heimdal/lib/krb5/krb5.h:42,
                 from ../../lib/replace/system/kerberos.h:33,
                 from ../../auth/credentials/pycredentials.c:34:
../../lib/replace/system/network.h:91:10: fatal error: stropts.h: No such file or directory
 #include <stropts.h>
compilation terminated.

I used following workaround to build samba 4.10.7 on a system with glibc 2.30 installed:

edo sed \
    -e '/HAVE_STROPTS_H/,+2 d' \
    -i lib/replace/system/network.h

Would be nice to see this fixed upstream.
Comment 1 Andrew Bartlett 2019-08-22 23:29:31 UTC
Can you determine why the configure check for stropts.h passed?  See bin/config.log

Is HAVE_STROPTS_H in config.h?

Did you re-configure Samba after the upgrade to glibc 2.30?
Comment 2 Timo Gurr 2019-08-23 15:03:26 UTC
(In reply to Andrew Bartlett from comment #1)

> Is HAVE_STROPTS_H in config.h?
Doesn't seem to be the case.

> Did you re-configure Samba after the upgrade to glibc 2.30?
Yes, it's a completely clean environment.

I'm trying to attach a tarball of the relevant logs/files (they're quite big), including a complete build log, bin/config.log and bin/default/include/config.h.
Comment 3 Timo Gurr 2019-08-23 15:03:52 UTC
Created attachment 15422 [details]
Comment 4 Reuben Farrelly 2019-08-24 10:35:41 UTC
Adding this as an additional report, as I'm also observing this build breakage too with samba 4.10.7, also with glibc-2.30.  This is with a Gentoo x86_64 system.

Configure shows:

Checking for header mntent.h                                 : yes 
Checking for header stropts.h                                : no 
Checking for header unix.h                                   : no 

So it seems the system knows that the header doesn't exist, but still tries to include it nonetheless.
Comment 5 Reuben Farrelly 2019-08-27 13:47:59 UTC
Created attachment 15437 [details]
patch to remove stropts.h include from network.h

The attached patch fixed it for me, by removing the include from lib/replace/system/network.h .  I don't think it's necessarily correct (because autodetection perhaps should pick up on this anyway) but it does suggest that the include isn't required at least on glibc-2.30, and possibly other systems.
Comment 6 Christian Ehrhardt 2019-09-04 08:12:33 UTC
I just hit the same on Ubuntu.
It has the same ingredients of a recent samba 4.10.7 and glibc 2.30.

BTW the glibc change that dropped stropts.h was [1].

Like the other reporters I wondered why stropts.h would be included since the header detection clearly recognized that it is missing.

Since the build is always in a clean environment that came down to a local grep and that found the stray HAVE_STROPTS_H definition.

/usr/include/x86_64-linux-gnu/python3.7m/pyconfig.h:986:#define HAVE_STROPTS_H 1

That is due to pycredentials.c including python headers which will include pyconfig.h. The solution is to re-generate python with a rebuild against the new glibc which for Ubuntu I requested in [2].

The other projects/distros might do the same rebuild and be good for now.
In the long run samba might consider to undefine all external HAVE_* that might pollute the samba build that way, but that certainly is a bigger change.

[1]: https://github.com/bminor/glibc/commit/a0a0dc83173ce11ff45105fd32e5d14356cdfb9c
[2]: https://bugs.launchpad.net/ubuntu/+source/python3.7/+bug/1842618
Comment 7 Ian Kumlien 2019-12-17 13:47:44 UTC
Why hasn't this patch been applied?
Comment 8 Andrew Bartlett 2020-03-31 04:36:18 UTC
Comment 9 Andrew Bartlett 2020-03-31 04:47:53 UTC
See also https://bugs.gentoo.org/699668

This is a Python issue.  Python incorrectly defines HAVE_STROPTS_H based on what the system had when Python was configured, but provides that to applications like Samba developed against Python.

As I read the manpages, on strict POSIX systems, ioctl (likely the header network.h was looking for) is in stropts.h, but on Linux and FreeBSD it is in sys/ioctl.h.

So, to remove this we would break Solaris, as I read it.

The bug is in Python, it needs to be fixed in Python, in my view. 

If that isn't possible, the #define Samba uses and detects from waf will need to be renamed, or a build done on an OpenSolaris clone to show that removing this is harmless due to other things including the right headers.