[unixODBC-support] Does unixODBC on Mac OS X works?

Nick Gorham nick.gorham at easysoft.com
Mon Apr 11 16:56:11 BST 2005


Lorenzo Moretti wrote:

> Hi Nick
>
>>
>> The copy of dlopen you have must have found fink's dlcompat, you can 
>> see the text is in the output from dltest. Can you check and move the 
>> fink dlcompat lib so unixODBC finds the standard OSX one, then 
>> reconfigure and build unixODBC
>>
>> --
>
>> Nick
>
>
> After many test the problem is unixODBC.
> I have made changes in source code to build unixODBC on MAC OS X.

>
> I  have worked in Mac OS X 10.2.8

OK, I think that was the last version where dlconpat was needed.

>
> - dlcompat lib is need.
>
> I have made these changes following the notes but I don't know if this 
> is sufficient.
>
> changes in configure
> --------------------
> row 7021
> -    whole_archive_flag_spec='-all_load $convenience'
> +    whole_archive_flag_spec='-all_load'

OK, thats similar to whats in README.OSX

>
> changes in ltmain.sh
> --------------------------------------------------
> row 1743
>           if test "$installed" = no; then
>            notinst_deplibs="$notinst_deplibs $lib"
> -           need_relink=yes
> +           need_relink=no
>           fi


Yes, I may have had to do that.

> changes in libltdl/configure
> --------------------------------------------------
> row 5814
> -    archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || 
> echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs 
> $deplibs$linker_flags -install_name $rpath/$soname $verstring'
> +    archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle 
> $allow_undefined_flag || echo -dynamiclib) -o $lib $libobjs 
> $deplibs$linker_flags $(test "x$module" != xyes && echo -install_name 
> $rpath/$soname $verstring)'
> row 5819
> -    whole_archive_flag_spec='-all_load $convenience'
> +    whole_archive_flag_spec='-all_load'
>
Ok, remember that that file may be rebuilt when configure is run.

>
> changes in odbcinst/SQLManageDataSources.c
> ------------------------------------------
> row 91
>
>  #ifdef SHLIBEXT
> + #if defined(__APPLE__) && defined(__GNUC__) //Darwin
> +                 sprintf( szGUILibFile, "%s/libodbcinstQ.so", 
> DEFLIB_PATH);
> + #else //Darwin
>                  if ( strlen( SHLIBEXT ) > 0 )
>                      sprintf( szGUILibFile, "libodbcinstQ%s.1", 
> SHLIBEXT );
>                  else
>                      sprintf( szGUILibFile, "libodbcinstQ.so.1" );
> + #endif //Darwin
>  #else
>
Ok, I will add those to the code. Thanks.

>
> changes in sqp/lex.l
> --------------------------------------------------
> row 238
>
>         sprintf( g_szError, "%s processing '%s' on line %d", s, 
> yytext, g_nLineNo );
>    
> -       YY_FLUSH_BUFFER;
> +       yy_flush_buffer(YY_CURRENT_BUFFER);
> +    /* YY_FLUSH_BUFFER; */
>  }
>
Thats a problem I have seen on other OS's its a broken flex I think, but 
that fix will sort it out.

> changes in Drivers/txt/SQLTables.c
> --------------------------------------------------
> row 13
>
> #ifdef OSXHEADER
> - #include <i386/types.h>
> + #include <sys/types.h>
> #endif
>
>
I can add that to the code as well.

