EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
326 stars 70 forks source link

getting stuck while insatlling the mongo_fdw on ubuntu20.04 server #164

Open snadden opened 2 years ago

snadden commented 2 years ago

While executing this command snadden@lflinux:/etc/postgresql/12/main$ PATH=/etc/postgresql/12/main:$PATH make make: *** No targets specified and no makefile found. Stop. Then I am unable to run the remaining commnads

vaibhavdalvi93 commented 2 years ago

@snadden , Can you please provide us detailed steps you followed to install mongo_fdw on ubuntu.

snadden commented 2 years ago

Dear Sir,

I was following these steps

Steps for manual installation https://github.com/EnterpriseDB/mongo_fdw#mongo-cmongo-c https://github.com/EnterpriseDB/mongo_fdw#meta-drivermeta driver

  1. Download and extract source code of mongoc driver for version 1.17.3

wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.3/mongo-c-driver-1.17.3.tar.gz tar xzf mongo-c-driver-1.17.3.tar.gz rm -rf mongo-c-driver mv mongo-c-driver-1.17.3 mongo-c-driver cd mongo-c-driver

  1. Configure mongoc driver

cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .

To install at custom location:

cmake -DCMAKE_INSTALL_PREFIX=YOUR_INSTALLATION_DIRECTORY -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .

  1. Compile and install

cmake --build . cmake --build . --target install

For more details on installation of mongo-c driver, you can refer herehttp://mongoc.org/libmongoc/1.17.3/installing.html#configuring-the-build.

https://github.com/EnterpriseDB/mongo_fdw#legacy-driverLegacy driver

Deprecation Notice: The legacy driver support has been deprecated in mongo_fdw 5.4.0 and is expected to be removed entirely in a future release.

https://github.com/EnterpriseDB/mongo_fdw#json-cjson-c

  1. Download and extract source code

wget https://github.com/json-c/json-c/archive/json-c-0.15-20200726.tar.gz tar -xzf json-c-0.15-20200726.tar.gz rm -rf json-c mv json-c-json-c-0.15-20200726/ json-c cd json-c

  1. Configure

cmake .

To install at custom location:

cmake -DCMAKE_INSTALL_PREFIX=YOUR_INSTALLATION_DIRECTORY .

  1. Compile and install

make make install

How to compile against mongo-c Meta or Legacy driver?

To compile against legacy driver, 'Makefile.legacy' must be used and 'Makefile.meta' must be used to compile against the meta driver. For example, this can be achieved by copying required Makefile as shown below: For meta,

cp Makefile.meta Makefile

For legacy (Deprecated in mongo_fdw 5.4.0),

cp Makefile.legacy Makefile

The default compilation is with Meta driver.

https://github.com/EnterpriseDB/mongo_fdw#mongo_fdw-configuration-compilation-and-installationMongo_fdw configuration, compilation and installation

The PKG_CONFIG_PATH environment variable must be set to mongo-c-driver source directory for successful compilation as shown below,

export PKG_CONFIG_PATH=$YOUR_MONGO_FDW_SOURCE_DIR/mongo-c-driver/src/libmongoc/src:$YOUR_MONGO_FDW_SOURCE_DIR/mongo-c-driver/src/libbson/src

The LD_LIBRARY_PATH environment variable must include the path to the mongo-c installation directory containing the libmongoc-1.0.so and libbson-1.0.so files. For example, assuming the installation directory is /home/mongo-c and the libraries were created under it in lib64 sub-directory, then we can define the LD_LIBRARY_PATH as:

export LD_LIBRARY_PATH=/home/mongo-c/lib64:$LD_LIBRARY_PATH

Note: This LD_LIBRARY_PATH environment variable setting must be in effect when the pg_ctl utility is executed to start or restart PostgreSQL or EDB Postgres Advanced Server.

  1. To build on POSIX-compliant systems you need to ensure the pg_config executable is in your path when you run make. This executable is typically in your PostgreSQL installation's bin directory. For example:

export PATH=/usr/local/pgsql/bin/:$PATH

  1. Compile the code using make.

make USE_PGXS=1

  1. Finally install the foreign data wrapper.

make USE_PGXS=1 install

  1. Running regression test.

make USE_PGXS=1 installcheck

However, make sure to set the MONGO_HOST, MONGO_PORT, MONGO_USER_NAME, and MONGO_PWD environment variables correctly. The default settings can be found in the mongodb_init.sh script.

Thanks & Regards Snadden Braganza IT Dept. 9833498580 [cid:aaa1876f-9a15-49b1-9dac-d177403db8f8]

