Bug 249569

Summary: devel/llvm90 : Fails to build on FreeBSD 12.2-BETA1 r365618 GENERIC powerpc 32 bit:FAILED: lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o
Product: Ports & Packages Reporter: canardo <canardo909>
Component: Individual Port(s)Assignee: Brooks Davis <brooks>
Status: New ---    
Severity: Affects Only Me CC: powerpc
Priority: --- Flags: bugzilla: maintainer-feedback? (brooks)
Version: Latest   
Hardware: powerpc   
OS: Any   

Description canardo 2020-09-24 11:25:22 UTC
Problem found when building devel/llvm90 on FreeBSD 12.2-BETA1 r365618 GENERIC powerpc 32 bit, running on Apple Powerbook 17".

# uname -a
FreeBSD G417122B1 12.2-BETA1 FreeBSD 12.2-BETA1 r365618 GENERIC  powerpc

# cc --version
cc (GCC) 4.2.1 20070831 patched [FreeBSD]

usr/ports/devel/llvm90 # make -DBATCH install clean
===>  Building for llvm90-9.0.1_2
[1/3827] /usr/local/bin/g++9 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Target/AArch64/MCTargetDesc -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64/MCTargetDesc -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64 -Ilib/Target/AArch64 -Iinclude -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/include -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64/MCTargetDesc/.. -Ilib/Target/AArch64/MCTargetDesc/.. -O2 -pipe  -DNDEBUG -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9  -DNDEBUG -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -pipe  -DNDEBUG -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9  -DNDEBUG -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include  -fno-exceptions -MD -MT lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o -MF lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o.d -o lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o -c /usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
FAILED: lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o 
/usr/local/bin/g++9 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Target/AArch64/MCTargetDesc -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64/MCTargetDesc -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64 -Ilib/Target/AArch64 -Iinclude -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/include -I/usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64/MCTargetDesc/.. -Ilib/Target/AArch64/MCTargetDesc/.. -O2 -pipe  -DNDEBUG -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9  -DNDEBUG -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -pipe  -DNDEBUG -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9  -DNDEBUG -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include  -fno-exceptions -MD -MT lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o -MF lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o.d -o lib/Target/AArch64/MCTargetDesc/CMakeFiles/LLVMAArch64Desc.dir/AArch64InstPrinter.cpp.o -c /usr/ports/devel/llvm90/work/llvm-9.0.1.src/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
ninja: build stopped: subcommand failed.
*** Signal 11
Segmentation fault (core dumped)

Is it relevant to attach a .log, or a .core ? 
If yes, please tell me where I can find it.
Comment 1 Brooks Davis freebsd_committer 2020-09-24 16:50:15 UTC
It's worth checking if the crash is due to an out of memory (or swap) condition in which case disabling make jobs may help.

I'm afraid not generally in a position to debug a gcc9 crash.

In general I'd suggest enabling BE_NATIVE instead of BE_STANDARD to save some build time and avoid building this file.
Comment 2 canardo 2020-09-26 17:15:37 UTC
My machine has 2GB RAM (max possible) and nothing else is running while building llvm90 in console.

By swapping drive on the same machine, I get back to FreeBSD 12.1, on which I was able to properly build llvm90 a while ago.

# uname -a
FreeBSD G417 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 r354992 GENERIC  powerpc

# pkg info llvm90
Name           : llvm90
Version        : 9.0.1
Installed on   : Sat Feb  8 18:56:18 2020 CET
Origin         : devel/llvm90
Architecture   : FreeBSD:12:powerpc
Prefix         : /usr/local
Categories     : devel lang
Licenses       : MIT, BSD3CLAUSE, PD, REGEX, LLVM, LLVM2
Maintainer     : brooks@FreeBSD.org
WWW            : http://llvm.org/
Comment        : LLVM and Clang
Options        :
        BE_AMDGPU      : on
        BE_FREEBSD     : off
        BE_NATIVE      : off
        BE_STANDARD    : on
        CLANG          : on
        DOCS           : on
        ELFV2          : off
        EXTRAS         : on
        LIT            : on
        LLD            : on
        LLDB           : on
        LLD_LINK       : on
        PYCLANG        : on
Shared Libs required:
Shared Libs provided:
Annotations    :
        FreeBSD_version: 1201000
Flat size      : 1.17GiB

On both version of FreeBSD (12.1 and 12.2 BETA 1) on my machine, all memory and build options are the default ones. So clearly something has been changed in 12.2 BETA 1, blocking llvm90 build.

Is there any command I could run to gather information and help solving this problem ?
If so, please provided me detailed instructions, I'm no developer or sysadmin.