userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.36k stars 272 forks source link

USERVER_FEATURE_PATCH_LIBPQ fails to build with Postgresql16 #570

Closed root-kidik closed 3 months ago

root-kidik commented 3 months ago

OS: ubuntu24.04 Compiler: g++ 4:13.2.0-7ubuntu1 Postgresql: postgresql 16.2-1ubuntu4

Error:

CMake Error at postgresql/pq-extra/CMakeLists.txt:40 (message):
  Error while compiling libpq patch:

  Change Dir:
  '/home/rtkid/Downloads/userver/build_debug/postgresql/pq-extra/require_pq_extra/CMakeFiles/CMakeTmp'

  Run Build Command(s): /usr/bin/ninja -v cmTC_fb285

  [1/4] /usr/bin/cc -isystem /usr/include/postgresql/16/server -isystem
  /usr/include/postgresql/internal -isystem /usr/include/postgresql -isystem
  /usr/include/gssapi -o CMakeFiles/cmTC_fb285.dir/check_main.c.o -c
  /home/rtkid/Downloads/userver/postgresql/pq-extra/check_main.c

  [2/4] /usr/bin/cc -isystem /usr/include/postgresql/16/server -isystem
  /usr/include/postgresql/internal -isystem /usr/include/postgresql -isystem
  /usr/include/gssapi -o CMakeFiles/cmTC_fb285.dir/pq_portal_funcs.c.o -c
  /home/rtkid/Downloads/userver/postgresql/pq-extra/pq_portal_funcs.c

  [3/4] /usr/bin/cc -isystem /usr/include/postgresql/16/server -isystem
  /usr/include/postgresql/internal -isystem /usr/include/postgresql -isystem
  /usr/include/gssapi -o CMakeFiles/cmTC_fb285.dir/pq_workaround.c.o -c
  /home/rtkid/Downloads/userver/postgresql/pq-extra/pq_workaround.c

  [4/4] : && /usr/bin/cc -Wl,--gc-sections
  CMakeFiles/cmTC_fb285.dir/check_main.c.o
  CMakeFiles/cmTC_fb285.dir/pq_portal_funcs.c.o
  CMakeFiles/cmTC_fb285.dir/pq_workaround.c.o -o cmTC_fb285
  /usr/lib/aarch64-linux-gnu/libpq.a /usr/lib/postgresql/16/lib/libpgcommon.a
  /usr/lib/postgresql/16/lib/libpgport.a
  /usr/lib/aarch64-linux-gnu/libldap.so /usr/lib/aarch64-linux-gnu/libssl.so
  /usr/lib/aarch64-linux-gnu/libcrypto.so
  /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so && :

  FAILED: cmTC_fb285

  : && /usr/bin/cc -Wl,--gc-sections CMakeFiles/cmTC_fb285.dir/check_main.c.o
  CMakeFiles/cmTC_fb285.dir/pq_portal_funcs.c.o
  CMakeFiles/cmTC_fb285.dir/pq_workaround.c.o -o cmTC_fb285
  /usr/lib/aarch64-linux-gnu/libpq.a /usr/lib/postgresql/16/lib/libpgcommon.a
  /usr/lib/postgresql/16/lib/libpgport.a
  /usr/lib/aarch64-linux-gnu/libldap.so /usr/lib/aarch64-linux-gnu/libssl.so
  /usr/lib/aarch64-linux-gnu/libcrypto.so
  /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so && :

  /usr/bin/ld: /usr/lib/postgresql/16/lib/libpgcommon.a(pg_prng.o): in
  function `pg_prng_double_normal':

  (.text+0x4d4): undefined reference to `log'

  /usr/bin/ld: (.text+0x4e8): undefined reference to `sqrt'

  /usr/bin/ld: (.text+0x504): undefined reference to `sin'

  collect2: error: ld returned 1 exit status

  ninja: build stopped: subcommand failed.

  If there are errors up above then the versions of libpq, libpgport and
  libpgcommon diverged:
  /usr/lib/aarch64-linux-gnu/libpq.a;/usr/lib/postgresql/16/lib/libpgcommon.a;/usr/lib/postgresql/16/lib/libpgport.a

  Install the same versions of PostgreSQL client and server libraries, use
  USERVER_PG_SERVER_INCLUDE_DIR, USERVER_PG_SERVER_LIBRARY_DIR,
  USERVER_PG_INCLUDE_DIR and USERVER_PG_LIBRARY_DIR CMake options if needed;
  or disable libpq patching via CMake flag -DUSERVER_FEATURE_PATCH_LIBPQ=OFF.
root-kidik commented 3 months ago

Resolved: 0737152