Skip to content

Build issues on Fedora 40/golang-1.22.3-1.fc40.x86_64

I had a few build issues when I tried to update the official Fedora source package to libc 1.51.0.

First, I received this error:

command: go test -buildmode pie -compiler gc -ldflags " -X modernc.org/libc/version=1.51.0 -X modernc.org/libc/version.tag=v1.51.0 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '"
      testing: modernc.org/libc
modernc.org/libc
found import comments "modernc.org/libc" (aliases.go) and "modernc.org/libc\x13" (etc_musl.go) in /home/mike/Source/rpms/BUILD/libc-v1.51.0/_build/src/modernc.org/libc

Editing etc_musl.go in vi revealed a ^S hidden character in this line:

package libc // import "modernc.org/libc^S"

Removing that character allowed the build to make progress. Next, I received this error:

command: go test -buildmode pie -compiler gc -ldflags " -X modernc.org/libc/version=1.51.0 -X modernc.org/libc/version.tag=v1.51.0 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '"
      testing: modernc.org/libc
modernc.org/libc
/home/mike/Source/rpms/BUILD/libc-v1.51.0/_build/src/modernc.org/libc/libc_musl_linux_amd64.go:1: cannot parse import comment

I found that libc_musl_linux_amd64.go lacked a closing quotation mark on the line package libc // import "modernc.org/libc.

Finally, I received the following error while Go ran the project's checks:

      testing: modernc.org/libc
modernc.org/libc
execute /usr/bin/sh ["-c" "rm -rf /tmp/dbg/*"] in /home/mike/Source/rpms/BUILD/libc-v1.51.0/_build/src/modernc.org/libc
execute /usr/bin/tar ["-C" "/tmp/dbg" "-xzf" "musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz"] in /home/mike/Source/rpms/BUILD/libc-v1.51.0/_build/src/modernc.org/libc
tar (child): musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
/usr/bin/tar: Child returned status 2
/usr/bin/tar: Error is not recoverable: exiting now
--- FAIL: TestLibc (0.04s)
    all_musl_test.go:1415: tempdir=/tmp/dbg
    all_musl_test.go:482: FAIL err=exit status 2 out=tar (child): musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz: Cannot open: No such file or directory
        tar (child): Error is not recoverable: exiting now
        /usr/bin/tar: Child returned status 2
        /usr/bin/tar: Error is not recoverable: exiting now
FAIL
exit status 1
FAIL	modernc.org/libc	36.265s
error: Bad exit status from /tmp/rpm-tmp.mVnuCz (%check)

RPM build errors:
    Bad exit status from /tmp/rpm-tmp.mVnuCz (%check)