[Bug 267678] lang/gcc11: fatal error: sys/_types.h: No such file or directory building u-boot

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 10 Nov 2022 00:32:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267678

            Bug ID: 267678
           Summary: lang/gcc11: fatal error: sys/_types.h: No such file or
                    directory building u-boot
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: salvadore@freebsd.org
          Reporter: saper@saper.info
             Flags: maintainer-feedback?(salvadore@freebsd.org)
          Assignee: salvadore@freebsd.org

I am running pretty fresh FreeBSD 14.0-CURRENT #3 main-75217c2b470: Sat Nov  5
00:59:18 CET 2022 and trying to build u-boot from source using the "sandbox"
(userland process) target.

I have gcc11 installed from packages:


gcc11-11.3.0_2
Name           : gcc11
Version        : 11.3.0_2
Installed on   : Mon Nov  7 17:26:32 2022 CET
Origin         : lang/gcc11
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : lang
Licenses       : GPLv3RLE and GPLv3
Maintainer     : salvadore@FreeBSD.org
WWW            : https://gcc.gnu.org
Comment        : GNU Compiler Collection 11
Options        :
        GRAPHITE       : off
        LTO_BOOTSTRAP  : on
        MULTILIB       : on
        STANDARD_BOOTSTRAP: off


$ git clone https://source.denx.de/u-boot/u-boot.git
$ cd u-boot
$ mkdir /big/build
$ export KBUILD_OUTPUT=/big/build
$ env LANG=C  gmake sandbox_spl_defconfig V=1 
gmake -C /big/build KBUILD_SRC=/big/sw/u-boot \
-f /big/sw/u-boot/Makefile sandbox_spl_defconfig
gmake[1]: Entering directory '/big/build'
gmake -f /big/sw/u-boot/scripts/Makefile.build obj=scripts/basic
  cc -Wp,-MD,scripts/basic/.fixdep.d -Iscripts/basic -Wall -Wstrict-prototypes
-O2 -fomit-frame-pointer -std=gnu11   -o scripts/basic/fixdep
/big/sw/u-boot/scripts/basic/fixdep.c   
rm -f .tmp_quiet_recordmcount
ln -fsn /big/sw/u-boot source
/bin/bash /big/sw/u-boot/scripts/mkmakefile /big/sw/u-boot
  GEN     Makefile
gmake -f /big/sw/u-boot/scripts/Makefile.build obj=scripts/kconfig
sandbox_spl_defconfig
  cc -Wp,-MD,scripts/kconfig/.conf.o.d -Iscripts/kconfig -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11 -c -o
scripts/kconfig/conf.o /big/sw/u-boot/scripts/kconfig/conf.c
  bison -oscripts/kconfig/zconf.tab.c -t -l
/big/sw/u-boot/scripts/kconfig/zconf.y
  flex -oscripts/kconfig/zconf.lex.c -L /big/sw/u-boot/scripts/kconfig/zconf.l
  cc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Iscripts/kconfig -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11 
-I/big/sw/u-boot/scripts/kconfig -c -o scripts/kconfig/zconf.tab.o
scripts/kconfig/zconf.tab.c
  cc   -o scripts/kconfig/conf scripts/kconfig/conf.o
scripts/kconfig/zconf.tab.o   
scripts/kconfig/conf  --defconfig=arch/../configs/sandbox_spl_defconfig Kconfig
#
# configuration written to .config
#
gmake[1]: Leaving directory '/big/build'

$ cd /big/build
$ > env LANG=C gmake V=1
gmake -C /big/sw/u-boot O=/big/build 
gmake -C /big/build KBUILD_SRC=/big/sw/u-boot \
-f /big/sw/u-boot/Makefile 
gmake -f /big/sw/u-boot/Makefile syncconfig
gmake -f /big/sw/u-boot/scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
ln -fsn /big/sw/u-boot source
/bin/bash /big/sw/u-boot/scripts/mkmakefile /big/sw/u-boot
  GEN     Makefile
