Re: Compiling the kernel using GCC

From: Ryan Libby <rlibby_at_gmail.com>
Date: Sat, 26 Aug 2017 21:51:52 -0700
On Sat, Aug 26, 2017 at 2:41 AM, Aijaz Baig <aijazbaig1_at_gmail.com> wrote:
> Has anyone been able to successfully compile the kernel using GCC as
> against CLANG the default compiler on most later versions of FreeBSD? I was
> able to successfully buildworld. After which I reboot and now /usr/bin/cc
> points to GCC as requested. However kernel fails to link
[...]
> make  -D KERNFAST -m /usr/src/share/mk  KERNEL=kernel all -DNO_MODULES_OBJ
> linking kernel.full
> ck_array.o: In function `ck_cc_popcount':
> /usr/src/sys/contrib/ck/include/gcc/ck_cc.h:139: undefined reference to
> `__popcountdi2'
[...]

Do you need ck?  Can you share your KERNCONF?  And the branch and
revision you are building?

I have been building an amd64 GENERIC kernel on head with various gccs.
I think that does not build ck.  The main method I have been focusing on
for now is

make CROSS_TOOLCHAIN=amd64-gcc TARGET=amd64 TARGET_ARCH=amd64 buildkernel

with the amd64-xtoolchain-gcc-0.2 package installed.  But I have also
built kernel-only successfully with gcc 6 with src.conf e.g. as below.

% cat /etc/src.conf.gcc6
WITH_GCC=yes
WITH_GCC_BOOTSTRAP=yes
WITH_GCC_IS_CC=yes
WITHOUT_CLANG=yes
WITHOUT_CLANG_BOOTSTRAP=yes
WITHOUT_CLANG_IS_CC=yes
WITHOUT_FORMAT_EXTENSIONS=yes
CC=/usr/local/bin/gcc6
CXX=/usr/local/bin/g++6
Received on Sun Aug 27 2017 - 02:51:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:13 UTC