hackinghat / cl-mysql

Common Lisp MySQL library
http://hackinghat.com/index.php/cl-mysql
53 stars 17 forks source link

Error opening shared library libmysql.dll : The specified module could not be found. #12

Open VK3FNG opened 8 years ago

VK3FNG commented 8 years ago

I'm writing a small web system that interfaces with a MariaDB, and I was tempted by the CL-MySQL blurb that states:

Simpler deployment – CLSQL requires some shared/dynamic libraries to run. These shared libraries offer 64 bit support. However because of the way CLSQL loads into the Lisp image you can not easily, in SBCL for example, load the CLSQL and save-lisp-and-die and deploy the core. It’s possible to do but you must deploy these shared libraries in the same paths that they were built in when CLSQL was installed or find a way to relocate the libraries to a new path. I don’t want to install in the same path as my dev system and I have tried relocating, whatever way you do it it’s pretty ugly.

However, when I try to use CL-MySQL with Quicklisp, I get:

`2 > (ql:quickload "cl-mysql") To load "cl-mysql": Load 1 ASDF system: uiop Install 5 Quicklisp releases: alexandria babel cffi cl-mysql trivial-features ; Fetching #<URL "http://beta.quicklisp.org/archive/trivial-features/2015-09-23/ trivial-features-20150923-git.tgz">

; 10.26KB

10,510 bytes in 0.00 seconds (2565.92KB/sec) ; Fetching #<URL "http://beta.quicklisp.org/archive/babel/2015-06-08/babel-20150 608-git.tgz">

; 248.03KB

253,987 bytes in 1.49 seconds (166.91KB/sec) ; Fetching #<URL "http://beta.quicklisp.org/archive/alexandria/2016-04-21/alexan dria-20160421-git.tgz">

; 49.43KB

50,620 bytes in 1.48 seconds (33.33KB/sec) ; Fetching #<URL "http://beta.quicklisp.org/archive/cffi/2016-03-18/cffi_0.17.1. tgz">

; 234.48KB

240,107 bytes in 4.45 seconds (52.69KB/sec) ; Fetching #<URL "http://beta.quicklisp.org/archive/cl-mysql/2016-06-28/cl-mysql -20160628-git.tgz">

; 25.03KB

25,627 bytes in 0.00 seconds (5005.27KB/sec) ; Loading "cl-mysql" [package alexandria.0.dev]........................ .................................................. .................................................. [package babel-encodings]......................... [package babel]................................... .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. [package cffi-sys]................................ [package cffi-callbacks].......................... [package cffi].................................... .................................................. .................................................. [package cffi-features]........................... [package com.hackinghat.cl-mysql-system].....> Error: Unable to load foreign lib rary (LIBMYSQLCLIENT).

     Error opening shared library libmysql.dll : The specified module coul

d not be found. . While executing: CFFI::FL-ERROR, in process listener(1).

Type :POP to abort, :R for a list of available restarts. Type :? for other options. 3 >`

I'm using CCL on Win8/64bit.

I'm sure it's me being an idiot, but what am I doing wrong?

rudolph-miller commented 8 years ago

Make sure you have libmysqlclient.dll in LD_LIBRARY_PATH (or something equivalent). How to install libmysqlclinet.dll?? -> https://www.google.com/?q=how+to+install+libmysqlclient.dll

VK3FNG commented 8 years ago

Hi Rudolph,

I tried adding the library path to erm, $PATH, but that didn't work.

The only thing that worked was to add it to the CCL directory. (Yay!)

What's the best way to deal with this when I compile and save-lisp-and-die (save-application on ccl)? Where do I put the DLL?

snmsts commented 8 years ago

Hi, VK3FNG. You need to know how windows find dll modules. see https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx

VK3FNG commented 8 years ago

Hi again,

I copied the DLL into the cl-mysql dist directory and it worked, which is great!

I'd really like to be able to specify the location of the dll so I can bundle it with the lisp image (like you can with cl-sql, ie (clsql:push-library-path #p"C:/mydir/")) though.

Is there any way to do that?

Thanks for your help!

snmsts commented 8 years ago

Have you read?