Disclaimer :The information contained herein(including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Liases Foras Real Estate Rating & Research Pvt. Limited


From: Vaibhav Dalvi @.> Sent: Friday, August 26, 2022 10:47 AM To: EnterpriseDB/mongo_fdw @.> Cc: Snadden Braganza @.>; Mention @.> Subject: Re: [EnterpriseDB/mongo_fdw] getting stuck while insatlling the mongo_fdw on ubuntu20.04 server (Issue #164)

@snaddenhttps://github.com/snadden , Can you please provide us detailed steps you followed to install mongo_fdw on ubuntu.

— Reply to this email directly, view it on GitHubhttps://github.com/EnterpriseDB/mongo_fdw/issues/164#issuecomment-1228063551, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2WGAKXIMTIDVC5HVDRCA6DV3BHPJANCNFSM57SSAUUA. You are receiving this because you were mentioned.Message ID: @.***>

vaibhavdalvi93 commented 2 years ago

Can you please tell us which step is failing out of all above listed?

snadden commented 2 years ago

Dear Sir,

To build on POSIX-compliant systems you need to ensure the pg_config executable is in your path when you run make. This executable is typically in your PostgreSQL installation's bin directory. For example:

export PATH=/usr/local/pgsql/bin/:$PATH

I have done till this steps

While i run the make step I get an error make n target specified and no target found

Compile the code using make.

make USE_PGXS=1

Thanks & Regards Snadden Braganza IT Dept. 9833498580 [cid:5e8b8f73-7603-456f-ba4a-41d1f20f4408]

Disclaimer :The information contained herein(including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Liases Foras Real Estate Rating & Research Pvt. Limited


From: Vaibhav Dalvi @.> Sent: Friday, August 26, 2022 12:25 PM To: EnterpriseDB/mongo_fdw @.> Cc: Snadden Braganza @.>; Mention @.> Subject: Re: [EnterpriseDB/mongo_fdw] getting stuck while insatlling the mongo_fdw on ubuntu20.04 server (Issue #164)

Can you please tell us which step is failing out of all above listed?

— Reply to this email directly, view it on GitHubhttps://github.com/EnterpriseDB/mongo_fdw/issues/164#issuecomment-1228124915, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2WGAKVPQJP4NUDBKGPSOOTV3BS67ANCNFSM57SSAUUA. You are receiving this because you were mentioned.Message ID: @.***>

vaibhavdalvi93 commented 2 years ago

Thanks for response.

I think, you haven't downloaded source code of mongo_fdw. Before performing any of the above steps, please download the mongo_fdw source code by using following command:

       git clone https://github.com/EnterpriseDB/mongo_fdw/   .

Then, go to mongo_fdw directory and perform all other steps.

snadden commented 1 year ago

Dear Sir,

I have download the mongo_fdw folder and ran the below inside that path

make USE_PGXS=1

@.:~/mongo_fdw$ make USE_PGXS=1 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC --std=c99 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -Ijson-c -DMETA_DRIVER -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o connection.o connection.c In file included from connection.c:21: mongo_wrapper.h:27:10: fatal error: json.h: No such file or directory 27 | #include | ^~~~ compilation terminated. make: [: connection.o] Error 1

Thanks & Regards Snadden Braganza IT Dept. 9833498580 [cid:f98fd687-344d-485c-aa73-46997e493feb]

Disclaimer :The information contained herein(including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Liases Foras Real Estate Rating & Research Pvt. Limited


From: Vaibhav Dalvi @.> Sent: Friday, August 26, 2022 12:38 PM To: EnterpriseDB/mongo_fdw @.> Cc: Snadden Braganza @.>; Mention @.> Subject: Re: [EnterpriseDB/mongo_fdw] getting stuck while insatlling the mongo_fdw on ubuntu20.04 server (Issue #164)

Thanks for response.

I think, you haven't downloaded source code of mongo_fdw. Before performing any of the above steps, please download the mongo_fdw source code by using following command:

   git clone https://github.com/EnterpriseDB/mongo_fdw/   .

Then, go to mongo_fdw directory and perform all other steps.

— Reply to this email directly, view it on GitHubhttps://github.com/EnterpriseDB/mongo_fdw/issues/164#issuecomment-1228134877, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2WGAKS65W5PKZ6XM3FGGDLV3BUQFANCNFSM57SSAUUA. You are receiving this because you were mentioned.Message ID: @.***>

vaibhavdalvi93 commented 1 year ago

Hi @snadden

Looks like after downloading the mongo_fdw source instantly you're trying to compile the mongo_fdw source code. Please make sure that after downloading the mongo_fdw you're downloading and compiling the mongoc driver and jsonc code. You can use autogen.sh (--with-master option as mentioned in the README) script to automatically download and install mongoc-c-driver, json-c and libbson. Please make use of autogen.sh script which automatically download, compile and install required version of mongo-c-drive, libbson and json-c.

Then please perform remaining steps i.e. compiling and installing mongo_fdw only after successful execution of autogen.sh.

rafaljot commented 1 year ago

I had the same error on Ubuntu 22.4. Installing libmongo-client-dev helped.

sudo apt-get install libmongo-client-dev