"Ordinal Not Found" when running the Diesel CLI tool - postgresql

I tried to install diesel_cli and after some environment variable issues I installed it successfully.
When I tried to setup Diesel for my project, it throws an error:
diesel.exe - Ordinal Not Found
The ordinal 4701 could not be located in the dynamic link library "C:\Program Files\PostgreSQL\11\lib\LIBPQ.dll."

Actually the issue was the postgreSQL version.
AFAIK, Postgres 11 is not compatible for diesel setup. Even if i had libpq.dll in lib folder of my postgres/11/lib folder structure. It throws the "pictured" error in the question.
Then, i tried uninstalling the postgres version 11.1 and installed the Postgres 10.6 version it works smoothly.
Note: After postgres install dn't forget to set environment variables

I experienced the same error.
When I dug into it I found that I had a incompatible version of ssleay32.dll on my system path as part of the Intel Wifi drivers.
In my case this was in C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS. Removing this from my system path fixed the issue.

Related

PostgresSQL could not load library plpython3.dll

I managed to install the plpython3u extention. But when I try to use a function that uses the extension I get:
ERROR: could not load library "C:/Program Files/PostgreSQL/12/lib/plpython3.dll": unknown error 126 SQL state: 58P01
I'm using windows 10 and postgresql 12.
You can simply solve this problem by installing the right (preferable version is in between 3.5.x to 3.8.x ) version of python and add paths to environment variables.
Steps:
Download and install the latest python version from this Download latest python version 3.8.x
Add environment variable:
C:\Program Files\Python38\Scripts
C:\Program Files\Python38

How to fix diesel_cli link libpq.lib error with Postgres tools installed in Docker?

I'm trying (for hours now) to install the cargo crate diesel_cli for postgres. However, every time I run the recommended cargo command:
cargo install diesel_cli --no-default-features --features postgres
I wait a few minutes just to see the same build fail with this message:
note: LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
error: aborting due to previous error
error: failed to compile `diesel_cli v1.4.1`, intermediate artifacts can be found at `C:\Users\<user name here>\AppData\Local\Temp\cargo-installUU2DtT`
Caused by:
could not compile `diesel_cli`.
I'm running postgres in a docker container and have the binaries on my C:\pgsql with the lib and bin directories both on the PATH so I can't figure out why it's not linking. What else could be required they didn't mention in the docs?
In my case the installation was successful but when I tried to run it this error occured.
maybe this would work for others who have the same problem:
open PowerShell
type in setx PQ_LIB_DIR "C:\Program Files\PostgreSQL\13\lib" (or any other path to your PostgreSQL lib)
restart your PC
run again
I had the same issue with WSL, if you're on Linux probably you could find PostgreSQL lib location and add it to your environment variables.
Update:
The answer below is a work around for older versions. Please check the possibility to execute cargo clean first
Original Version
Adding the folder to the PATH variable didn't help, at least in my case, as by some reason it is not used in the /LIBPATH parameter passed to link.exe.
In my case it was C:\Users\<username>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
You can see it in the beginning of the error message.
Copy libpq.lib in there and it will be used from there.
After installation diesel would require some other assemblies. Copy libcrypto-1_1-x64.dll, libiconv-2.dll and libssl-1_1-x64.dll into the folder showed after where diesel command execution
I had the same error on Ubuntu and for me the following install fixed the issue:
sudo apt install libpq-dev
No need to move files around, just add C:\Program Files\PostgreSQL\14\lib and C:\Program Files\PostgreSQL\14\bin to your PATH. Installing and running diesel should have no problems.
Note: your paths may be different, and remember to close/reopen your terminal so the PATH variable is updated.
(Tested on Windows 10)
To give clear steps for windows:
Add C:\Users<username>.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib in the path in environment variables
Copy libpq.lib that is in C:\Program Files\PostgreSQL\14\lib (obviously this is with version 14) and paste it in C:\Users<username>.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
If you've attempted to cargo build (or anything that runs the build scripts for libpq rust crate) when your environment was invalid, then you need to do a cargo clean after fixing your environment otherwise you'll still get the libpq.lib not found error even when it's in your PATH. The other answers where you copy the file into another directory are just hacks
You can instead add the path to .../lib to the compilers' library search paths, using RUSTFLAGS environment variable. It works both for installing diesel_cli and for building your projects.
RUSTFLAGS='-L /usr/local/pgsql/lib' cargo build
On Windows with EDB installer, the path contains a space, so use CARGO_ENCODED_RUSTFLAGS instead. For PowerShell:
$env:CARGO_ENCODED_RUSTFLAGS = "-L`u{1f}C:\Program Files\PostgreSQL\14\lib"

