|
|
Sponsor |
bk commit - MyODBC 3.51 (1.346): msg#00013db.mysql.odbc
Below is the list of changes that have just been commited into a local MyODBC 3.51 repository of 'pharvey'. When 'pharvey' does a push, they will be propogaged to the main repository and within 2 hours after the push into the public repository. For more information on how to access the public repository see: http://www.mysql.com/products/myodbc/faq_2.html#Development_source You can also browse the changes from public repository: Complete repository: http://mysql.bkbits.net:8080/myodbc3/ This changeset : http://mysql.bkbits.net:8080/myodbc3/cset@xxxxx ChangeSet 1.346 04/08/04 08:28:02 peterh@xxxxxxxxx +9 -0 work to make OSX install smooth myodbcinst/myodbcinst.c 1.9 04/08/04 08:28:00 peterh@xxxxxxxxx +6 -2 work to make OSX install smooth myodbcinst/Makefile.osx 1.2 04/08/04 08:28:00 peterh@xxxxxxxxx +6 -1 work to make OSX install smooth imyodbc/Makefile.osx 1.3 04/08/04 08:28:00 peterh@xxxxxxxxx +32 -2 work to make OSX install smooth dltest/dltest.c 1.1 04/08/04 08:26:06 peterh@xxxxxxxxx +89 -0 dltest/dltest.c 1.0 04/08/04 08:26:06 peterh@xxxxxxxxx +0 -0 BitKeeper file /Users/pharvey/SandBox/MySQL/myodbc-3.51/dltest/dltest.c dltest/Makefile.osx 1.1 04/08/04 08:25:59 peterh@xxxxxxxxx +8 -0 dltest/Makefile.osx 1.0 04/08/04 08:25:59 peterh@xxxxxxxxx +0 -0 BitKeeper file /Users/pharvey/SandBox/MySQL/myodbc-3.51/dltest/Makefile.osx README.OSX 1.1 04/08/04 08:25:27 peterh@xxxxxxxxx +339 -0 README.OSX 1.0 04/08/04 08:25:27 peterh@xxxxxxxxx +0 -0 BitKeeper file /Users/pharvey/SandBox/MySQL/myodbc-3.51/README.OSX osx/postinstall 1.1 04/08/04 08:25:13 peterh@xxxxxxxxx +9 -0 osx/postinstall 1.0 04/08/04 08:25:13 peterh@xxxxxxxxx +0 -0 BitKeeper file /Users/pharvey/SandBox/MySQL/myodbc-3.51/osx/postinstall osx/odbcinst.ini 1.1 04/08/04 08:24:59 peterh@xxxxxxxxx +6 -0 osx/odbcinst.ini 1.0 04/08/04 08:24:59 peterh@xxxxxxxxx +0 -0 BitKeeper file /Users/pharvey/SandBox/MySQL/myodbc-3.51/osx/odbcinst.ini osx/odbc.ini 1.1 04/08/04 08:24:55 peterh@xxxxxxxxx +9 -0 osx/odbc.ini 1.0 04/08/04 08:24:55 peterh@xxxxxxxxx +0 -0 BitKeeper file /Users/pharvey/SandBox/MySQL/myodbc-3.51/osx/odbc.ini # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: peterh # Host: peter-harveys-computer.local # Root: /Users/pharvey/SandBox/MySQL/myodbc-3.51 --- New file --- +++ README.OSX 04/08/04 08:25:27 +-------------------------------------------------------------+ | MyODBC | | Mac OSX | +-------------------------------------------------------------+ INTRODUCTION --------------------------------------------------------------- These are my notes from my experiences building a binary MyODBC distribution on/for OSX. This was done during the last week in July 2004 with MyODBC v3.51.9. WHAT YOU NEED --------------------------------------------------------------- OSX I did my work on a modest iBook running a fresh install of OSX 10.3 (Panther) with a complete online update. Well; actually I had to reinstall everything after ending up with multiple ODBC systems on my OSX. Apple has not done a good job of taking charge of the core ODBC stuff so the driver vendors and others are all trying to lead it in various self serving directions and this sometimes results in redundent driver managers and drivers with all kinds of degradation of the user experience. In the UNIX world libraries can be complicated by the fact that there are different ways to handle share libraries. OSX adds more complexity to this by also having 'Bundles' and 'Frameworks'. Oh joy. I did not get too deep into Frameworks but Bundles are important here. Xcode I installed Xcode v1.1. This is the version which cames with my OSX distribution. Its gcc with some GUI stuff. ODBC My goal was to get things to work with the default ODBC environment. This is a version of iODBC built by Apple - unfortunately this has some problems. I think it is preferrable to live with the problems and bug Apple to update ODBC in future releases than to install a new Driver Manager (as some are doing). MySQL I used the latest general release - MySQL v4.0.20. I tried to use the binary distribution but failed to get MyODBC to build against it properly. Seems it was fine for building a regular share library but I was left with 4 or 5 unresolved references when I tried to build a bundle. So I switched to using the source tar-ball off of the web. MyODBC In the past I have built myodbc on OSX using the latest source distribution but in this case I wanted to build directly from source in the source repository. In this case it is v3.51.9. BUILDING --------------------------------------------------------------- MySQL I did not want to build or install the server parts - I just wanted the client stuff. I also wanted to link myodbc against a static mysql client lib so I did the following; $ ./configure --without-server --disable-shared $ make $ sudo make install To provide the multi-threaded version of the mysql client I did the following; $ make clean $ ./configure --without-server --disable-shared --enable-thread-safe-client $ make $ sudo make install This resulted in MySQL client stuff being installed in /usr/local. In particular; the libs went into /usr/local/lib/mysql and the header files went into /usr/local/include/mysql and some other stuff into other places in /usr/local. MyODBC I cloned the latest sources for myodbc from the source code repository in the usual way. I had already removed some libtool files from the source tree in previous work so as to ensure that the libtool on the build system gets used when building from source repository. The theory here is that if you have GNU auto-tools then you should have libtool. Unfortunately; OSX does not include libtoolize part of libtool so I had to manually link in the systems libtool files. So I started with the following; $ ln -s /usr/share/libtool/config.guess config.guess $ ln -s /usr/share/libtool/config.sub config.sub $ ln -s /usr/share/libtool/ltmain.sh ltmain.sh I then did the following to allow the gnu auto-tools a chance to create configure script and whatever other magic it performs. $ make -f Makefile.cvs Unfortunately myodbc could not find all of the mysql client stuff so I had to help it along with a configure option. So I did the following to start the build; $ ./configure --with-mysql-path=/usr/local $ make This build process will fail because it lacks a config.h needed by an odbc include file. I had the source for iodbc (www.iodbc.org) laying around so I did a quick configure in there (no build or install) and then copied the config.h to /usr/include. This is a hack but is probably safe for my work here. Starting myodbc make again will result in a link error. Seems like adding a link option to the Makefile in the driver and the driver_r dirs solves this problem. Unfortunately I could not figure out the best way to add this properly to the gnu auto build stuff nor am I certian this link option is the best solution. But switching the link lines in those two make files as follows seems to solve the link error; LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -Wl,-single_module -o $@ NOTE: Putting the "-Wl,-single_module" link option in other places on the link line may not work. Now doing a make again will result in a complete build so do the usual to install it. $ sudo make install This drops some libmyodbc*dylib share libs into /usr/local/lib. You can do the following to see that the lib type is the normal share library; $ file /usr/local/lib/libmyodbc3-3.51.09.dylib This will show "Mach-O dynamically linked shared library ppc". This library will work under the following circumstances; 1. if you link your app (ie imyodbc) directly to the driver 2. using odbctest (not sure why this works and other stuff fails) But it will fail to load under the following circumstances; 1. if you link your app (ie imyodbc) against the driver manager (which is the most common thing to do). 2. if you test with a standard GUI application such as FileMaker v7. In order for the latter scenarios to work you need to link the driver as a bundle. This can be done by the following; $ cd driver/.libs $ gcc -bundle -flat_namespace -o libmyodbc3-3.51.09.dylib *.o -L/usr/local/lib/mysql -lmysqlclient -lz -liodbcinst Now check the file type on this library; $ file libmyodbc3-3.51.09.dylib You should see "Mach-O bundle ppc". This should make the driver manager happy but you probably want to copy it to /usr/local/lib to replace the driver there. NOTE: I assume anyone wanting to link their app directly to myodbc will have the skills to build an appropriate myodbc share lib type from myodbc sources so I simply replace the normal share library with the bundle - with no intention of including the normal share lib in a final myodbc binary distibution for OSX. Now make myodbcinst and use it to register the driver. The location of the driver is hard-coded to /usr/lib so either get the driver in /usr/lib or edit myodbcinst. $ cd myodbcinst $ make -f Makefile.osx $ sudo myodbcinst -i This will register the driver in; ~/Library/ODBC/odbcinst.ini and ensure that a sample DSN (myodbc) exists in; ~/Library/ODBC/odbc.ini The DSN details may need to be edited to match your environment. TESTING --------------------------------------------------------------- myodbcinst This is a new addition to the myodbc source. This has been created to aid the driver installer. It can register/deregister the driver and even add a sample data source name. Most importantly it does this using the standard installer ODBC API so it *should* work regardless of the plaform and the ODBC system vendor. This program is not part of the normal build process for myodbc but can be easily built manually by going to the directory and running make with the appropriate makefile. For example; $ make -f Makfile.osx dltest This new addition to myodbc source is a tool which can be used to ensure that the driver can be explicitly loaded using libtool. It can also check for symbols (ie functions). This program is not part of the normal build process for myodbc but can be easily built manually by going to the directory and running make with the appropriate makefile. For example; $ make -f Makefile.osx NOTE: This is a good test for normal share library and seems to to be useful for the bundle type share library but I am not sure that the default driver manager actually uses libtool. odbctest This is a standard feature of ODBC on OSX. It can be used to test connecting to the server and submitting SQL to the server. NOTE: odbctest can be used to test myodbc driver but the test may be somewhat misleading as odbctest seems to work fine with a normal lib type - but even a simple C test program will show that the driver manager fails to load such a library. So odbctest does some magic here. I even downloaded the sources for it and built it without being able to recreate this minor miracle. imyodbc This new addition to myodbc source is a tool like the mysql command-line tool but is based soley upon ODBC calls. Use this to test connecting to the server and submitting SQL to the server. This can be linked directly to the driver or to the driver manager providing more testing options. This program is not part of the normal build process for myodbc but can be easily built manually by going to the directory and running make with the appropriate makefile. For example; $ make -f Makefile.osx By default; this will link against the driver manager. Edit the makefile to change this to link against the driver as needed. INSTALLER --------------------------------------------------------------- complications - its is very possible that non-standard and even multiple ODBC systems can be installed on OSX which complicates things in a variety of ways - perhaps most notably in that the ODBC config files may exist in different places and with diff editing rules. For example; FileMaker v7 comes with DataDirect ODBC drivers AND a Driver Manager of some sort. - standard installer API calls do not create config dirs/files, they are hewever created by ODBC Admin gui and can then be updated using ODBC installer API - myodbc does not have a GUI capable ConfigDSN() on OSX - the default ODBC installer on OSX does not try to call the drivers ConfigDSN() -- doc package maker solution here -- RECOMMENDATIONS --------------------------------------------------------------- 1. Need GNU auto-tools expert to work with OSX platform specialist (someone who really knows gcc well would also do) to ensure that the driver is linked correctly. ie no manual editing of make files after configure. 2. Need GNU auto-tools expert to overcome following problems; - need for iodbc config.h - using libtoolize where it exists and otherwise linking libtool files into source dir 3. Need OSX GUI person to add OSX specific GUI parts such as ConfigDSN(). Will need to work with me make proper ODBC calls. This will greatly enhance the User experience. 4. Need to lean on Apple to make FileMaker use default ODBC system and to make some other enhancements fixs in ODBC; - make calls to ConfigDSN() if driver has it - make installer API create ODBC config files (ini files) not just the ODBC Admin GUI. 5. Possibly create a custom installer which can install, uninstall and configure myodbc. This can be good for a number of reasons; - myodbcinst, used in PackageMaker install, does not have a window handle to give ConfigDSN() so no GUI can be provided to allow user to tweek their first DSN during install. They muust find and run the ODBC Admin tool after the install. - PackageMaker does not seem to allow for an uninstall? - the installer can be more intelligent and look nicer Finally; OSX Users demand the best User experience from their products but with ODBC - they get the worst User experience. A lot can be done to improve this and make it easier for OSX Users, many of which are web developers or otherwise use mysql. --- Peter Harvey August 2004 --- New file --- +++ dltest/Makefile.osx 04/08/04 08:25:59 all: gcc -c dltest.c -D_OSX_ gcc dltest.o -o dltest -lltdl clean: rm dltest.o rm dltest --- New file --- +++ dltest/dltest.c 04/08/04 08:26:06 #include <stdio.h> #include <stdlib.h> #include <ltdl.h> char *szSyntax = "\n" \ "**********************************************\n" \ "* dltest *\n" \ "**********************************************\n" \ "* Syntax *\n" \ "* *\n" \ "* dltest libName Symbol *\n" \ "* *\n" \ "* libName *\n" \ "* *\n" \ "* Full path + file name of share to test*\n" \ "* *\n" \ "* Symbol *\n" \ "* *\n" \ "* ie a function name in the share *\n" \ "* *\n" \ "* Notes *\n" \ "* *\n" \ "* This can be placed into a makefile *\n" \ "* to throw an error if test fails. *\n" \ "* *\n" \ "* If this segfaults you probably have an*\n" \ "* unresolved symbol in the lib. This is *\n" \ "* not caught since dltest started using *\n" \ "* libtool. Linux users can refer to the *\n" \ "* man page for dlopen to create a *\n" \ "* better test. *\n" \ "* *\n" \ "* *\n" \ "* Examples *\n" \ "* *\n" \ "* dltest /usr/lib/libMy.so MyFunc *\n" \ "* *\n" \ "**********************************************\n\n"; int main( int argc, char *argv[] ) { void *hDLL; void (*pFunc)(); const char *pError; if ( argc < 2 ) { printf( szSyntax ); exit( 1 ); } /* * initialize libtool */ if ( lt_dlinit() ) { printf( "ERROR: Failed to lt_dlinit()\n" ); exit( 1 ); } hDLL = lt_dlopen( argv[1] ); if ( !hDLL ) { printf( "[dltest] ERROR dlopen: %s\n", lt_dlerror() ); exit( 1 ); } printf( "SUCCESS: Loaded %s\n", argv[1] ); if ( argc > 2 ) { pFunc = (void (*)()) lt_dlsym( hDLL, argv[2] ); /* PAH - lt_dlerror() is not a good indicator of success */ /* if ( (pError = lt_dlerror()) != NULL ) */ if ( !pFunc ) { if ( (pError = lt_dlerror()) != NULL ) printf( "ERROR: %s\n Could not find %s\n", pError, argv[2] ); else printf( "ERROR: Could not find %s\n", argv[2] ); exit( 1 ); } printf( "SUCCESS: Found %s\n", argv[2] ); } lt_dlclose( hDLL ); return ( 0 ); } --- 1.2/imyodbc/Makefile.osx 2004-08-02 09:45:45 -07:00 +++ 1.3/imyodbc/Makefile.osx 2004-08-04 08:28:00 -07:00 @@ -1,7 +1,37 @@ +# +# Use this to make imyodbc on OSX. +# + +# TIP: +# +# Driver lib type on OSX can be determined by using the +# 'file' command as follows; +# +# $ file libmyodbc3.dylib +# +# A "Mach-O bundle ppc" can be created by linking as follows; +# +# $ cd driver/.libs +# $ gcc -bundle -flat_namespace -undefined suppress -o libmyodbc3-3.51.09.dylib *.o +# + +# +# Link to driver manager (default). +# +# Driver lib type should be "Mach-O bundle ppc". +# all: gcc -c imyodbc.c -D_OSX_ - gcc imyodbc.o -o imyodbc -Wl,-framework,iODBCinst + gcc imyodbc.o -o imyodbc -liodbc +# +# Link directly to the driver. +# +# Driver lib type should be "Mach-O dynamically linked shared library ppc". +# +todriver: + gcc -c imyodbc.c -D_OSX_ + gcc imyodbc.o -o imyodbc -L/usr/local/lib -lmyodbc3 clean: - rm *.o + rm imyodbc.o rm imyodbc --- 1.8/myodbcinst/myodbcinst.c 2004-08-02 09:45:45 -07:00 +++ 1.9/myodbcinst/myodbcinst.c 2004-08-04 08:28:00 -07:00 @@ -124,6 +124,10 @@ /*! \note On OSX there are many odbcinst.ini files - each account has one in ~/Library/ODBC and there is a system wide one in /Library/ODBC. This function will register the driver in ~/Library/ODBC. + There are at least two notable complicating factors; + - the files are read-ony for average user so one should use sudo when doing this + - the files do not exist until someone manually creates entries using the ODBC Administrator AND + they are not created by iodbc installer lib when we execute this code (we get error) */ /*! @@ -131,10 +135,10 @@ but path seems needed for iodbc. The implication is that the driver *must* be installed in /usr/lib for this to work. */ - if ( !SQLInstallDriverEx( "MySQL ODBC 3.51 Driver\0Driver=/usr/lib/libmyodbc3_r.dylib\0Setup=/usr/lib/libmyodbc3_r.dylib\0\0", 0, szLoc, 1023, &nLocLen, ODBC_INSTALL_COMPLETE, &nUsageCount ) ) + if ( !SQLInstallDriverEx( "MySQL ODBC 3.51 Driver\0Driver=/usr/local/lib/libmyodbc3_r.dylib\0Setup=/usr/local/lib/libmyodbc3_r.dylib\0\0", 0, szLoc, 1023, &nLocLen, ODBC_INSTALL_COMPLETE, &nUsageCount ) ) { doInstallerError(); - fprintf( stderr, "[%s][%d][ERROR] Failed to register driver. The most likely reason for this is that you do not have write privs. to ~/Library/ODBC/odbcinst.ini.\n", __FILE__, __LINE__ ); + fprintf( stderr, "[%s][%d][ERROR] Failed to register driver. The most likely reason for this is that you do not have write privs. to ~/Library/ODBC/odbcinst.ini or that the files do not exist.\n", __FILE__, __LINE__ ); return 0; } --- New file --- +++ osx/odbc.ini 04/08/04 08:24:55 [ODBC Data Sources] [ODBC] Trace = 0 TraceAutoStop = 0 TraceFile = TraceLibrary = --- New file --- +++ osx/odbcinst.ini 04/08/04 08:24:59 [ODBC Drivers] [ODBC Connection Pooling] PerfMon = 0 Retry Wait = --- New file --- +++ osx/postinstall 04/08/04 08:25:13 #!/bin/sh if [ ! -f ~/Library/ODBC ]; then mkdir ~/Library/ODBC cp *.ini ~/Library/ODBC fi ./myodbcinst -i --- 1.1/myodbcinst/Makefile.osx 2004-08-01 11:39:13 -07:00 +++ 1.2/myodbcinst/Makefile.osx 2004-08-04 08:28:00 -07:00 @@ -1,3 +1,8 @@ all: gcc -c myodbcinst.c -D_OSX_ - gcc myodbcinst.o -o myodbcinst -liodbcinst + gcc myodbcinst.o -o myodbcinst -L/usr/lib -liodbcinst + +clean: + rm myodbcinst.o + rm myodbcinst + -- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@xxxxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Crystal Reoports V9 & MySQL ODBC 3.51.18, Kerry Frater |
|---|---|
| Next by Date: | Which version runs on Win98?, Dave Morris |
| Previous by Thread: | Crystal Reoports V9 & MySQL ODBC 3.51.18, Kerry Frater |
| Next by Thread: | Which version runs on Win98?, Dave Morris |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|