postgres-native-sqldelight icon indicating copy to clipboard operation
postgres-native-sqldelight copied to clipboard

Add standard Linux paths to libpq.def

Open matobet opened this issue 1 year ago • 10 comments

Add /usr/include and /usr/lib64 to compiler and linker options respectively.

This should cover majority of x64 linux systems.

matobet avatar Sep 27 '23 17:09 matobet

Can you please add a reason why do you need it? These paths are for development only, afaik.

hfhbd avatar Sep 27 '23 17:09 hfhbd

@hfhbd Without this change the project doesn't build under Linux (Fedora 38, but I assume more Linux systems will also suffer from this).

matobet avatar Oct 01 '23 14:10 matobet

Not sure why the linuxArm64 build suddenly started failing (I have trouble cross-compiling linux_x64 to linux_arm64 on my system both before as well as after my change...) but perhaps moving the settings into platform-specific .linux_x64 sections will fix the CI failure...

matobet avatar Oct 02 '23 21:10 matobet

I think the failures are caused to the fact the local usr/include contains unrelated header files but the filter is set to * allowing all headers.

hfhbd avatar Oct 02 '23 22:10 hfhbd

Another shot with a more narrow headerFilter

matobet avatar Oct 06 '23 12:10 matobet

Add /usr/include and /usr/lib64 to compiler and linker options respectively.

+1 and here the reasons why.

Can you please add a reason why do you need it? These paths are for development only, afaik.

These paths are also for both development of dependent projects and runtime as well because libpq-dev provides dynamic (shared) libraries.

You might build a static native library instead, but your binary wouldn't be published with generated JARs, so other developers cannot use it as a dependency from Maven.

Myshkouski avatar Jan 26 '24 16:01 Myshkouski

@matobet I added some paths, do you need more?

hfhbd avatar Mar 03 '24 14:03 hfhbd

@hfhbd it seems on Fedora I still need to add -I/usr/include since the libpq-devel package installs the files there

/usr/bin/pg_config
/usr/include/libpq
/usr/include/libpq-events.h
/usr/include/libpq-fe.h
/usr/include/libpq/libpq-fs.h
/usr/include/pg_config-x86_64.h
/usr/include/pg_config.h
/usr/include/pg_config_ext-x86_64.h
/usr/include/pg_config_ext.h
/usr/include/pg_config_manual.h
/usr/include/pg_config_os.h
/usr/include/pgsql
/usr/include/pgsql/internal
/usr/include/pgsql/internal/c.h
/usr/include/pgsql/internal/fe-auth-sasl.h
/usr/include/pgsql/internal/libpq
/usr/include/pgsql/internal/libpq-int.h
/usr/include/pgsql/internal/libpq/pqcomm.h
/usr/include/pgsql/internal/port.h
/usr/include/pgsql/internal/postgres_fe.h
/usr/include/pgsql/internal/pqexpbuffer.h
/usr/include/postgres_ext.h
/usr/lib/.build-id
/usr/lib/.build-id/a8
/usr/lib/.build-id/a8/d9850aecf80d6f1207645fb9b1a67e0050cd49
/usr/lib64/libpq.so
/usr/lib64/pkgconfig/libpq.pc

(without the -I/usr/include I get the fatal error: 'libpq-fe.h' file not found error when executing the :postgres-native-sqldelight-driver:cinteropLibpqLinuxX64 task)

matobet avatar Mar 04 '24 09:03 matobet

Okay, can you just update the PR? Thanks.

hfhbd avatar Mar 04 '24 09:03 hfhbd

The tricky part here is to come up with such paths that make the project build both on fedora && on ubuntu (CI)...

matobet avatar Mar 11 '24 09:03 matobet