ERROR: incompatible library while creating extension in Postgresql

I use Centos 7 and Postgresql 12. I installed already PostGIS and created successfully its extension. I'm now tring to install semver extension with create extension semver and get following error:
ERROR: incompatible library »/usr/pgsql-12/lib/semver.so«: version
does not match
According to developer this version should work with my Postgresql 12. Why am i getting this error?
Thanks!
An extension's .so binaries are specific to a major release of Postgres.
If you're installing the extension through yum, there would typically be a different package for each Postgres version. For example, if you installed Postgres 12 using the postgresql12-server package, then you would install PostGIS 3.0 using the postgis30_12 package.
If the package name is just pg-semver, without a Postgres version number, then it's probably intended for your distribution's default postgresql-server package. In CentOS 7, this appears to be Postgres 9.2, so these files won't work on a Postgres 12 server.
If you can't find a PG12-specific package, you'll need to build it yourself, using the instructions here.

Can not find PostGIS extensions ( installed in a different directory ) and $libdir/postgis-2.3 in mac os

I'm using postgres in pycharm and it can't find the postGIS extensions. It is looking for them in: /Library/PostgreSQL/9.6/share/postgresql/extension/
however, when I install PostGIS, it tells me that: PostGIS extension modules are installed in: /usr/local/share/postgresql/extension
Another issue (don't know if it is related to the first) is : could not access file "$libdir/postgis-2.3": No such file or directory
I noticed this issue after having upgraded from PostGIS 2.3.0 to 2.4.0. My databases were still looking for 2.3.0 libraries when the 2.4.0 were installed.
The solution was to individually update the databases to look for the 2.4.0 versions:
ALTER EXTENSION postgis UPDATE;
SELECT PostGIS_full_version();
See Upgrading PostGIS section for further details
I installed using Homebrew and ran into this same issue. Seems to be resolved after following instructions from https://www.linuxquestions.org/questions/fedora-35/problems-to-start-postgresql-with-postgis-after-upgrade-to-fedora-28-a-4175629479/#post5853352:
Find where postgis-2.4.so is (e.g.
/database/postgresql/pgsql-10.0/lib/postgis-2.4.so) then create a
symbolic link to older name so for my example I'd do:
ln -s /database/postgresql/pgsql-10.0/lib/postgis-2.4.so /database/postgresql/pgsql-10.0/lib/postgis-2.3.so
For me, the fix was this exact command:
ln -s /usr/local/lib/postgresql/postgis-2.5.so /usr/local/lib/postgresql/postgis-2.3.so

Error F_SETLK when building bazel on CentOS 6.5

I am working on building and installing tensorflow on my institution's cluster computer, which is running CentOS 6.5.
Obviously, the first step is building and installing bazel. The build works just fine, but when I try to run the bazel binary, I get the following error:
Error: unexpected result from F_SETLK: Function not implemented
gcc version is 4.7.2
java version is jdk1.8.0_65
edit: I have also tried compiling gcc 4.9.4 and building with this version, and I have tried building both the latest dist of bazel, and the 0.3.1 from the git repo. All variants get the same error.
This happens if the filesystem where Bazel tries to install itself (unpack its embedded tools) doesn't support locking.
Workaround (until the relevant issue is resolved) is to specify a path on a local, writable (and file-lockable) filesystem for --output_user_root, for example:
bazel --output_user_root=/usr/local/$USER/bazelout build <targets>