Hi,
I've installed the newest FreeBSD 13.0 amd64 via Qemu with x86-64 native emulation. I started from minimal installation after which I installed gcc and vim and I think... probably nothing more.
I had an issue when making FreeBSD buildworld. I have managed to isolate the issue and it turns out that clang (which seems to be compiling a /usr/src compilation) is unable to compile a simple program.
Compiling simple program steps (first part - clang crash):
When running a compilation with clang under gdb:
Clang has no debug symbols compiled, so I cannot say much from the above except arc4random and libc involved.
uint32_t arc4random(void) is a random number generator and it works when it is compiled with gcc into a program (also a trivial implementation).
The program in test.c is extremely simple, test.c:
Notice, that I have very little experience with BSD systems. Therefore although it was only a simple installation, I would rather suspect that I'm doing something wrong if such basic thing like compiler crashes. On the other hand maybe there is some conflict on libc between clang and gcc.
BTW. I think I did not install the clang with pkg, it was default in the system.
Do you have any idea how to fix the issue or to continue investigation?
Do you experience the same issue or can you reproduce?
Should I submit a bug report?
I've installed the newest FreeBSD 13.0 amd64 via Qemu with x86-64 native emulation. I started from minimal installation after which I installed gcc and vim and I think... probably nothing more.
I had an issue when making FreeBSD buildworld. I have managed to isolate the issue and it turns out that clang (which seems to be compiling a /usr/src compilation) is unable to compile a simple program.
Compiling simple program steps (first part - clang crash):
Code:
root@fb:~ # clang test.c
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang test.c
1. Compilation construction
2. Building compilation jobs
3. Building compilation jobs
4. Building compilation jobs
5. Computing output path
Segmentation fault (core dumped)
root@fb:~ # gcc test.c
root@fb:~ # ./a.out
root@fb:~ # cat test.c
int main() {
return 0;
}
root@fb:~ # uname -a
FreeBSD fb 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr 9 04:24:09 UTC 2021 [EMAIL]root@releng1.nyi.freebsd.org[/EMAIL]:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
root@fb:~ # clang --version
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
When running a compilation with clang under gdb:
# gdb --args clang test.c
Code:
Reading symbols from clang...
(No debugging symbols found in clang)
(gdb) run
Starting program: /usr/bin/clang test.c
Program received signal SIGSEGV, Segmentation fault.
0x0000000804ec556a in ?? () from /lib/libc.so.7
(gdb) bt
#0 0x0000000804ec556a in ?? () from /lib/libc.so.7
#1 0x0000000804ec533a i[B]n arc4random () from /lib/libc.so.7[/B]
#2 0x0000000003b1890b in ?? ()
#3 0x0000000003b18b13 in ?? ()
#4 0x0000000003b18f0a in ?? ()
#5 0x0000000003b18f78 in ?? ()
#6 0x0000000001fb07af in ?? ()
#7 0x0000000001fb8cf0 in ?? ()
#8 0x0000000001fb72e5 in ?? ()
#9 0x0000000001fb579f in ?? ()
#10 0x0000000001fb67a3 in ?? ()
#11 0x0000000001fb579f in ?? ()
#12 0x0000000001fad0f0 in ?? ()
#13 0x0000000001fa767e in ?? ()
#14 0x00000000018b3e8e in ?? ()
#15 0x00000000018a7070 in ?? ()
#16 0x00000000018a6f70 in ?? ()
#17 0x0000000000000000 in ?? ()
(gdb)
uint32_t arc4random(void) is a random number generator and it works when it is compiled with gcc into a program (also a trivial implementation).
The program in test.c is extremely simple, test.c:
C:
int main() {
return 0;
}
Notice, that I have very little experience with BSD systems. Therefore although it was only a simple installation, I would rather suspect that I'm doing something wrong if such basic thing like compiler crashes. On the other hand maybe there is some conflict on libc between clang and gcc.
BTW. I think I did not install the clang with pkg, it was default in the system.
Do you have any idea how to fix the issue or to continue investigation?
Do you experience the same issue or can you reproduce?
Should I submit a bug report?