Re: BUG #15349: "make installcheck -C src/interfaces/libpq" fails

Поиск
Список
Период
Сортировка
От Alexander Lakhin
Тема Re: BUG #15349: "make installcheck -C src/interfaces/libpq" fails
Дата
Msg-id f8dead56-0844-bf0c-c7bc-6b5c738fe3b8@gmail.com
обсуждение исходный текст
Ответ на BUG #15349: "make installcheck -C src/interfaces/libpq" fails  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
Hello,
> The following bug has been logged on the website:
>
> Bug reference:      15349
> Logged by:          Alexander Lakhin
> Email address:      exclusion@gmail.com
> PostgreSQL version: 11beta3
> Operating system:   Ubuntu 18.04
> Description:        
>
> With REL_11_STABLE (also reproduced with versions 10 and 9.6) "make
> installcheck -C src/interfaces/libpq" fails:
> ./configure && make
> make installcheck -C src/interfaces/libpq # or make all -C src/interfaces/libpq/test/
>
> gcc -L../../../../src/port -L../../../../src/common -L../../../../src/common -lpgcommon -L../../../../src/port
-lpgport-L../../../../src/interfaces/libpq -lpq -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
uri-regress.o  -o uri-regress
 
> uri-regress.o: In function `main':
> uri-regress.c:(.text.startup+0x60): undefined reference to `PQconninfoParse'
> uri-regress.c:(.text.startup+0x71): undefined reference to `PQconndefaults'
> collect2: error: ld returned 1 exit status
> <builtin>: recipe for target 'uri-regress' failed
> make: *** [uri-regress] Error 1
>
> If I restore previous version of libpq/test/Makefile:
> git show dddfc4cb~1:src/interfaces/libpq/test/Makefile
>> src/interfaces/libpq/test/Makefile
> then "make all -C src/interfaces/libpq/test/" succeeds:
> gcc -L../../../../src/port -L../../../../src/common   -Wl,--as-needed
-Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags uri-regress.o  -L../../../../src/common -lpgcommon
-L../../../../src/port-lpgport -L../../../../src/interfaces/libpq -lpq  -o uri-regress
 
> make: Leaving directory '/space/tmp/postgres.chk/src/interfaces/libpq/test'
As I found out, this issue is caused by --as-needed flag and wrong
linking order.
The following command (generated with the new Makefile) fails:
gcc -L../../../../src/port -L../../../../src/common
-L../../../../src/common -lpgcommon -L../../../../src/port -lpgport
-L../../../../src/interfaces/libpq -lpq -Wl,--as-needed
-Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags  uri-regress.o -o
uri-regress

But when I place '-lpq' after 'uri-regress.o', the compilation succeeds:
gcc -L../../../../src/port -L../../../../src/common
-L../../../../src/common -lpgcommon -L../../../../src/port -lpgport
-L../../../../src/interfaces/libpq -Wl,--as-needed
-Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags uri-regress.o -lpq
-o uri-regress

This behavior is documented in
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Importance_of_linking_order

BTW, I wonder why it's not reproduced on Fedora (27, 28) and whether
this check is performed in BuildFarm.


Best regards,
------
Alexander Lakhin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



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

Предыдущее
От: Adrien Nayrat
Дата:
Сообщение: Re: PostgreSQL 10.0 SELECT LIMIT performance problem
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #15376: Postgres sql 9.4.19 pg_upgrade stops with error Thesource cluster was not shut down cleanly.