Re: Cross compiling Kernel with all options enabled and compiler wrapper

Nando Schenk <[email protected]> Wed, 20 Aug 2025 09:47:02 +0200
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On 10/07/2025 11:22, Jörg Sonnenberger wrote:
> Would the compilation database be good enough?
>
> https://www.netbsd.org/~joerg/json.diff
>
> is an old patch to automatically create fragments during compilation. 
> A full compilation db file can be obtained from that with minimal 
> post-processing. 

Thank you for the answer, yes, this looks definitely promising.

I've been away for the past few weeks and wanted to continue my work, 
but I am not even able anymore to compile the toolchain on my linux 
host. Somehow, the header files on my system aren't compatible 
(anymore?) with the NetBSD source. What am I doing wrong? I try to 
compile NetBSD 10.1 using build.sh on my Arch Linux machine with the 
following command:
./build.sh -U -m amd64 -c clang tools

The build process repeatedly fails when compiling texinfo, and without 
the toolchain I of course can't compile the kernel. This is the 
(relevant part) of the build process:


In file included from 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib/substring.c:22:
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib/system.h:123:12: 
error: conflicting types for 'strcasecmp'; have 'int(void)'
   123 | extern int strcasecmp ();
       |            ^~~~~~~~~~
In file included from /usr/include/string.h:462,
                  from 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib/system.h:76:
/usr/include/strings.h:116:12: note: previous declaration of 
'strcasecmp' with type 'int(const char *, const char *)'
   116 | extern int strcasecmp (const char *__s1, const char *__s2)
       |            ^~~~~~~~~~
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib/system.h:127:12: 
error: conflicting types for 'strncasecmp'; have 'int(void)'
   127 | extern int strncasecmp ();
       |            ^~~~~~~~~~~
/usr/include/strings.h:120:12: note: previous declaration of 
'strncasecmp' with type 'int(const char *, const char *, long unsigned int)'
   120 | extern int strncasecmp (const char *__s1, const char *__s2, 
size_t __n)
       |            ^~~~~~~~~~~

*** Failed target:  substring.o
*** Failed command: 
source='/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib/substring.c' 
object='substring.o' libtool=no DEPDIR=.deps depmode=none /usr/bin/sh 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/depcomp 
cc -DHAVE_CONFIG_H -I. 
-I/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib 
-I.. -I../intl -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 -O -c 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../../external/gpl2/texinfo/dist/lib/substring.c
*** Error code 1

Stop.
nbmake[6]: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/obj/build/lib

*** Failed target:  all-recursive
*** Failed command: set fnord $MAKEFLAGS; amf=$2; dot_seen=no; 
target=`echo all-recursive | sed s/-recursive//`; list=' intl m4 lib 
makeinfo po util doc'; for subdir in $list; do echo "Making $target in 
$subdir"; if test "$subdir" = "."; then dot_seen=yes; 
local_target="$target-am"; else local_target="$target"; fi; (cd $subdir 
&& 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
-f 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../Makefile.gnuwrap 
$local_target) || case "$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 
1;; esac; done; if test "$dot_seen" = "no"; then 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
-f 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../Makefile.gnuwrap 
"$target-am" || exit 1; fi; test -z "$fail"
*** Error code 1

Stop.
nbmake[5]: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/obj/build

*** Failed target:  all
*** Failed command: 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
-f 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../Makefile.gnuwrap 
all-recursive
*** Error code 1

Stop.
nbmake[4]: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/obj/build

*** Failed target:  .build_done
*** Failed command: (cd build && AR=ar 
AWK=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbawk 
CC=cc CFLAGS=-O CONFIG_SHELL=/usr/bin/sh CPPFLAGS=\ -D_LARGEFILE_SOURCE\ 
-D_LARGEFILE64_SOURCE\ -D_FILE_OFFSET_BITS=64 CXX=c++ CXXFLAGS=-O 
INSTALL=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/x86_64--netbsd-install\ 
-c\ \ -r LDFLAGS= 
LEX=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nblex 
FLEX=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nblex 
M4=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbm4 
MAKE=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
PATH="/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin:$PATH" 
RANLIB=ranlib 
YACC=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbyacc 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
-f 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo/../Makefile.gnuwrap 
BISON=true DESTDIR= 
INSTALL=/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/x86_64--netbsd-install\ 
-c\ \ -r all)
*** Error code 1

Stop.
nbmake[3]: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo

*** Failed target:  dependall
*** Failed command: cd 
"/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo"; 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
realall
*** Error code 1

Stop.
nbmake[2]: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/texinfo

*** Failed target:  dependall-texinfo
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; 
shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; 
real="/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools" 
;; *) this="${dir}/"; 
real="/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/${dir}" 
;; esac; show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: 
$@)}"; cd "${real}" && 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
_THISDIR_="${this}" "$@" ${target}; }; _makedirtarget texinfo dependall
*** Error code 1

Stop.
nbmake[1]: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools

*** Failed target:  build_install
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; 
shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; 
real="/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools" 
;; *) this="${dir}/"; 
real="/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools/${dir}" 
;; esac; show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: 
$@)}"; cd "${real}" && 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/obj/tooldir.Linux-6.16.1-arch1-1-x86_64/bin/nbmake 
_THISDIR_="${this}" "$@" ${target}; }; _makedirtarget . dependall-texinfo
*** Error code 1

Stop.
nbmake: stopped in 
/home/nando/Documents/Schule/Maturitaetsarbeit/neu/netbsd-src-ftp/src/tools

ERROR: Failed to make build_install in "tools"

*** BUILD ABORTED ***



I tried modifying the Makefiles to just skip texinfo, but this resulted 
in simmilar errors in different parts of the code.

Nando