Skip to contentSkip to conversation

package/libselinux: fix build with BR2_TIME_BITS_64

PATCH Applied Fabrice Fontaine 3 participants 6 messages Nov 30, 2023 – Mar 3, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libselinux: fix build with BR2_TIME_BITS_64

Do not remove _FILE_OFFSET_BITS=64 from CFLAGS and CPPFLAGS to avoid the following build failure with BR2_TIME_BITS_64 raised since commit 3c427c64726560ea1743282a3fdb78f5b28692eb:

In file included from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features.h:394,

                 from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/bits/libc-header-start.h:33,
                 from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/stdint.h:26,
                 from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/lib/gcc/mipsel-buildroot-linux-gnu/12.3.0/include/stdint.h:9,
                 from ../include/selinux/avc.h:9,
                 from avc.c:10:
/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
   26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
      |     ^~~~~

This LFS workaround for glibc < 2.23 was added in 2016 by commit ebcca24c953d8df4b16bc52c5ba31feae4ed8ad0 and is probably not needed anymore as glibc 2.23 was released in February 2016:
https://sourceware.org/glibc/wiki/Release/2.23

Fixes:
- http://autobuild.buildroot.org/results/d85c81f87adf3a5945fa369bcec233e6def2ed12

---
 package/libselinux/libselinux.mk | 8 --------
 1 file changed, 8 deletions(-)
package/libselinux/libselinux.mk +0 -8
index b8de21edaa..529745f82e 100644
@@ -52,14 +52,6 @@ define LIBSELINUX_BUILD_PYTHON_BINDINGS
 endef
 endif # python3
 
-# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22. We
-# set CFLAGS, CPPFLAGS and LDFLAGS here because we want to win over the
-# CFLAGS/CPPFLAGS/LDFLAGS definitions passed by $(PKG_PYTHON_DISTUTILS_ENV)
-# when the python binding is enabled.
-LIBSELINUX_MAKE_OPTS += \
-	CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
-	CPPFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))"
-
 define LIBSELINUX_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		$(LIBSELINUX_MAKE_OPTS) all
Signature · 6 lines
2.42.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Do not remove _FILE_OFFSET_BITS=64 from CFLAGS and CPPFLAGS to avoid the following build failure with BR2_TIME_BITS_64 raised since commit 3c427c64726560ea1743282a3fdb78f5b28692eb:

In file included from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features.h:394,

                 from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/bits/libc-header-start.h:33,
                 from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/stdint.h:26,
                 from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/lib/gcc/mipsel-buildroot-linux-gnu/12.3.0/include/stdint.h:9,
                 from ../include/selinux/avc.h:9,
                 from avc.c:10:
/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
   26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
      |     ^~~~~
Quoted 7 lines

This LFS workaround for glibc < 2.23 was added in 2016 by commit ebcca24c953d8df4b16bc52c5ba31feae4ed8ad0 and is probably not needed anymore as glibc 2.23 was released in February 2016:
https://sourceware.org/glibc/wiki/Release/2.23

Fixes:
- http://autobuild.buildroot.org/results/d85c81f87adf3a5945fa369bcec233e6def2ed12

Hmm, probably. We do have similar code elsewhere as well though, presumably that needs to be removed as well?

git grep 'filter-out.*D_FILE_OFFSET_BITS=' package/**/*mk package/elfutils/elfutils.mk:ELFUTILS_CFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS)) package/elfutils/elfutils.mk:ELFUTILS_CPPFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))

package/libselinux/libselinux.mk:       CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
package/libselinux/libselinux.mk:       CPPFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))"
package/ltp-testsuite/ltp-testsuite.mk:LTP_TESTSUITE_CFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))
package/ltp-testsuite/ltp-testsuite.mk:LTP_TESTSUITE_CPPFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))
package/musl/musl.mk:           CFLAGS="$(filter-out -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS)) $(MUSL_EXTRA_CFLAGS)" \
package/musl/musl.mk:           CPPFLAGS="$(filter-out -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))" \
Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi,

Quoted 28 lines · Peter Korsgaard
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Do not remove _FILE_OFFSET_BITS=64 from CFLAGS and CPPFLAGS to avoid the following build failure with BR2_TIME_BITS_64 raised since commit 3c427c64726560ea1743282a3fdb78f5b28692eb:

In file included from

/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features.h:394,

Quoted 1 line

from

/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/bits/libc-header-start.h:33,

Quoted 1 line

from

/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/stdint.h:26,

Quoted 1 line

from

/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/lib/gcc/mipsel-buildroot-linux-gnu/12.3.0/include/stdint.h:9,

Quoted 3 lines
                 from ../include/selinux/avc.h:9,
                 from avc.c:10:

/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features-time64.h:26:5:
error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"

Quoted 1 line

26 | # error "_TIME_BITS=64 is allowed only with

_FILE_OFFSET_BITS=64"

Quoted 6 lines
      |     ^~~~~

This LFS workaround for glibc < 2.23 was added in 2016 by commit ebcca24c953d8df4b16bc52c5ba31feae4ed8ad0 and is probably not needed anymore as glibc 2.23 was released in February 2016:
https://sourceware.org/glibc/wiki/Release/2.23

Quoted 7 lines
Quoted 2 lines

Fixes:
-

http://autobuild.buildroot.org/results/d85c81f87adf3a5945fa369bcec233e6def2ed12

Hmm, probably. We do have similar code elsewhere as well though, presumably that needs to be removed as well?

