Discussion:
Buildworld failing during llvm
(too old to reply)
Ben Woods
2018-02-18 01:52:44 UTC
Permalink
Hi everyone,

My attempts to build FreeBSD 12-current have been failing as of yesterday
with the error below. This problem persists with current at the time of
writing this email (r329497).

Given llvm was updated to 6.0 around that time, I suspect it is related:
https://svnweb.freebsd.org/base?view=revision&revision=329410


--- clang.full ---
c++ -O2 -pipe
-I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libclang
-I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm
-I/usr/src/contrib/llvm/tools/clang/include -I/usr/src/lib/clang/include
-I/usr/src/contrib/llvm/include -DLLVM_BUILD_GLOBAL_ISEL
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd12.0\"
-DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd12.0\"
-DDEFAULT_SYSROOT=\"/usr/obj/usr/src/amd64.amd64/tmp\" -ffunction-sections
-fdata-sections -g -O0 -Qunused-arguments
-I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -std=c++11
-fno-exceptions -fno-rtti -g -O0 -stdlib=libc++ -Wno-c++11-extensions
-Wl,--gc-sections -static -L/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib
-o clang.full cc1_main.o cc1as_main.o driver.o
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libclang/libclang.a
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm/libllvm.a
-L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libz -lz
-L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/ncurses/ncursesw
-lncursesw -L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libthr
-lpthread -legacy
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm/libllvm.a:
could not read symbols: Malformed archive
c++: error: linker command failed with exit code 1 (use -v to see
invocation)
*** [clang.full] Error code 1


Regards,
Ben

--
From: Benjamin Woods
***@gmail.com
Dimitry Andric
2018-02-18 17:17:10 UTC
Permalink
Post by Ben Woods
My attempts to build FreeBSD 12-current have been failing as of yesterday
with the error below. This problem persists with current at the time of
writing this email (r329497).
https://svnweb.freebsd.org/base?view=revision&revision=329410
--- clang.full ---
c++ -O2 -pipe
-I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libclang
-I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm
-I/usr/src/contrib/llvm/tools/clang/include -I/usr/src/lib/clang/include
-I/usr/src/contrib/llvm/include -DLLVM_BUILD_GLOBAL_ISEL
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd12.0\"
-DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd12.0\"
-DDEFAULT_SYSROOT=\"/usr/obj/usr/src/amd64.amd64/tmp\" -ffunction-sections
-fdata-sections -g -O0 -Qunused-arguments
-I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -std=c++11
-fno-exceptions -fno-rtti -g -O0 -stdlib=libc++ -Wno-c++11-extensions
-Wl,--gc-sections -static -L/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib
-o clang.full cc1_main.o cc1as_main.o driver.o
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libclang/libclang.a
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm/libllvm.a
-L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libz -lz
-L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/ncurses/ncursesw
-lncursesw -L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libthr
-lpthread -legacy
could not read symbols: Malformed archive
Hi Ben,

This is most likely because you are setting CFLAGS to "-g -O0", which
causes libllvm.a and libclang.a to become too big (>2GiB) for ar to
handle. Then the linker finds the archive malformed.

John Baldwin added some special handling for libraries under lib/clang,
so they emit smaller debug information, so just leave out -g from your
CFLAGS, buildworld will automatically take care of applying the right
-g flags in all the various places.

-Dimitry
Ben Woods
2018-02-19 11:17:31 UTC
Permalink
Post by Ben Woods
Hi everyone,
My attempts to build FreeBSD 12-current have been failing as of yesterday
with the error below. This problem persists with current at the time of
writing this email (r329497).
https://svnweb.freebsd.org/base?view=revision&revision=329410
--- clang.full ---
c++ -O2 -pipe -I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libclang
-I/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm
-I/usr/src/contrib/llvm/tools/clang/include -I/usr/src/lib/clang/include
-I/usr/src/contrib/llvm/include -DLLVM_BUILD_GLOBAL_ISEL
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd12.0\"
-DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd12.0\"
-DDEFAULT_SYSROOT=\"/usr/obj/usr/src/amd64.amd64/tmp\"
-ffunction-sections -fdata-sections -g -O0 -Qunused-arguments
-I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -std=c++11
-fno-exceptions -fno-rtti -g -O0 -stdlib=libc++ -Wno-c++11-extensions
-Wl,--gc-sections -static -L/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib
-o clang.full cc1_main.o cc1as_main.o driver.o
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libclang/libclang.a
/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/clang/libllvm/libllvm.a
-L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libz -lz
-L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/ncurses/ncursesw
-lncursesw -L/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/lib/libthr
-lpthread -legacy
could not read symbols: Malformed archive
c++: error: linker command failed with exit code 1 (use -v to see
invocation)
*** [clang.full] Error code 1
Regards,
Ben
--
From: Benjamin Woods
I found this issue was caused by having the following line in my
/etc/make.conf (which I had there for some ports debugging):
DEBUG_FLAGS=-g -O0

I wouldn't have thought this should cause the clang build to fail...


Regards,
Ben

--
From: Benjamin Woods
***@gmail.com

Loading...