Re: ld: error: bzlib.pico:147: unclosed quote

From: Mark Millard via freebsd-arm <freebsd-arm_at_freebsd.org>
Date: Tue, 21 Dec 2021 21:50:24 UTC
On 2021-Dec-21, at 10:00, bob prohaska <fbsd@www.zefox.net> wrote:

> A try at buildworld on a Pi4 from sources updated this morning stoped with
> 
> Building /usr/obj/usr/src/arm64.aarch64/lib/libelf/elf_update.o
> --- lib/libbz2__L ---
> ld: error: bzlib.pico:147: unclosed quote
> ld: error: compress.pico:108: unclosed quote
> --- lib/libcom_err__L ---
> Building /usr/obj/usr/src/arm64.aarch64/lib/libcom_err/libcom_err.so.5.debug
> --- lib/libbz2__L ---
> ld: error: decompress.pico: section header table goes past the end of the file: e_shoff = 0xc388
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> 
> Anybody else seeing this?

Providing the following sort of context information
could help folks in figuring out if it appropriate
to reply (examples are just from my context):

1) What vintage is doing the buildworld buildkernel activity?

# uname -apKU
FreeBSD CA72_16Gp_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #25 main-n251456-22c4ab6cb015-dirty: Tue Dec  7 19:38:53 PST 2021     root@CA72_16Gp_ZFS:/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/sys/GENERIC-NODBG-CA72  arm64 aarch64 1400043 1400043

That can give an idea what range over which something might
have changed that contributes to the problem. Otherwise there
would be more to report about this end of the range. (Imagine
if te world and the kernel did not match, for example.)

2) What specific commit from "this morning"? (I've not actually
   updated in that time so my example below shows the same
   commit as above.)

# ~/fbsd-based-on-what-commit.sh -C /usr/main-src/
branch: main
merge-base: 22c4ab6cb015dc99eb82504e5fd957662cded3c3
merge-base: CommitDate: 2021-12-07 19:29:26 +0000
22c4ab6cb015 (HEAD -> main, freebsd/main, freebsd/HEAD) sys/_bitset.h: Fix fall-out from commit 5e04571cf3c
n251456 (--first-parent --count for merge-base)

That gives the other end of the range.


For reference for the report from the git area:

# more ~/fbsd-based-on-what-commit.sh -C /usr/main-src/
#! /bin/sh
branch="`git $* branch --show-current`" \
&& echo "branch: $branch" \
&& base="`git $* merge-base freebsd/$branch HEAD`" \
&& git $* log --oneline --no-color $base..HEAD \
&& base_date="`TZ=UTC git $* log --format=fuller --date=iso-local --no-color $base^..$base | grep CommitDate:`" \
&& echo "merge-base: $base" \
&& echo "merge-base: $base_date" \
&& git $* log --oneline --no-color $base^..$base \
&& echo "n`git $* rev-list --first-parent --count $base` (--first-parent --count for merge-base)"

(I'm not doing my own commits or using my own branches
and the above procedure is depending on that.)

I've not been updating/building recently so I've no
direct comments about that. But there may be evidence
around that you could report.

The messages:

QUOTE
ld: error: bzlib.pico:147: unclosed quote
ld: error: compress.pico:108: unclosed quote
END QUOTE

read like binary files are being read as text files.

My existing (META_MODE) build has a .meta file that reports,
for example,

# head /usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/lib/libbz2/bzlib.pico.meta
# Meta data file /usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/lib/libbz2/bzlib.pico.meta
CMD cc -target aarch64-unknown-freebsd14.0 --sysroot=/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/tmp -B/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/tmp/usr/bin -fpic -DPIC  -O2 -pipe -fno-common -I/usr/main-src/contrib/bzip2   -DNDEBUG  -g -gz=zlib -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-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  -mcpu=cortex-a72 -Qunused-arguments    -c /usr/main-src/contrib/bzip2/bzlib.c -o bzlib.pico
CMD 
CWD /usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/lib/libbz2
TARGET bzlib.pico
-- command output --

-- filemon acquired metadata --
# filemon version 5
# Target pid 82738

If there was an error, it should also be recorded in the .meta
file that had the command that got the error. (head might not
report enough text in such a case?)

If you use META_MODE builds, looking at *.meta files involved in the
generation if the files being used and in the command(s) using those
files might point in some direction for what is going on. You might
want to report those. In my context the reference to bzlib.pico are
(I added blank lines for readability):


# cd /usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/lib/libbz2/
# grep bzlib.pico *.meta

bzlib.pico.meta:# Meta data file /usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/lib/libbz2/bzlib.pico.meta

bzlib.pico.meta:CMD cc -target aarch64-unknown-freebsd14.0 --sysroot=/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/tmp -B/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/tmp/usr/bin -fpic -DPIC  -O2 -pipe -fno-common -I/usr/main-src/contrib/bzip2   -DNDEBUG  -g -gz=zlib -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-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  -mcpu=cortex-a72 -Qunused-arguments    -c /usr/main-src/contrib/bzip2/bzlib.c -o bzlib.pico

bzlib.pico.meta:TARGET bzlib.pico

bzlib.pico.meta:M 83530 'bzlib-c42071da.pico.tmp' 'bzlib.pico'

libbz2.so.4.full.meta:CMD cc -target aarch64-unknown-freebsd14.0 --sysroot=/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/tmp -B/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/tmp/usr/bin    -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o libbz2.so.4.full -Wl,-soname,libbz2.so.4 bzlib.pico blocksort.pico compress.pico crctable.pico decompress.pico huffman.pico randtable.pico 

libbz2.so.4.full.meta:R 81954 bzlib.pico


That gives an idea what *.meta files to look at for
bzlib.pico generation and usage.

===
Mark Millard
marklmi at yahoo.com