gmake -f /big/sw/u-boot/scripts/Makefile.build obj=scripts/kconfig syncconfig
scripts/kconfig/conf  --syncconfig Kconfig
gmake -f /big/sw/u-boot/scripts/Makefile.autoconf || \
        { rm -f include/config/auto.conf; false; }
set -e; mkdir -p include/;      (echo "/* Automatically generated - do not edit
*/"; echo \#define CONFIG_BOARDDIR board/sandbox; echo \#include
\<config_uncmd_spl.h\>; echo \#include \<configs/"sandbox_spl".h\>; echo
\#include \<asm/config.h\>; echo \#include \<linux/kconfig.h\>; echo \#include
\<config_fallbacks.h\>;) < /big/sw/u-boot/scripts/Makefile.autoconf >
include/config.h.tmp; if [ -r include/config.h ] && cmp -s include/config.h
include/config.h.tmp; then rm -f include/config.h.tmp; else : '  UPD    
include/config.h'; mv -f include/config.h.tmp include/config.h; fi
  gcc -E -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin
-ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE
-fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign
-Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds
-Wno-stringop-overflow -Wno-maybe-uninitialized
-fmacro-prefix-map=/big/sw/u-boot/= -g -fstack-usage -Wno-format-nonliteral
-Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time
-Wno-packed-not-aligned  -D__KERNEL__ -D__UBOOT__ -D__SANDBOX__
-U_FORTIFY_SOURCE -fPIC -I/usr/local/include/SDL2 -I/usr/local/include
-D_REENTRANT -D_THREAD_SAFE -pipe -Iinclude  -I/big/sw/u-boot/include
-I/big/sw/u-boot/arch/sandbox/include -include
/big/sw/u-boot/include/linux/kconfig.h -nostdinc -isystem
/usr/local/lib/gcc11/gcc/x86_64-portbld-freebsd14.0/11.3.0/include 
-DDO_DEPS_ONLY -dM /big/sw/u-boot/include/common.h > u-boot.cfg.tmp && { grep
'define CONFIG_' u-boot.cfg.tmp | sed '/define CONFIG_IS_ENABLED(/d;/define
CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > u-boot.cfg; rm
u-boot.cfg.tmp; } || { rm u-boot.cfg.tmp; false; }
In file included from /big/sw/u-boot/include/compiler.h:8,
                 from /big/sw/u-boot/include/env_internal.h:77,
                 from /big/sw/u-boot/include/common.h:31:
/usr/local/lib/gcc11/gcc/x86_64-portbld-freebsd14.0/11.3.0/include/stddef.h:54:10:
fatal error: sys/_types.h: No such file or directory
   54 | #include <sys/_types.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
gmake[3]: *** [/big/sw/u-boot/scripts/Makefile.autoconf:82: u-boot.cfg] Error 1
gmake[2]: *** No rule to make target 'include/config/auto.conf', needed by
'include/config/uboot.release'.  Stop.
gmake[1]: *** [Makefile:177: sub-make] Error 2
gmake: *** [Makefile:15: __sub-make] Error 2


Simple way to reproduce it without using u-boot:

$ printf "#include <stddef.h>\nmain(){}" > a.c
$ gcc11 -nostdinc -isystem
/usr/local/lib/gcc11/gcc/x86_64-portbld-freebsd14.0/11.3.0/include -E  -c a.c

The output is:


# 0 "a.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "a.c"
# 1
"/usr/local/lib/gcc11/gcc/x86_64-portbld-freebsd14.0/11.3.0/include/stddef.h" 1
3 4
In file included from a.c:1:
/usr/local/lib/gcc11/gcc/x86_64-portbld-freebsd14.0/11.3.0/include/stddef.h:54:10:
fatal error: sys/_types.h: No such file or directory
   54 | #include <sys/_types.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

Shall we have enough includes to support such a compilation with -isystem ?

 -c a.c

-- 
You are receiving this mail because:
You are the assignee for the bug.