Compiling the kernel using GCC
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 Here is my src.conf: COPTFLAGS+= -O0 -pipe -Wno-attributes -Wno-redundant-decls WERROR="-Wno-error" WITHOUT_CLANG="yes" WITHOUT_CLANG_IS_CC="yes" WITHOUT_CLANG_BOOTSTRAP="yes" WITH_GCC_BOOTSTRAP="yes" WITH_GCC="yes" WITH_GNUCXX="yes" WITHOUT_JAIL="yes" WITHOUT_WIRELESS="yes" WITHOUT_WIRELESS_SUPPORT="yes" WITHOUT_WPA_SUPPLICANT_EAPOL="yes" WITHOUT_CDDL="yes" It fails here: >>> stage 3.1: building everything -- cd /usr/obj/usr/src/sys/AIJAZ-DEBUG; COMPILER_VERSION=40201 COMPILER_FEATURES= COMPILER_TYPE=gcc COMPILER_FREEBSD_VERSION=121 MAKEOBJDIRPREFIX=/usr/obj MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE= CC="cc -isystem /usr/obj/usr/src/tmp/usr/include -L/usr/obj/usr/src/tmp/usr/lib -B/usr/obj/usr/src/tmp/usr/lib --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin" CXX="c++ -isystem /usr/obj/usr/src/tmp/usr/include -L/usr/obj/usr/src/tmp/usr/lib -B/usr/obj/usr/src/tmp/usr/lib --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin" CPP="cpp -isystem /usr/obj/usr/src/tmp/usr/include -L/usr/obj/usr/src/tmp/usr/lib -B/usr/obj/usr/src/tmp/usr/lib --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin" AS="as" AR="ar" LD="ld" LLVM_LINK="" NM=nm OBJCOPY="objcopy" RANLIB=ranlib STRINGS= SIZE="size" INSTALL="sh /usr/src/tools/install.sh" PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/bin:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin 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' ck_barrier_centralized.o: In function `ck_cc_popcount': /usr/src/sys/contrib/ck/include/gcc/ck_cc.h:139: undefined reference to `__popcountdi2' ck_barrier_combining.o: In function `ck_cc_popcount': /usr/src/sys/contrib/ck/include/gcc/ck_cc.h:139: undefined reference to `__popcountdi2' ck_barrier_dissemination.o: In function `ck_cc_popcount': /usr/src/sys/contrib/ck/include/gcc/ck_cc.h:139: undefined reference to `__popcountdi2' ck_barrier_mcs.o: In function `ck_cc_popcount': /usr/src/sys/contrib/ck/include/gcc/ck_cc.h:139: undefined reference to `__popcountdi2' ck_barrier_tournament.o:/usr/src/sys/contrib/ck/include/gcc/ck_cc.h:139: more undefined references to `__popcountdi2' follow *** Error code 1 Stop. make[2]: stopped in /usr/obj/usr/src/sys/AIJAZ-DEBUG *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src Is there something else I am missing? Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: buildworld fails while building static clang library
Hi Ed Yes how do I get those logs? I will be checking dmesg from time to time (is there a way to tail it by the way??) but then how do I enable verbose logging while building world? I tried finding out the same by searching on the internet and by reading the manual page for make.conf but couldn't figure it out Is it even possible to have a verbose output? On Mon, Aug 14, 2017 at 7:36 PM, Ed Maste <ema...@freebsd.org> wrote: > On 7 August 2017 at 00:32, Aijaz Baig <aijazba...@gmail.com> wrote: > > That was some pretty relevant information Ed. Thanks. > > Even though it's not a direct cause of the problem you encountered I > wanted to make sure a there was comprehensive reply to Dimitry's > question. > > > Nonetheless, as I have indicated in my previous email, I hit an error > quite > > late in the process now (stage 4.3) when it is apparently linking > h_raw.o > > into h_raw.full ( is this linking by the way? what is the .full file > > there??) > > Yes, this is a link step - the .full file is a binary or library with > debug data included, which is then split into a .debug file containing > only the debug data and the binary or library with no extension. > > There's no indication of what the error is in your log excerpt; are > there any messages in dmesg from the time of the build? > -- Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
clang error make buildworld
I am tying to buildworld on an ivybridge (amd64) machine and I get the following error: ===> lib/libc/tests/ssp (all) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_fgets NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_fgets ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_gets NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_gets ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_getcwd NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_getcwd ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_memcpy NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_memcpy ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_memmove NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_memmove ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_memset NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_memset ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_raw NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_raw ) cc -target x86_64-unknown-freebsd12.0 --sysroot=/mnt/ObjDir/usr/src/tmp -B/mnt/ObjDir/usr/src/tmp/usr/bin -O0 -pipe -fstack-protector-all -Wstack-protector -fsanitize=bounds -g -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -o h_raw.full h_raw.o /mnt/ObjDir/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `__gxx_personality_v0' cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Stop. make[7]: stopped in /usr/src/lib/libc/tests/ssp *** Error code 1 Stop. make[6]: stopped in /usr/src/lib/libc/tests/ssp *** Error code 1 Stop. make[5]: stopped in /usr/src/lib/libc/tests *** Error code 1 Stop. make[4]: stopped in /usr/src/lib/libc *** Error code 1 Stop. make[3]: stopped in /usr/src/lib *** Error code 1 Stop. make[2]: stopped in /usr/src *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src My /etc/make.conf contains: CPUTYPE?= ivybridge and whereas my /etc/src.conf contains: CFLAGS= -O0 -pipe COPTFLAGS= -O0 -pipe DEBUG_FLAGS=-g By the way it looks like clang is linking against gcc libraries?? How can that be possible? I thought GCC and CLANG are more like competitors in the world of compilers. Perhaps I am missing something here. Nevertheless how do I get rid of this issue? -- Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: buildworld fails while building static clang library
That was some pretty relevant information Ed. Thanks. However upon bumping up my RAM, I don't hit this error anymore perhaps I believe since the relatively large amount of RAM does not necessitate that much of swap space. Nonetheless, as I have indicated in my previous email, I hit an error quite late in the process now (stage 4.3) when it is apparently linking h_raw.o into h_raw.full ( is this linking by the way? what is the .full file there??) Keen to hear On Sun, Aug 6, 2017 at 3:04 PM, Ed Maste <ema...@freebsd.org> wrote: > On 5 August 2017 at 16:16, Dimitry Andric <d...@freebsd.org> wrote: > > > > I remember there being an issue with ar and/or ranlib choking when the > > .a files become too big. Ed, does that ring any bells? > > Our ar (and ranlib, which is the same binary) will produce a corrupt > symbol table if the .a archive output is larger than 4GB, because we > support only 32-bit offsets in the older "/" symbol table format, not > the "/SYM64/" format and 64-bit offsets. > > As with GNU ar from binutils 2.17.50 we silently truncate if the > offset does not fit in 32 bits. I'll have a patch for review soon to > exit on error rather than produce corrupted output, and hope to look > at adding /SYM64/ support later on. > -- Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: buildworld fails while building static clang library
I did notice some swap related messages in dmesg earlier so this time I bumped up my RAM to 4.25GB (did I tell you I'm running this on a VM?). In addition I skipped parallel make jobs altogether keeping other things the same. So this time around it went a lot further in fact all the way to step4.3 (building everything) and now it fails at this step: ===> lib/libc/tests/ssp (all) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_fgets NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING _PROGS=t PROG=h_fgets ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_gets NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_ PROGS=t PROG=h_gets ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_getcwd NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSIN G_PROGS=t PROG=h_getcwd ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_memcpy NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSIN G_PROGS=t PROG=h_memcpy ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_memmove NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSI NG_PROGS=t PROG=h_memmove ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_memset NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSIN G_PROGS=t PROG=h_memset ) (cd /usr/src/lib/libc/tests/ssp && DEPENDFILE=.depend.h_raw NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/ssp/Makefile _RECURSING_PROGS=t PROG=h_raw ) cc -target x86_64-unknown-freebsd12.0 --sysroot=/mnt/obj/usr/src/tmp -B/mnt/obj/usr/src/tmp/usr/bin -O0 -pipe -march=core2 -fstack-protector-all -Wstack-protector -fsanitize=bounds -g3 -g -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -o h_raw.full h_raw.o *** Error code 1 Stop. make[7]: stopped in /usr/src/lib/libc/tests/ssp *** Error code 1 Stop. make[6]: stopped in /usr/src/lib/libc/tests/ssp *** Error code 1 Stop. make[5]: stopped in /usr/src/lib/libc/tests *** Error code 1 Stop. make[4]: stopped in /usr/src/lib/libc *** Error code 1 Stop. make[3]: stopped in /usr/src/lib *** Error code 1 Stop. make[2]: stopped in /usr/src *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src keen to hear On Sun, Aug 6, 2017 at 9:53 AM, Aijaz Baig <aijazba...@gmail.com> wrote: > Hello > > Yes guilty as charged!!! > > I turn off optimization and enable DEBUG_FLAGS using src.conf: > > CFLAGS= -O0 -pipe > COPTFLAGS= -O0 -pipe > DEBUG_FLAGS=-g > > This time however I run without any parallel make jobs and it fails with a > different error: > > *** Signal 9 > > Stop. > make[6]: stopped in /usr/src/lib/clang/libclang > *** Error code 1 > > Stop. > make[5]: stopped in /usr/src/lib/clang > *** Error code 1 > > Stop. > make[4]: stopped in /usr/src/lib > *** Error code 1 > > Stop. > make[3]: stopped in /usr/src > *** Error code 1 > > Stop. > make[2]: stopped in /usr/src > *** Error code 1 > > Stop. > make[1]: stopped in /usr/src > *** Error code 1 > > Stop. > make: stopped in /usr/src > > Keen to hear > > On Sun, Aug 6, 2017 at 1:46 AM, Dimitry Andric <d...@freebsd.org> wrote: > >> On 5 Aug 2017, at 21:55, Aijaz Baig <aijazba...@gmail.com> wrote: >> > >> > I was a bit sceptical of this as it was failing with that same port (or >> is clang a port by the way?) all the time. So as you suggested, I reduced >> my '-j' number and it still fails at the very same place with the very same >> error. Is it because the clang port doesn't allow parallel make jobs? >> > >> > Nonetheless, as to my query regarding building the world, based on what >> my goals are (as I stated earlier), does it require me to actually build >> the whole world? >> > >> > Regards, >> > Aijaz Baig >> > >> > On Sat, Aug 5, 2017 at 2:34 PM, Dimitry Andric <d...@freebsd.org> wrote: >> > On 5 Aug 2017, at 06:00, Aijaz Baig <aijazba...@gmail.com> wrote: >> > > >> > > I am trying to buildworld and it works well for quite some time until >> it >> > > tries to build the static version of the clang library where it >> fails. The >> > > error it spits is: >> > > >> > > Killed >> > > *** [all_subdir_lib/clang/libclang] Error code 137 >> > >
Fwd: buildworld fails while building static clang library
Yes you could be correct. See my reply below to Dimitry. And if this indeed is an issue is there a workaround? Or based on my first question, do I really need to buildworld? -- Forwarded message -- From: Aijaz Baig <aijazba...@gmail.com> Date: Sun, Aug 6, 2017 at 9:53 AM Subject: Re: buildworld fails while building static clang library To: Dimitry Andric <d...@freebsd.org> Cc: FreeBSD Current <freebsd-current@freebsd.org>, Ed Maste < ema...@freebsd.org> Hello Yes guilty as charged!!! I turn off optimization and enable DEBUG_FLAGS using src.conf: CFLAGS= -O0 -pipe COPTFLAGS= -O0 -pipe DEBUG_FLAGS=-g This time however I run without any parallel make jobs and it fails with a different error: *** Signal 9 Stop. make[6]: stopped in /usr/src/lib/clang/libclang *** Error code 1 Stop. make[5]: stopped in /usr/src/lib/clang *** Error code 1 Stop. make[4]: stopped in /usr/src/lib *** Error code 1 Stop. make[3]: stopped in /usr/src *** Error code 1 Stop. make[2]: stopped in /usr/src *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src Keen to hear Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: buildworld fails while building static clang library
Hello Yes guilty as charged!!! I turn off optimization and enable DEBUG_FLAGS using src.conf: CFLAGS= -O0 -pipe COPTFLAGS= -O0 -pipe DEBUG_FLAGS=-g This time however I run without any parallel make jobs and it fails with a different error: *** Signal 9 Stop. make[6]: stopped in /usr/src/lib/clang/libclang *** Error code 1 Stop. make[5]: stopped in /usr/src/lib/clang *** Error code 1 Stop. make[4]: stopped in /usr/src/lib *** Error code 1 Stop. make[3]: stopped in /usr/src *** Error code 1 Stop. make[2]: stopped in /usr/src *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src Keen to hear On Sun, Aug 6, 2017 at 1:46 AM, Dimitry Andric <d...@freebsd.org> wrote: > On 5 Aug 2017, at 21:55, Aijaz Baig <aijazba...@gmail.com> wrote: > > > > I was a bit sceptical of this as it was failing with that same port (or > is clang a port by the way?) all the time. So as you suggested, I reduced > my '-j' number and it still fails at the very same place with the very same > error. Is it because the clang port doesn't allow parallel make jobs? > > > > Nonetheless, as to my query regarding building the world, based on what > my goals are (as I stated earlier), does it require me to actually build > the whole world? > > > > Regards, > > Aijaz Baig > > > > On Sat, Aug 5, 2017 at 2:34 PM, Dimitry Andric <d...@freebsd.org> wrote: > > On 5 Aug 2017, at 06:00, Aijaz Baig <aijazba...@gmail.com> wrote: > > > > > > I am trying to buildworld and it works well for quite some time until > it > > > tries to build the static version of the clang library where it fails. > The > > > error it spits is: > > > > > > Killed > > > *** [all_subdir_lib/clang/libclang] Error code 137 > > > > > > make[5]: stopped in /usr/src/lib/clang > > > > I'm just guessing, but the most likely cause is lack of memory. Please > > check dmesg for any messages like "pid foo (bar), uid baz, was killed: > > out of swap space". To work around this, you can temporarily add more > > swap space, or lower your -j level. > > Hm, now I read that your obj dir is on NFS, you might be hitting some > 4GiB filesize limit for the final .a file. Are you building world with > a very low optimization level, and debug information on? > > I remember there being an issue with ar and/or ranlib choking when the > .a files become too big. Ed, does that ring any bells? > > -Dimitry > > -- Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: buildworld fails while building static clang library
Hi Dmitry I was a bit sceptical of this as it was failing with that same port (or is clang a port by the way?) all the time. So as you suggested, I reduced my '-j' number and it still fails at the very same place with the very same error. Is it because the clang port doesn't allow parallel make jobs? Nonetheless, as to my query regarding building the world, based on what my goals are (as I stated earlier), does it require me to actually build the whole world? Regards, Aijaz Baig On Sat, Aug 5, 2017 at 2:34 PM, Dimitry Andric <d...@freebsd.org> wrote: > On 5 Aug 2017, at 06:00, Aijaz Baig <aijazba...@gmail.com> wrote: > > > > I am trying to buildworld and it works well for quite some time until it > > tries to build the static version of the clang library where it fails. > The > > error it spits is: > > > > Killed > > *** [all_subdir_lib/clang/libclang] Error code 137 > > > > make[5]: stopped in /usr/src/lib/clang > > I'm just guessing, but the most likely cause is lack of memory. Please > check dmesg for any messages like "pid foo (bar), uid baz, was killed: > out of swap space". To work around this, you can temporarily add more > swap space, or lower your -j level. > > -Dimitry > > -- Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
buildworld fails while building static clang library
I am trying to buildworld and it works well for quite some time until it tries to build the static version of the clang library where it fails. The error it spits is: Killed *** [all_subdir_lib/clang/libclang] Error code 137 make[5]: stopped in /usr/src/lib/clang 1 error make[5]: stopped in /usr/src/lib/clang *** [all_subdir_lib/clang] Error code 2 make[4]: stopped in /usr/src/lib 1 error make[4]: stopped in /usr/src/lib *** [lib__L] Error code 2 make[3]: stopped in /usr/src 1 error make[3]: stopped in /usr/src *** [libraries] Error code 2 make[2]: stopped in /usr/src 1 error make[2]: stopped in /usr/src *** [_libraries] Error code 2 make[1]: stopped in /usr/src 1 error make[1]: stopped in /usr/src *** [buildworld] Error code 2 make: stopped in /usr/src make: stopped in /usr/src The number of files that are passed to the archiver are too many to list here. Here's the pastebin link: https://pastebin.com/3ifFWVdA . Also my MAKEOBJDIRPREFIX is pointing to an NFS share. The reason I am doing so is that I want to create a complete sysroot so I can then use the resulting gdb from it to debug the kernel and the KLDs on this system. That NFS share lies on the machine which will be used to debug this one. Since (I've read that) GDB uses a mechanism similar to libraries when debugging loaded modules, I assume I need to first create the 'world' for this machine on the NFS mount and then use the gdb inside to load symbols files for the KLDs. If this is incorrect or if I am going for an overkill with 'buildworld' please sugggest an optimum way -- Best Regards, Aijaz Baig ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"