Yes, but before sending a bunch of patches, I wanted to get your feedback on this one to avoid wasting time.

Quoted 22 lines

git grep 'filter-out.*D_FILE_OFFSET_BITS=' package/**/*mk package/elfutils/elfutils.mk:ELFUTILS_CFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS)) package/elfutils/elfutils.mk:ELFUTILS_CPPFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))
package/libselinux/libselinux.mk: CFLAGS="$(filter-out
-D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
package/libselinux/libselinux.mk: CPPFLAGS="$(filter-out
-D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))" package/ltp-testsuite/ltp-testsuite.mk:LTP_TESTSUITE_CFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS)) package/ltp-testsuite/ltp-testsuite.mk:LTP_TESTSUITE_CPPFLAGS = $(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))
package/musl/musl.mk: CFLAGS="$(filter-out -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS)) $(MUSL_EXTRA_CFLAGS)" \
package/musl/musl.mk: CPPFLAGS="$(filter-out

(quoted diff) +0 -3
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))" \
 
--
Quoted 2 lines

Bye, Peter Korsgaard

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Fabrice Fontaine
Quoted 4 lines · On Thu, 30 Nov 2023 20:13:05 +0100 Fabrice Fontaine…

This LFS workaround for glibc < 2.23 was added in 2016 by commit ebcca24c953d8df4b16bc52c5ba31feae4ed8ad0 and is probably not needed anymore as glibc 2.23 was released in February 2016:
https://sourceware.org/glibc/wiki/Release/2.23

We still have in our external toolchains toolchain/toolchain-external/toolchain-external-codesourcery-arm/, which is a toolchain from 2014, and it uses glibc 2.18. So I suspect this change would break with this glibc toolchain. However, this older glibc toolchain will clearly not support 64-bit time_t.

So either we decide that we stop supporting anything older than glibc 2.23, or we have to add some condition on the version of glibc being used.

Let's see the opinion of the other maintainers.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
Quoted 8 lines · Thomas Petazzoni
Quoted 4 lines · On Thu, 30 Nov 2023 20:13:05 +0100 Fabrice Fontaine…

This LFS workaround for glibc < 2.23 was added in 2016 by commit ebcca24c953d8df4b16bc52c5ba31feae4ed8ad0 and is probably not needed anymore as glibc 2.23 was released in February 2016:
https://sourceware.org/glibc/wiki/Release/2.23

Quoted 5 lines

We still have in our external toolchains toolchain/toolchain-external/toolchain-external-codesourcery-arm/, which is a toolchain from 2014, and it uses glibc 2.18. So I suspect this change would break with this glibc toolchain. However, this older glibc toolchain will clearly not support 64-bit time_t.

I'm in favour of removing that ancient toolchain.

In fact, I don't think many of the external toolchains are still useful -
other than the Bootlin toolchains of course.

Quoted 3 lines

So either we decide that we stop supporting anything older than glibc 2.23, or we have to add some condition on the version of glibc being used.

Yeah, I'm in favour of silently assuming that glibc is sufficiently recent. We
already do that for uClibc BTW.

Regards,
Arnout
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
In reply to Fabrice Fontaine
Quoted 19 lines · Fabrice Fontaine

Do not remove _FILE_OFFSET_BITS=64 from CFLAGS and CPPFLAGS to avoid the following build failure with BR2_TIME_BITS_64 raised since commit 3c427c64726560ea1743282a3fdb78f5b28692eb:

In file included from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features.h:394,

                  from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/bits/libc-header-start.h:33,
                  from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/stdint.h:26,
                  from /home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/lib/gcc/mipsel-buildroot-linux-gnu/12.3.0/include/stdint.h:9,
                  from ../include/selinux/avc.h:9,
                  from avc.c:10:
/home/autobuild/autobuild/instance-9/output-1/per-package/libselinux/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
    26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
       |     ^~~~~

This LFS workaround for glibc < 2.23 was added in 2016 by commit ebcca24c953d8df4b16bc52c5ba31feae4ed8ad0 and is probably not needed anymore as glibc 2.23 was released in February 2016:
https://sourceware.org/glibc/wiki/Release/2.23

Quoted 4 lines

Fixes:
- http://autobuild.buildroot.org/results/d85c81f87adf3a5945fa369bcec233e6def2ed12

Applied to master, thanks.

As pointed out by Thomas, this will (probably) break the build with the
codesourcery-arm toolchain, so that toolchain should be removed as well...

Regards,
Arnout

Quoted 13 lines
---
  package/libselinux/libselinux.mk | 8 --------
  1 file changed, 8 deletions(-)
package/libselinux/libselinux.mk +0 -1
index b8de21edaa..529745f82e 100644
@@ -52,14 +52,6 @@ define LIBSELINUX_BUILD_PYTHON_BINDINGS
  endef
  endif # python3
 
-# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22. We

package/libselinux/libselinux.mk define LIBSELINUX_BUILD_PYTHON_BINDINGS · line 57

Quoted 10 lines
package/libselinux/libselinux.mk +0 -7
-# set CFLAGS, CPPFLAGS and LDFLAGS here because we want to win over the
-# CFLAGS/CPPFLAGS/LDFLAGS definitions passed by $(PKG_PYTHON_DISTUTILS_ENV)
-# when the python binding is enabled.
-LIBSELINUX_MAKE_OPTS += \
-	CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
-	CPPFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))"
-
  define LIBSELINUX_BUILD_CMDS
  	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
  		$(LIBSELINUX_MAKE_OPTS) all

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot