Re: BUG #17100: undefined reference to `pg_qsort and pq_xxx

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: anilbommareddy09(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17100: undefined reference to `pg_qsort and pq_xxx
Date: 2021-07-12 15:57:18
Message-ID: 2971363.1626105438@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> Build command:
> ../configure --prefix=/path/to/pgsql-gcc CFLAGS='-O3 -flto' CXXFLAGS='-O3
> -flto'

When I try that on that platform (well, actually RHEL 8.4, but should
be close enough) I get a lot of complaints like

ar: pgstrsignal.o: plugin needed to handle lto object
ar: pqsignal.o: plugin needed to handle lto object
ar: qsort.o: plugin needed to handle lto object
ar: qsort_arg.o: plugin needed to handle lto object
ar: quotes.o: plugin needed to handle lto object
ar: snprintf.o: plugin needed to handle lto object

so that the later complaints like

/tmp/ccWzhmx0.ltrans29.ltrans.o: In function `_bt_preprocess_array_keys':
<artificial>:(.text+0x2d264): undefined reference to `qsort_arg'
/tmp/ccWzhmx0.ltrans29.ltrans.o: In function `tblspc_desc':
<artificial>:(.text+0xdee): undefined reference to `appendStringInfo'
<artificial>:(.text+0xe0a): undefined reference to `appendStringInfo'

aren't terribly surprising. Those functions should come out of
libpqcommon.a, but seemingly that hasn't been built correctly.

I'd say the conclusion is "don't use -flto, it doesn't really work
yet on this platform". Or possibly there's some not-installed-by-
default infrastructure you need to use it. Either way, this does
not look like a Postgres bug; it's a compiler toolchain problem.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-07-12 17:20:56 printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped)
Previous Message Tom Lane 2021-07-12 15:30:40 Re: Statistics updates is delayed when using `commit and chain`