# /compat/ubuntu/bin/gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# env CC="/compat/ubuntu/bin/gcc" \
CFLAGS="--sysroot /compat/ubuntu -include bsd.h" \
LDFLAGS="-lbsd" \
./configure --libdir=/usr/lib64
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /compat/ubuntu/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /compat/ubuntu/bin/gcc accepts -g... yes
checking for /compat/ubuntu/bin/gcc option to accept ISO C89... none needed
checking whether /compat/ubuntu/bin/gcc understands -c and -o together... yes
checking dependency style of /compat/ubuntu/bin/gcc... gcc3
checking how to run the C preprocessor... /compat/ubuntu/bin/gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define EXTENSIONS... yes
checking build system type... x86_64-unknown-freebsd14.1
checking host system type... x86_64-unknown-freebsd14.1
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by /compat/ubuntu/bin/gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/local/bin/nm -B
checking the name lister (/usr/local/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 393216
checking how to convert x86_64-unknown-freebsd14.1 file names to x86_64-unknown-freebsd14.1 format... func_convert_file_noop
checking how to convert x86_64-unknown-freebsd14.1 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/local/bin/nm -B output from /compat/ubuntu/bin/gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /compat/ubuntu/bin/gcc supports -fno-rtti -fno-exceptions... no
checking for /compat/ubuntu/bin/gcc option to produce PIC... -fPIC -DPIC
checking if /compat/ubuntu/bin/gcc PIC flag -fPIC -DPIC works... yes
checking if /compat/ubuntu/bin/gcc static flag -static works... no
checking if /compat/ubuntu/bin/gcc supports -c -o file.o... yes
checking if /compat/ubuntu/bin/gcc supports -c -o file.o... (cached) yes
checking whether the /compat/ubuntu/bin/gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd14.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) /compat/ubuntu/bin/gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether /compat/ubuntu/bin/gcc accepts -g... (cached) yes
checking for /compat/ubuntu/bin/gcc option to accept ISO C89... (cached) none needed
checking whether /compat/ubuntu/bin/gcc understands -c and -o together... (cached) yes
checking dependency style of /compat/ubuntu/bin/gcc... (cached) gcc3
checking for g++... no
checking for c++... c++
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking dependency style of c++... gcc3
checking how to run the C++ preprocessor... c++ -E
checking for ld used by c++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking for c++ option to produce PIC... -fPIC -DPIC
checking if c++ PIC flag -fPIC -DPIC works... yes
checking if c++ static flag -static works... no
checking if c++ supports -c -o file.o... yes
checking if c++ supports -c -o file.o... (cached) yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd14.1 ld.so
checking how to hardcode library paths into programs... immediate
checking for inline... inline
checking for typeof syntax and keyword spelling... typeof
checking for flexible array members... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking if compiler needs -Werror to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
configure: error: No pthread library found in your system!
linux_libbsd is installed:
# kldload linux_libbsd
kldload: can't load linux_libbsd: module already loaded or in kernel
Using different variations on /usr/lib, /usr/lib64, /usr/lib32, /usr/lib/x86_64-linux-gnu/ etc all produce the same result. Compiling from inside chroot /compat/ubuntu does configure correctly, but naturally won't compile or install right.
I suspect I'm doing something stupid here, but...
# uname -r 14.1-STABLE
# /compat/ubuntu/bin/gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# env CC="/compat/ubuntu/bin/gcc" \ CFLAGS="--sysroot /compat/ubuntu -include bsd.h" \ LDFLAGS="-lbsd" \ ./configure --libdir=/usr/lib64 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p checking for gawk... no checking for mawk... no checking for nawk... nawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports the include directive... yes (GNU style) checking for gcc... /compat/ubuntu/bin/gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether /compat/ubuntu/bin/gcc accepts -g... yes checking for /compat/ubuntu/bin/gcc option to accept ISO C89... none needed checking whether /compat/ubuntu/bin/gcc understands -c and -o together... yes checking dependency style of /compat/ubuntu/bin/gcc... gcc3 checking how to run the C preprocessor... /compat/ubuntu/bin/gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define EXTENSIONS... yes checking build system type... x86_64-unknown-freebsd14.1 checking host system type... x86_64-unknown-freebsd14.1 checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by /compat/ubuntu/bin/gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/local/bin/nm -B checking the name lister (/usr/local/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 393216 checking how to convert x86_64-unknown-freebsd14.1 file names to x86_64-unknown-freebsd14.1 format... func_convert_file_noop checking how to convert x86_64-unknown-freebsd14.1 file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... no checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/local/bin/nm -B output from /compat/ubuntu/bin/gcc object... ok checking for sysroot... no checking for a working dd... /bin/dd checking how to truncate binary pipes... /bin/dd bs=4096 count=1 checking for mt... mt checking if mt is a manifest tool... no checking for dlfcn.h... yes checking for objdir... .libs checking if /compat/ubuntu/bin/gcc supports -fno-rtti -fno-exceptions... no checking for /compat/ubuntu/bin/gcc option to produce PIC... -fPIC -DPIC checking if /compat/ubuntu/bin/gcc PIC flag -fPIC -DPIC works... yes checking if /compat/ubuntu/bin/gcc static flag -static works... no checking if /compat/ubuntu/bin/gcc supports -c -o file.o... yes checking if /compat/ubuntu/bin/gcc supports -c -o file.o... (cached) yes checking whether the /compat/ubuntu/bin/gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... freebsd14.1 ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking for gcc... (cached) /compat/ubuntu/bin/gcc checking whether we are using the GNU C compiler... (cached) yes checking whether /compat/ubuntu/bin/gcc accepts -g... (cached) yes checking for /compat/ubuntu/bin/gcc option to accept ISO C89... (cached) none needed checking whether /compat/ubuntu/bin/gcc understands -c and -o together... (cached) yes checking dependency style of /compat/ubuntu/bin/gcc... (cached) gcc3 checking for g++... no checking for c++... c++ checking whether we are using the GNU C++ compiler... yes checking whether c++ accepts -g... yes checking dependency style of c++... gcc3 checking how to run the C++ preprocessor... c++ -E checking for ld used by c++... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes checking for c++ option to produce PIC... -fPIC -DPIC checking if c++ PIC flag -fPIC -DPIC works... yes checking if c++ static flag -static works... no checking if c++ supports -c -o file.o... yes checking if c++ supports -c -o file.o... (cached) yes checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... freebsd14.1 ld.so checking how to hardcode library paths into programs... immediate checking for inline... inline checking for typeof syntax and keyword spelling... typeof checking for flexible array members... yes checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking if compiler needs -Werror to reject unknown flags... no checking for the pthreads library -lpthreads... no checking whether pthreads work without any flags... no checking whether pthreads work with -Kthread... no checking whether pthreads work with -kthread... no checking for the pthreads library -llthread... no checking whether pthreads work with -pthread... no checking whether pthreads work with -pthreads... no checking whether pthreads work with -mthreads... no checking for the pthreads library -lpthread... no checking whether pthreads work with --thread-safe... no checking whether pthreads work with -mt... no checking for pthread-config... no configure: error: No pthread library found in your system!
libpthreads are present:
# find /compat/ubuntu/ -iname "*pthread*" /compat/ubuntu/usr/lib/x86_64-linux-gnu/libpthread-2.31.so /compat/ubuntu/usr/lib/x86_64-linux-gnu/libpthread.so.0 /compat/ubuntu/usr/lib/x86_64-linux-gnu/perl/5.30.0/bits/pthreadtypes-arch.ph /compat/ubuntu/usr/lib/x86_64-linux-gnu/perl/5.30.0/bits/pthreadtypes.ph /compat/ubuntu/usr/lib/x86_64-linux-gnu/libpthread.a /compat/ubuntu/usr/lib/x86_64-linux-gnu/libpthread.so /compat/ubuntu/usr/lib32/libpthread-2.31.so /compat/ubuntu/usr/lib32/libpthread.so.0 /compat/ubuntu/usr/lib32/libpthread.a /compat/ubuntu/usr/lib32/libpthread.so /compat/ubuntu/usr/libx32/libpthread-2.31.so /compat/ubuntu/usr/libx32/libpthread.so.0 /compat/ubuntu/usr/libx32/libpthread.a /compat/ubuntu/usr/libx32/libpthread.so /compat/ubuntu/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h /compat/ubuntu/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /compat/ubuntu/usr/include/pthread.h [...truncated...]
Full config.log: https://pastebin.com/21srZ8SE
linux_libbsd is installed: # kldload linux_libbsd kldload: can't load linux_libbsd: module already loaded or in kernel
Using different variations on /usr/lib, /usr/lib64, /usr/lib32, /usr/lib/x86_64-linux-gnu/ etc all produce the same result. Compiling from inside chroot /compat/ubuntu does configure correctly, but naturally won't compile or install right.