Cant link libpq with a pg extension using cmake

From: Tony Wayne <anonymouslydark3(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Cant link libpq with a pg extension using cmake
Date: 2024-04-01 00:47:33
Message-ID: CAAW5B8zyBjeV02yiWeu3iX7=CJfJDybTnmpP88DPaWMtcqpiPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

i am getting linking issues when trying to link libpq with my pg extension
and i am using pg's libpq ,so libpq is built along with pg,so i did this in
my extension's cmakelists.txt

file (GLOB storage_SRC CONFIGURE_DEPENDS "*.cpp" )
add_library(storage OBJECT ${storage_SRC})
target_link_libraries(storage PRIVATE pq)

btw included all required include dirs in my toplevel cmakelists.txt

then i got undefined symbol: pqsecure_write but don't know why if i give
the pg_config --libdir/libpq.a path in target_link_libraries instead of lib
name then it links but walreceiver process cant start and i get FATAL:
could not connect to the primary server: libpq is incorrectly linked to
backend functions

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2024-04-01 00:56:29 RE: Synchronizing slots from primary to standby
Previous Message Tom Lane 2024-04-01 00:47:32 Re: Statistics Import and Export