bugguile-dbi - Bugs: bug #19483, Unable to use the SQLite driver...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #19483: Unable to use the SQLite driver under Mac OS X

Submitted by:  Maurizio Tomasi <zio_tom78>
Submitted on:  Tue 21 Feb 2012 04:38:06 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Privacy: PublicAssigned to: Linas Vepstas <linasvepstas>
Open/Closed: Closed

Thu 11 Apr 2013 01:40:13 PM UTC, comment #3:

Will be in 2.1.5

Linas Vepstas <linasvepstas>
Project AdministratorIn charge of this item.
Thu 11 Apr 2013 01:35:10 PM UTC, SVN revision 142:

load .dylib not .so for Mac OSX: fixes bug #19483

(Browse SVN revision 142)

Linas Vepstas <linasvepstas>
Project AdministratorIn charge of this item.
Thu 11 Apr 2013 03:11:22 AM UTC, comment #1:

I plan to push the following fix, soon as svn lets me ...

Index: src/guile-dbi.c
===================================================================
--- src/guile-dbi.c (revision 141)
+++ src/guile-dbi.c (working copy)
@@ -40,6 +40,7 @@
#define FUNC_NAME s_make_g_db_handle
{
char* sodbd = NULL;
+ size_t sodbd_len;
gdbi_db_handle_t *g_db_handle = NULL;
void (*connect)(gdbi_db_handle_t*);

@@ -58,16 +59,23 @@
g_db_handle->bcknd_str = scm_to_locale_string (bcknd);
g_db_handle->bcknd_strlen = strlen(g_db_handle->bcknd_str);

- sodbd = (char*) malloc (sizeof(char) * (strlen("libguile-dbd-") +
- g_db_handle->bcknd_strlen + 10));
+ /* The +20 allos for .so or .dylib on MacOS */
+ sodbd_len = sizeof(char) * (strlen("libguile-dbd-") +
+ g_db_handle->bcknd_strlen + 20);
+ sodbd = (char*) malloc (sodbd_len);
if (sodbd == NULL)
{
g_db_handle->status = scm_cons(scm_from_int(errno),
scm_makfrom0str(strerror(errno)));
SCM_RETURN_NEWSMOB (g_db_handle_tag, g_db_handle);
}
- sprintf(sodbd, "libguile-dbd-%s.so", g_db_handle->bcknd_str);

+#ifdef _APPLE_
+ snprintf(sodbd, sodbd_len, "libguile-dbd-%s.dylib", g_db_handle->bcknd_str);
+#else
+ snprintf(sodbd, sodbd_len, "libguile-dbd-%s.so", g_db_handle->bcknd_str);
+#endif
+
g_db_handle->handle = dlopen(sodbd, RTLD_NOW);
if (g_db_handle->handle == NULL)
{

Linas Vepstas <linasvepstas>
Project AdministratorIn charge of this item.
Tue 21 Feb 2012 04:38:06 PM UTC, original submission:

Using guile-dbi 2.1.4 and guile-dbd-sqlite3 2.1.4 I get the following error whenever I try to run the script "test-guile-dbd-sqlite3.scm" provided with guile-dbd-sqlite3:

The apparent reason is that in guile-dbi 2.1.4 the file src/guile-dbi.c contains the line

which hardcodes the extension ".so" while under Mac OS X the standard extension for dynamic libraries is ".dylib". Modifying the call to "sprintf" makes the code work (but probably one would modify the call to "malloc" which allocates room for "sodbd" in order to take into account the different length of the two extensions).

Maurizio Tomasi <zio_tom78>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by linasvepstas (Updated the item)
  • -unavailable- added by zio_tom78 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 11 Apr 2013 01:40:52 PM UTClinasvepstasStatusNone=>Fixed
    Thu 11 Apr 2013 01:40:13 PM UTClinasvepstasOpen/ClosedOpen=>Closed
    Thu 11 Apr 2013 02:54:35 AM UTClinasvepstasAssigned toNone=>linasvepstas
    Tue 21 Feb 2012 04:38:49 PM UTCzio_tom78Carbon-CopyRemoved zio_tom78=>-
    Tue 21 Feb 2012 04:38:07 PM UTCzio_tom78Carbon-Copy-=>Added zio_tom78
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup