Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with PostgreSQL 17 support #185

Open
devrimgunduz opened this issue Sep 23, 2024 · 7 comments
Open

Issue with PostgreSQL 17 support #185

devrimgunduz opened this issue Sep 23, 2024 · 7 comments

Comments

@devrimgunduz
Copy link

Hi,

5.5.2 fails to build against PostgreSQL 17 RC1. Log is attached. Please note that some of them are probably GCC 14 warnings that may need to be fixed.

mongo_fdw-5.5.2-pg17-build-error.txt

GA is due soon. Can you please take a look? Thanks!

Regards, Devrim

@vaibhavdalvi93
Copy link

vaibhavdalvi93 commented Sep 24, 2024

@devrimgunduz , It will be good if you could please let us know more details:

  1. Full build log report. Looks like you have shared only errors and warnings.
  2. Specific platform i.e. OS and its version
  3. These warnings occur only when compiled using GCC-14 or older versions of GCC as well
  4. The PostgreSQL installed via package or from source
  5. Only PG17 has these warnings, or back-branches as well

We're unable to reproduce reported warnings at our end. So, these above details may help us to get reported warnings and fix them. Thanks.

@vaibhavdalvi93
Copy link

Thanks, @devrimgunduz for reporting an issue.

We're suspecting that following file is missing from your json-c directory(which resided in mongo_fdw root directory):

json-c/json_util.c

We have tried to compile the source code by removing this file and resulting in a same reported error, i.e.

(make: *** No rule to make target 'json-c/json_util.o', needed by 'mongo_fdw.so'. Stop.)

Also, will it be possible for you to tell that how you downloaded the JSON-C source code?
Whether the script autogen.sh is being used or it's been downloaded manually?

There may be another possibilities for this build failure but this is our primary suspicion.

Thanks & Regards,
Vaibhav

@vaibhavdalvi93
Copy link

We have tried to compile PG17 and mongo_fdw using GCC-14 and with compilation flag -Wmaybe-uninitialized on Ubuntu 24.04.

configure: using compiler=gcc (Ubuntu 14-20240412-0ubuntu1) 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f]
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O0 -Wmaybe-uninitialized.

Still, we're unable to reproduce the issue you have reported here. May be this is platform specific?

@devrimgunduz
Copy link
Author

I think you need to scroll down a bit more for the actual error. The most important ones is the ones at the last part of the text. See the lines around create_foreignscan_path()

This function was changed since the beta version you last released mongo_fdw. You will need something like this patch:

tds-fdw/tds_fdw@a694e82

or:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/sqlite_fdw/main/sqlite_fdw-pg17.patch;h=0fa10841268bdbdccc02bc488b57bcfb6573803c;hb=HEAD

I'm not a hacker, so ignore me if I am wrong.

FWIW this is the spec file that I use:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;f=rpm/redhat/main/non-common/mongo_fdw/main/mongo_fdw.spec;hb=HEAD

This is what I changed between 5.5.1 and 5.5.2:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=commitdiff;h=6c9be333116a94dd09c4a4642a9f2716aed532aa

I removed RHEL 7 bits, some llvm macros related to RPM builds and then also removed calls to autogen.sh.

@jeevanchalke
Copy link

Thank you @devrimgunduz

create_foreignscan_path() only complains about the uninitialized variable. We will definitely fix those warnings in the new release. However, it should not fail the build. We wonder why it is failing for you. There is NO specific error in the log you have shared.

BTW, the changes you are suggesting are already part of the below commit:
11921b3 - Add support for PostgreSQL 17 and EDB Postgres Advanced Server 17.
Without these changes, it won't compile on any of the platforms due to function signature changes.

My guess is that since you have removed the calls to autogen.sh, json-c files are not copied and compiled which are required for the compilation of mongo_fdw. See the Makefile for the reference.

Can you please check your setup by re-adding the autogen.sh.

Thanks

@devrimgunduz
Copy link
Author

@jeevanchalke sorry for the late reply. It still fails on RHEL 8, RHEL 9, RHEL 10 beta and Fedora even after adding autogen.sh.

How does EDB build the packages?

@varshamehtre
Copy link

varshamehtre commented Dec 19, 2024

@devrimgunduz ,
To build mongo_fdw required mongo-c-driver version is >= 1.17..
If mongo-c-driver version provided by system repos is lower than the required version , we use EDB built edb-libmongoc
1.17.3 driver.
Changes done in spec file to make use of edb-libmongoc driver:
Update spec file to use edb-libmongoc* as build time and install time dependency
To edb-libmongoc driver for building , disable mongo-c-driver compilation in autogen.sh by using following commands in spec file

sed -i 's|^checkout_mongo_driver|#checkout_mongo_driver|' autogen.sh sed -i 's|^install_mongoc_driver|#install_mongo_driver|' autogen.sh sed -i 's|^make install |# make install|' autogen.sh sed -i 's|^export PKG_CONFIG_PATH=mongo-c-driver/src/:mongo-c-driver/src/libbson/src|#export PKG_CONFIG_PATH=mongo-c-driver/src/:mongo-c-driver/src/libbson/src|' autogen.sh

In case of json-c: autogen.sh downloads sources of json-c version 0.15-20200726 and compiles it.
Makefile present in mongo_fdw sources uses object files from json-c directory i.e there is static linking with json-c.
Changes done in spec file to use compiled json-c object files is: instead of using paths from installed location, working directory path is used.
sed -i 's|\${JSONC_INSTALL_DIR}|\${PWD}|' autogen.sh

Looking at the spec file shared by you, json-c headers and lib from system paths are used. But Makefile is looking for object files from json-c directory(this should have been generated by autogen.sh). This is the probable cause of the build failure. If you fix the JSONC_INSTALL_DIR with the required path of json-c directory , it may fix your issue.
This is what we do:
sed -i ‘s|\${JSONC_INSTALL_DIR}|\${PWD}|’ autogen.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants