Go to file
Thomas Petazzoni 88d6fead97 package/ibm-sw-tpm2: re-fix build with uClibc-ng and older glibcs
In commit 26e37cef16, we started using
__WORDSIZE to get the size of longs on the given architecture, in
order to support all CPU architectures.

Unfortunately, __WORDSIZE is not enabled in musl, so in
19bd089004, we switched to using
LONG_BIT instead of __WORDSIZE.

However, LONG_BIT is not readily available on glibc, you need
_XOPEN_SOURCE to be defined, which was done in
a34e7f88f6.

However, in a34e7f88f6, _XOPEN_SOURCE
was just defined, with no specific value. This caused the build to
break again on uClibc-ng and older glibcs, because clock_gettime() and
CLOCK_MONOTONIC were no longer defined. In both uClibc-ng and glibc,
CLOCK_MONOTONIC is only defined if __USE_POSIX199309 is defined. It
turns out that simply defining _XOPEN_SOURCE with no value does not
lead to __USE_POSIX199309 being defined in uClibc-ng and old glibcs,
while it is defined in newer glibcs.

The difference comes from the following snippet of code, which is
present in recent enough glibc's <feature.h> but not uClibc-ng's or
older glibc's <feature.h>:

/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
   is defined, use POSIX.1-2008 (or another version depending on
   _XOPEN_SOURCE).  */

So the fact that we are defining _DEFAULT_SOURCE makes it assume that
we're using POSIX 2008.09, which obviously includes POSIX 1993.09.

Due to the lack of this code snippet, uClibc-ng <features.h> only
enables:

     !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)

but not:

So we need an _XOPEN_SOURCE level of at least 500 for POSIX 1993.09
definitions to be available.

This is confirmed by the feature_test_macros man page, which states:

                  _XOPEN_SOURCE < 500
                         _POSIX_C_SOURCE is defined with the value 2.

                  500 <= _XOPEN_SOURCE < 600
                         _POSIX_C_SOURCE is defined with the value 199506L.

When this is fixed, another issue arises with older glibc toolchains
(such as Sourcery ARM), where fd_set is no longer defined. Inded, with
POSIX-1.2001 being enabled, we need to include <sys/select.h> to
access the fd_set definition and friends (see man fd_set for details).

This commit was tested with two glibc toolchains (recent and old), one
uClibc-ng toolchain and one musl toolchain.

Fixes:

  http://autobuild.buildroot.net/results/e20f9474fc0217036faa6561df33fa983466ddfe/
  (uClibc-ng)

  http://autobuild.buildroot.net/results/b5d944389fc96ef2c5e0608fe4ac34149e5f9739/
  (glibc)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Acked-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit dac45969b6)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-08-28 23:25:37 +02:00
arch arch/x86: adds BR2_X86_CPU_HAS_3DNOW flag 2020-07-16 18:19:11 +02:00
board board/raspberrypi: fix rpi4/rpi4-64 genimage config files 2020-07-22 09:06:20 +02:00
boot boot/uboot: Fix kconfig to use $(BR2_MAKE) 2020-08-28 16:54:20 +02:00
configs configs/raspberrypi{3, 4}_64: enabling BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT no longer needed 2020-05-16 21:41:16 +02:00
docs docs/manual/adding-packages-cargo.txt: drop debug profile 2020-08-28 19:07:38 +02:00
fs fs/cpio: generate reproducible archives 2020-07-16 18:33:21 +02:00
linux {linux, linux-headers}: bump 4.{4, 9, 14, 19}.x / 5.{4, 7}.x series 2020-08-28 19:12:16 +02:00
package package/ibm-sw-tpm2: re-fix build with uClibc-ng and older glibcs 2020-08-28 23:25:37 +02:00
support support/scripts/pkg-stats: drop erroneous "break" in CVE.affects() 2020-08-28 19:29:42 +02:00
system package/systemd: make sure init choice and package have same dependencies 2020-04-05 20:33:36 +02:00
toolchain toolchain/toolchain-wrapper: let recent GCC handle SOURCE_DATE_EPOCH 2020-07-16 18:32:17 +02:00
utils utils/scanpypi: use raw strings in re.compile/re.sub 2020-08-28 18:34:34 +02:00
.defconfig arch: remove support for sh64 2016-09-08 22:15:15 +02:00
.flake8 .flake8: fix check for 80/132 columns 2019-04-10 12:31:33 +02:00
.gitignore
.gitlab-ci.yml gitlab-ci: convert only/except to rules 2020-08-13 11:44:11 +02:00
.gitlab-ci.yml.in gitlab-ci: convert only/except to rules 2020-08-13 11:44:11 +02:00
CHANGES Update for 2020.05.1 2020-07-25 09:32:14 +02:00
Config.in Config.in: update BR2_OPTIMIZE_FAST prompt and help text 2020-07-22 13:38:46 +02:00
Config.in.legacy package/wiringpi: remove 2020-05-25 22:48:44 +02:00
COPYING
DEVELOPERS DEVELOPERS: drop Maxime Ripard from kmsxx maintainers 2020-08-28 18:38:32 +02:00
Makefile Makefile: properly account for custom tags in BR2_VERSION_FULL 2020-08-13 20:05:03 +02:00
Makefile.legacy Remove BR2_DEPRECATED 2016-10-15 23:14:45 +02:00
README

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on Freenode IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches