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

dlopen(libmysqlclient.dylib, 1): image not found #36

Closed
dataground opened this issue Jan 15, 2015 · 9 comments
Closed

dlopen(libmysqlclient.dylib, 1): image not found #36

dataground opened this issue Jan 15, 2015 · 9 comments

Comments

@dataground
Copy link

Mac OS-X 10.9.5: I followed instructions
All went well.

I tried:
CREATE EXTENSION mysql_fdw;

I Got:
ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 1): image not found
HINT: export LD_LIBRARY_PATH to locate the library

********** Error **********

ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 1): image not found
SQL state: HV00L
Hint: export LD_LIBRARY_PATH to locate the library

@ibrarahmad
Copy link
Contributor

You need to export the DYLD_LIBRARY_PATH on Mac OS

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

On Thu, Jan 15, 2015 at 2:30 PM, Dataground notifications@github.com
wrote:

Mac OS-X 10.9.5: I followed instructions
All went well.

I tried:
CREATE EXTENSION mysql_fdw;

I Got:
ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 1): image not found
HINT: export LD_LIBRARY_PATH to locate the library

********** Error **********

ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 1): image not found
SQL state: HV00L
Hint: export LD_LIBRARY_PATH to locate the library


Reply to this email directly or view it on GitHub
#36.

Ibrar Ahmed
EnterpriseDB http://www.enterprisedb.com

@dataground
Copy link
Author

Still no luck..

export DYLD_LIBRARY_PATH=/usr/local/mysql-connector-c-6.1.5-osx10.7-x86_64/lib

/Applications/Postgres.app/Contents/Versions/9.4/bin > ./psql
psql (9.4.0)
Type "help" for help.

pim=# CREATE EXTENSION mysql_fdw;
ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 1): image not found
HINT: export LD_LIBRARY_PATH to locate the library
pim=#

@ibrarahmad
Copy link
Contributor

It should work, please do these steps.

1 - Stop the postgres server
2 - On the same shell export DYLD_LIBRARY_PATH=/usr/local/
mysql-connector-c-6.1.5-osx10.7-x86_64/lib
3 - Start postgres server
4 - ./psql
5 - CREATE EXTENSION mysql_fdw;

Please send me listing of /usr/local/mysql-connector-c-6.1.5-osx10.7-x86_64/lib
folder.

ls /usr/local/mysql-connector-c-6.1.5-osx10.7-x86_64/lib

On Thu, Jan 15, 2015 at 8:13 PM, Dataground notifications@github.com
wrote:

Still no luck..

export
DYLD_LIBRARY_PATH=/usr/local/mysql-connector-c-6.1.5-osx10.7-x86_64/lib

/Applications/Postgres.app/Contents/Versions/9.4/bin > ./psql
psql (9.4.0)
Type "help" for help.

pim=# CREATE EXTENSION mysql_fdw;
ERROR: failed to load the mysql query:
dlopen(libmysqlclient.dylib, 1): image not found
HINT: export LD_LIBRARY_PATH to locate the library
pim=#


Reply to this email directly or view it on GitHub
#36 (comment)
.

Ibrar Ahmed
EnterpriseDB http://www.enterprisedb.com

@dataground
Copy link
Author

It works! Thanks! I forgot to restart the server before...

@benmadin
Copy link

benmadin commented Apr 7, 2015

Can I just add... after some frustration, on Mac OS X Yosemite it is not enough to sudo launchctl unload and load postgres to effect this - you actually have to su -m _postgres and use pg_ctl to stop and start.

cheers

Ben

@morinel
Copy link

morinel commented Dec 23, 2015

Setting LD_LIBRARY_PATH nor DYLD_LIBRARY_PATH in $HOME/.bashrc worked for me when using PostgresApp on Mac OSX. It seems to ignore these environment variables when starting the helper app on login.

However, copying the file libmysqlclient.XYZ.dylib from MySQL's download to /usr/local/lib/libmysqlclient.dylib and restarting PostgesApp solved this problem for me. This works because the dlopen() system call as a final resort also looks into /usr/local/lib, as long as environment variable DYLD_FALLBACK_LIBRARY_PATH is not set.

Read man dlopen for more info.

@eMerzh
Copy link

eMerzh commented Jan 10, 2016

I still have the issue, not sure if i did smth wrong but i can't get it to work.

echo $LD_LIBRARY_PATH
# /usr/local/mysql/lib:/usr/local/mysql-5.6.16-osx10.7-x86_64/lib/:
ls -l /usr/local/mysql-5.6.16-osx10.7-x86_64/lib/
# total 555328
# -rwxr-xr-x   1 myuser  admin    4282344 Jan 14  2014 libmysqlclient.18.dylib
# -rw-r--r--   1 myuser  admin   10599048 Jan 14  2014 libmysqlclient.a
# lrwxr-xr-x   1 myuser  admin         23 Mar  3  2014 libmysqlclient.dylib -> libmysqlclient.18.dylib
# lrwxr-xr-x   1 myuser  admin         23 Mar  3  2014 libmysqlclient_r.18.dylib -> libmysqlclient.18.dylib
# lrwxr-xr-x   1 myuser  admin         16 Mar  3  2014 libmysqlclient_r.a -> libmysqlclient.a
# lrwxr-xr-x   1 myuser  admin         20 Mar  3  2014 libmysqlclient_r.dylib -> libmysqlclient.dylib
# -rw-r--r--   1 myuser  admin  133369856 Jan 14  2014 libmysqld-debug.a
# -rw-r--r--   1 myuser  admin  136040000 Jan 14  2014 libmysqld.a
# -rw-r--r--   1 myuser  admin      14544 Jan 14  2014 libmysqlservices.a
# drwxr-xr-x  17 myuser  admin        578 Jan 14  2014 plugin
/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_ctl -D "/Users/myuser/Library/Application Support/Postgres/var-9.5" stop
#waiting for server to shut down.... done
#server stopped

Applications/Postgres.app/Contents/Versions/9.5/bin/pg_ctl -D "/Users/myuser/Library/Application Support/Postgres/var-9.5" start
server starting
# LOG:  database system was shut down at 2016-01-10 11:43:39 CET
# LOG:  MultiXact member wraparound protections are now enabled
#  LOG:  database system is ready to accept connections
# LOG:  autovacuum launcher started

# psql -d mydb
# psql (9.5.0)
# mydb=# create extension mysql_fdw;
# ERROR:  failed to load the mysql query:
#   dlopen(libmysqlclient.dylib, 1): image not found
# HINT:  export LD_LIBRARY_PATH to locate the library
# STATEMENT:  create extension mysql_fdw;
# ERROR:  failed to load the mysql query:
# dlopen(libmysqlclient.dylib, 1): image not found
# HINT:  export LD_LIBRARY_PATH to locate the library

any idea?
(osx 10.11.2)

@morinel
Copy link

morinel commented Jan 10, 2016

See my comment above for a workaround for MacOS X

@eMerzh
Copy link

eMerzh commented Jan 10, 2016

arg! thanks a lot @morinel ... worked now :)

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

5 participants