libmysqlclient.dylib : relative path not allowed in hardened program
kaushikjnayak opened this issue · 3 comments
I am on Mac OS . macOS 12.5.1 (Monterey) and have Postgres.app version 14.
Also, I have Installed mysql using brew.
knayak=# CREATE EXTENSION IF NOT EXISTS mysql_fdw;
ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 0x0001): tried: 'libmysqlclient.dylib' (relative path not allowed in hardened program), '/usr/lib/libmysqlclient.dylib' (no such file)
HINT: Export LD_LIBRARY_PATH to locate the library.
I have been struggling to find a solution to this, but can't. What I've already tried so far based on various solutions suggested.
Created softlink
/usr/local/lib/libmysqlclient.dylib -> /opt/homebrew/Cellar/mysql/8.0.32/lib/libmysqlclient.21.dylib
Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to /opt/homebrew/Cellar/mysql/8.0.32/lib
Stopped and started Postgres.app service after changing these. /usr/lib is not allowed to be touched or else I would have placed the file in /usr/lib/ . But, for some reason it is not considering LD_LIBRARY_PATH or DYLD_LIBRARY_PATH at all.
Hi @kaushikjnayak,
MacOS is not a supported platform for mysql_fdw. We have not tested mysql_fdw on MacOS, so we suggest you to use supported platforms which are listed in the below document:
https://www.enterprisedb.com/docs/mysql_data_adapter/latest/installing/
Hello @surajkharage19
Thanks for the response. I figured out a way to make it work in MacOS.
Since I had a softlink created - /usr/local/lib/libmysqlclient.dylib pointing to /opt/homebrew/Cellar/mysql/8.0.32/lib/libmysqlclient.21.dylib ,
I changed the line in Makefile
PG_CPPFLAGS += -D _MYSQL_LIBNAME=\"lib$(MYSQL_LIB)$(DLSUFFIX)\"
to
PG_CPPFLAGS += -D _MYSQL_LIBNAME=\"/usr/local/lib/lib$(MYSQL_LIB)$(DLSUFFIX)\"
and then ran make, make install.
Thanks. Good to know that.
Since the issue is resolved, can you please close the issue from your side?