>
> ---------------------------------------------------------------------------------------
>
> After I have re-build unixODBC
>
> % ./configure --prefix=/usr/local/grasslib --disable-stats 
> --with-libiconv-prefix=/usr/local/grasslib --disable-gui --with-pic 
> --enable-shared --enable-static
> % make
> % sudo make install
>
> I have used an ODBC driver pre-compiled for OSX for MySQL 
> (http://dev.mysql.com/downloads/connector/odbc/3.51.html)
>
> and I have made a test:
>
>     % /usr/local/grasslib/bin/isql italia_myodbc
>
>     +---------------------------------------+
>
>     | Connected!                            |
>
>     |                                       |
>
>     | sql-statement                         |
>
>     | help [tablename]                      |
>
>     | quit                                  |
>
>     |                                       |
>
>     +---------------------------------------+
>
>     SQL> select * from REGIONI_my
>
>     +------------+-----------------------+-----------------------+------------+------------+------------+------------------------------------+
>
>     | cat        | AREA                  | PERIMETER             |
>     REGIONI_   | REGIONI_ID | COD_REG    |
>     REGIONE                            |
>
>     +------------+-----------------------+-----------------------+------------+------------+------------+------------------------------------+
>
>     | 1          | 13600770000           | 848351                |
>     2          | 2          | 4          | Trentino-alto
>     adige                |
>
>     | 2          | 18424000000           | 1132202               |
>     3          | 3          | 5          |
>     Veneto                             |
>
>     | 3          | 7859928000            | 746082.9              |
>     4          | 4          | 6          | Friuli-venezia
>     giulia              |
>
>     | 4          | 23861190000           | 1482079               |
>     5          | 5          | 3          |
>     Lombardia                          |
>
>     | 5          | 25388790000           | 1320129               |
>     6          | 6          | 1          |
>     Piemonte                           |
>
>     | 6          | 3260929000            | 323828.2              |
>     7          | 7          | 2          | Valle d
>     aosta                      |
>
>     | 7          | 22184370000           | 1204029               |
>     8          | 8          | 8          |
>     Emilia-romagna                     |
>
>     | 8          | 5405949000            | 890514.9              |
>     9          | 9          | 7          |
>     Liguria                            |
>
>     | 9          | 22680960000           | 1155449               |
>     10         | 10         | 9          |
>     Toscana                            |
>
>     | 10         | 9749545000            | 719169.4              |
>     11         | 12         | 11         |
>     Marche                             |
>
>     | 11         | 8461078000            | 655434.4              |
>     12         | 13         | 10         |
>     Umbria                             |
>
>     | 12         | 10830150000           | 647984.3              |
>     13         | 14         | 13         |
>     Abruzzo                            |
>
>     | 13         | 17218330000           | 1066286               |
>     14         | 15         | 12         |
>     Lazio                              |
>
>     | 14         | 4461033000            | 462136.7              |
>     15         | 16         | 14         |
>     Molise                             |
>
>     | 15         | 19533860000           | 1312533               |
>     16         | 17         | 16         |
>     Puglia                             |
>
>     | 16         | 13609170000           | 917180.6              |
>     17         | 20         | 15         |
>     Campania                           |
>
>     | 17         | 10072790000           | 664891.5              |
>     18         | 21         | 17         |
>     Basilicata                         |
>
>     | 18         | 23920080000           | 1440308               |
>     19         | 22         | 20         |
>     Sardegna                           |
>
>     | 19         | 15223380000           | 863931.6              |
>     20         | 23         | 18         |
>     Calabria                           |
>
>     | 20         | 25553980000           | 1154512               |
>     21         | 24         | 19         |
>     Sicilia                            |
>
>     +------------+-----------------------+-----------------------+------------+------------+------------+------------------------------------+
>
>     SQLRowCount returns 20
>
>     20 rows fetched
>
>     SQL>
>
>
>
> With PostgreSQL driver it doesn't work...
>
> Do you think that unixODBC now is it OK under Mac OS X ?

Have you checked the README.OSX for the details of converting from a 
dylib to a bundle ?

You will need to do that for the postgres driver (or any you build) to work.

>
> And now the problem in GRASS for OS X....
>
> I have rebuilt GRASS driver (ODBC) with this unixODBC and now with the 
> same test italia_myodbc I have:
> % dbmi: Protocol error
>
> No more SQL error but a protocol error.
> Is the ODBC driver inside GRASS wrong?
>
> I have many messages from compiler when I build odbc driver inside GRASS:
>
>     odbc
>
>     gcc
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/include
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/dist.powerpc-apple-darwin6.8/include/grass
>     -I/usr/X11R6/include -I/usr/local/grasslib/include -O3
>     -D_FILE_OFFSET_BITS=64  -Wall -Wconversion -Wno-implicit-int
>     -I/usr/X11R6/include -I/usr/local/grasslib/include     
>     -DPACKAGE=\""grassmods"\" -I/usr/local/grasslib/include
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/lib/db/dbmi_driver
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/include
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/dist.powerpc-apple-darwin6.8/include/grass
>     \
>
>             -o OBJ.powerpc-apple-darwin6.8/connect.o -c connect.c
>
>     connect.c: In function `open_connection':
>
>     connect.c:11: warning: passing arg 1 of `SQLAllocHandle' with
>     different width due to prototype
>
>     connect.c:22: warning: passing arg 1 of `SQLFreeHandle' with
>     different width due to prototype
>
>     connect.c:27: warning: passing arg 1 of `SQLAllocHandle' with
>     different width due to prototype
>
>     connect.c:31: warning: passing arg 1 of `SQLFreeHandle' with
>     different width due to prototype
>
>     connect.c: In function `close_connection':
>
>     connect.c:43: warning: passing arg 1 of `SQLFreeHandle' with
>     different width due to prototype
>
>     connect.c:44: warning: passing arg 1 of `SQLFreeHandle' with
>     different width due to prototype
>
>     gcc
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/include
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/dist.powerpc-apple-darwin6.8/include/grass
>     -I/usr/X11R6/include -I/usr/local/grasslib/include -O3
>     -D_FILE_OFFSET_BITS=64  -Wall -Wconversion -Wno-implicit-int
>     -I/usr/X11R6/include -I/usr/local/grasslib/include     
>     -DPACKAGE=\""grassmods"\" -I/usr/local/grasslib/include
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/lib/db/dbmi_driver
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/include
>     -I/Volumes/APPLI/src/grass-6.1.cvs_src_snapshot_2005_04_09/dist.powerpc-apple-darwin6.8/include/grass
>     \
>
>             -o OBJ.powerpc-apple-darwin6.8/cursor.o -c cursor.c
>
>     cursor.c: In function `alloc_cursor':
>
>     cursor.c:41: warning: passing arg 1 of `SQLAllocHandle' with
>     different width due to prototype
>
>     cursor.c:44: warning: passing arg 1 of `SQLGetDiagRec' with
>     different width due to prototype
>
>     cursor.c:44: warning: passing arg 3 of `SQLGetDiagRec' with
>     different width due to prototype
>
>     ......
>
>
>     /and so on/
>
>
>
> Are these messages normal?

They look like a problem waiting to happen. I suspect that Grass has a 
different view about what a SQLHANDLE is from the header files.

-- 
Nick



More information about the unixODBC-support mailing list