Debug session using copilot suggested the issue explanation is

•  newer dpkg enables  elfpackagemetadata  by default (since dpkg 
1.22.6ubuntu11), which injects  -Wl,--package-metadata=<json>  into  LDFLAGS  
between the other flags:  -Wl,-Bsymbolic-functions -Wl,--package-metadata=... 
-Wl,-z,relro -Wl,-z,now .
•  debian/rules  already anticipated this and tries to strip it:  sed 
's/-Wl,--package-metadata=[^ ]*//g' . That regex removes the flag itself but 
leaves the two surrounding spaces, producing a double space in  LDFLAGS .
•  BAZEL_LINKOPTS  is built by converting spaces to colons ( $(subst 
$(space),:,...) ) for Bazel. A double space becomes  :: , and Bazel's own  
split_escaped()  (in  tools/cpp/unix_cc_configure.bzl ) explicitly documents 
"consecutive delimiters produce empty strings" — so  ::  yields a literal empty 
linkopt, which gcc/ld receives as a bare empty filename argument →  ld.bfd: 
cannot find : No such file or directory . I reproduced this exactly locally.

and proposed fix:

collapse the extra whitespace after stripping, e.g. in  debian/rules :

LDFLAGS:=$(shell echo $(LDFLAGS) | sed -e 's/-Wl,--package-metadata=[^
]*//g' -e 's/  */ /g' -e 's/^ *//;s/ *$$//')

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167109

Title:
  bazel-bootstrap 7.7.1+ds-8 FTBFS

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bazel-bootstrap/+bug/2167109/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to