Configure problem when cross-compiling PostgreSQL 16.1

Поиск
Список
Период
Сортировка
От Dominik Michael Rauh
Тема Configure problem when cross-compiling PostgreSQL 16.1
Дата
Msg-id 79e63515-0f5e-30f4-136d-96e23b1a817d@posteo.de
обсуждение исходный текст
Ответы Re: Configure problem when cross-compiling PostgreSQL 16.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi all,

I was trying to cross-compile PostgreSQL 16.1 using Buildroot which worked fine
until I executed "initdb" on my target device, where I faced the following error:

2023-12-06 07:10:18.568 UTC [31] FATAL:  could not load library 
"/usr/lib/postgresql/dict_snowball.so": /usr/lib/postgresql/dict_snowball.so: 
undefined symbol: CurrentMemoryContext

It turned out that the "postgres" binary was missing the symbol
"CurrentMemoryContext" because the configure script assumed that my toolchain's
(GCC 9.4) linker does not support "--export-dynamic", although it supports it.

I had a quick look at the configure script where the following lines peeked my
interest:

if test "$cross_compiling" = yes; then :
   pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic="assuming no"

Apparently when cross-compiling the linker is automatically assumed to not
understand "--export-dynamic", leading to aforementioned problem on my end.

A workaround of mine is to override
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic with "yes", which makes
everything work as expected.

There is also at least one additional linker flag "--as-needed" that is not
being used when cross-compiling. Is this a bug or am I misunderstanding the
implications that PostgreSQL has when "$cross_compiling=yes"?

Best regards,
Dominik



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: remaining sql/json patches
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: backtrace_on_internal_error