Bug 258823 - Multiple ports fails to link with USE_LTO: libtool: eval: 1: Syntax error: "|" unexpected
Summary: Multiple ports fails to link with USE_LTO: libtool: eval: 1: Syntax error: "|...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kubilay Kocak
URL:
Keywords: needs-qa
Depends on:
Blocks: 258822
  Show dependency treegraph
 
Reported: 2021-10-01 01:22 UTC by Kubilay Kocak
Modified: 2022-03-12 23:08 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kubilay Kocak freebsd_committer freebsd_triage 2021-10-01 01:22:09 UTC
FreeBSD 14.0-CURRENT #0 main-n248401-de0c7fbe280: Mon Aug  2 02:42:31 UTC 2021 GENERIC-NODEBUG  amd6

devel/pkgconf fails to link with USE_LTO enabled in the 'libpkgconf.la' target. It appears a variable is empty, resulting in an empty pipe.

Summary:

Without USE_LTO: 

libpkgconf/.libs/parser.o   | sed -n -e 's/^.*[        ]\([BCDEGRST][BCDEGRST]*\)[     ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libpkgconf.exp

With USE_LTO:

libpkgconf/.libs/parser.o   |  | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libpkgconf.exp
eval: 1: Syntax error: "|" unexpected

Search results for "BCDEGRST" "syntax error" point to libtool environment modifications, potentially config.cache related

Full compile lines:


Without USE_LTO:

--- libpkgconf.la ---
libtool: link: /usr/bin/nm  libpkgconf/.libs/audit.o libpkgconf/.libs/cache.o libpkgconf/.libs/client.o libpkgconf/.libs/pkg.o libpkgconf/.libs/bsdstubs.o libpkgconf/.libs/fragment.o libpkgconf/.libs/argvsplit.o libpkgconf/.libs/fileio.o libpkgconf/.libs/tuple.o libpkgconf/.libs/dependency.o libpkgconf/.libs/queue.o libpkgconf/.libs/path.o libpkgconf/.libs/personality.o libpkgconf/.libs/parser.o   | sed -n -e 's/^.*[        ]\([BCDEGRST][BCDEGRST]*\)[     ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libpkgconf.exp

With USE_LTO:

--- libpkgconf.la ---
/bin/sh ./libtool  --tag=CC    --mode=link cc -DPERSONALITY_PATH=\"/usr/local/share/pkgconfig/personality.d:/usr/local/etc/pkgconfig/personality.d\" -DPKG_DEFAULT_PATH=\"/usr/local/libdata/pkgconfig:/usr/libdata/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/include\" -DSYSTEM_LIBDIR=\"/usr/lib\" -march=sandybridge -mtune=sandybridge -O2 -pipe -fcolor-diagnostics -march=sandybridge  -flto=thin -fstack-protector-strong -fno-strict-aliasing  -Wall -Wextra -Wformat=2 -std=gnu99  -no-undefined -version-info 3:0:0 -export-symbols-regex '^pkgconf_' -flto=thin -fstack-protector-strong -o libpkgconf.la -rpath /usr/local/lib libpkgconf/audit.lo libpkgconf/cache.lo  libpkgconf/client.lo libpkgconf/pkg.lo libpkgconf/bsdstubs.lo  libpkgconf/fragment.lo libpkgconf/argvsplit.lo  libpkgconf/fileio.lo libpkgconf/tuple.lo  libpkgconf/dependency.lo libpkgconf/queue.lo  libpkgconf/path.lo libpkgconf/personality.lo  libpkgconf/parser.lo
libtool: link: /usr/bin/nm  libpkgconf/.libs/audit.o libpkgconf/.libs/cache.o libpkgconf/.libs/client.o libpkgconf/.libs/pkg.o libpkgconf/.libs/bsdstubs.o libpkgconf/.libs/fragment.o libpkgconf/.libs/argvsplit.o libpkgconf/.libs/fileio.o libpkgconf/.libs/tuple.o libpkgconf/.libs/dependency.o libpkgconf/.libs/queue.o libpkgconf/.libs/path.o libpkgconf/.libs/personality.o libpkgconf/.libs/parser.o   |  | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libpkgconf.exp
eval: 1: Syntax error: "|" unexpected
*** [libpkgconf.la] Error code 2
Comment 1 Piotr Kubaj freebsd_committer freebsd_triage 2021-10-04 14:41:18 UTC
From m4/libtool.m4:
_lt_libdeps_save_CFLAGS=$CFLAGS
case "$CC $CFLAGS " in #(
*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
esac

It looks like upstream for some reason disallows lto, so this port should be marked LTO_UNSAFE=yes.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2021-10-05 00:10:44 UTC
Note however the 'eval: 1: Syntax error: "|" unexpected' appears to be a broader libtool issue and should be isolated.

Presumably also, the addition (appending) of '-fno-lto' would override our use of -flto=thin and doesn't results in the error as described here, or an error at all.

^Triage: Modify summary to describe the broader issue class, as it affects multiple ports in an identical manner.
Comment 3 Rene Ladan freebsd_committer freebsd_triage 2022-03-07 19:55:01 UTC
Maintainer reset.