On 8/4/19 1:18 PM, Bruce Dubbs via blfs-dev wrote:
We currently have a ticket, http://wiki.linuxfromscratch.org/blfs/ticket/12304, that addresses a problem introduced by the 5.2 kernel headers.

The problem is that the definitions for SIOCGSTAMP and SIOCGSTAMPNS were moved from bits/socket.h.  I'll note here that the man page for sockets (man 7 socket) sill lists sys/socket.h as the only needed include file.

So far we have identified the following packages as being identified.

qt5
qtwebengine
bluez
firefox
qemu

There may be others we haven't found yet.

What we have done so far is to substitute the magic number that equates to the missing values to get the packages to build:

sed -i 's/SIOCGSTAMP/0x8906/'  <filename>

although this works as a crude workaround, it is a hack and there are other alternatives.


In older kernels we have
  sys/socket.h which includes
    bits/socket.h

In the 5.2 kernel a check on what additional include files are brought into a file when /sys/socket.h is specified, I find the following relevant files:

# 1   "/usr/include/asm/sockios.h" 1 3 4
# 1   "/usr/include/asm-generic/sockios.h" 1 3 4
# 7   "/usr/include/asm-generic/socket.h" 2 3 4
# 1   "/usr/include/asm/socket.h" 2 3 4
# 355 "/usr/include/bits/socket.h" 2 3 4
# 1   "/usr/include/bits/types/struct_osockaddr.h" 1 3 4

SIOCGSTAMP is defined in <linux/sockios.h> as

/* Get stamp (timeval) */
#define SIOCGSTAMP_NEW   _IOR(SOCK_IOC_TYPE, 0x06, long long[2])
/* Get stamp (timespec
#define SIOCGSTAMPNS_NEW _IOR(SOCK_IOC_TYPE, 0x07, long long[2])

#if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
/* on 64-bit and x32, avoid the ?: operator */
#define SIOCGSTAMP      SIOCGSTAMP_OLD
#define SIOCGSTAMPNS    SIOCGSTAMPNS_OLD
#else
#define SIOCGSTAMP      ((sizeof(struct timeval))  == 8 ? \
                         SIOCGSTAMP_OLD   : SIOCGSTAMP_NEW)
#define SIOCGSTAMPNS    ((sizeof(struct timespec)) == 8 ? \
                         SIOCGSTAMPNS_OLD : SIOCGSTAMPNS_NEW)
#endif

Which means that for a common 64 bit system, SIOCGSTAMP is defined as SIOCGSTAMP_OLD.  The problem is that SIOCGSTAMP_OLD is defined in <asm-generic/sockios.h> and that is not brought into the system by default.

I note here that asm-generic/sockios.h only consists of 7 #define statements.

I see three options for this problem, none of which are optimal.

1.  Continue to use the sed hack we have been using.
    Advantage: Simple sed.
    Disadvantages: Introduces a 'magic' number.
                   Requires finding and changing all affected source
                   files.

2.  Use a different sed to add asm-generic/sockios.h as an include in
    the affected files.
    Advantage: A more conventional change.
    Disadvantages: The sed would have to be customized for placement
                   in each affected file.
                   Requires finding and changing all affected source
                   files.

3. Modify bits/socket.h to include asm-generic/sockios.h in LFS.
   Advantages:  Only requires a change in one place.
                Simple.
   Disadvantage: Requires modification of a glibc header which we
                 have never done. Additionally asm-generic/sockios.h
                 is a kernel file, but bits/socket.h is a glibc file.

My current opinion is option 3 because it is the least intrusive change overall, but I am looking for feedback.

  -- Bruce


My opinion is to go with Option 3 because it's what is being done in upstream glibc:

https://sourceware.org/git/?p=glibc.git;a=commit;h=c1d1e0c9f242f03521ef023a0e2cac071b5f0133

See the fw/linux-5.2 repo for more details on that

--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to