Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone gotten DBD::mysql working on Windows using the Cygwin installation of Perl? I don't know what's going on, but the compilation fails for some reason. Also, I'm getting a lot of errors. I think I have my paths set up right, so I don't know what's causing the problems. Help!

Replies are listed 'Best First'.
Re: DBD::mysql installation
by gellyfish (Monsignor) on Apr 06, 2005 at 15:20 UTC

    An indication of the actual errors you get from the compilation would go a long way to making it easier for someone to help you.

    /J\

      True...aggrevation caused a brain fart...I'll apologize now for the long post.
      rm -f blib/arch/auto/DBD/mysql/mysql.dll LD_RUN_PATH="" /usr/bin/perl.exe myld ld2 -s -L/usr/local/lib dbdimp. +o mysql.o -o blib/arch/auto/DBD/mysql/mysql.dll /usr/lib/perl5/5.8/cygwin/CORE +/libperl.d ll.a -L/usr/local/lib -lz -lcrypt -lm gcc -shared -o mysql.dll -Wl,--out-implib=libmysql.dll.a -Wl,--export +-all-symbo ls -Wl,--enable-auto-import -Wl,--stack,8388608 \ -s -L/usr/local/lib dbdimp.o mysql.o /usr/lib/perl5/5.8/cygwin/CORE/l +ibperl.dll .a -L/usr/local/lib -lz -lcrypt -lm Creating library file: libmysql.dll.a dbdimp.o(.text+0xb1): In function `mysql_dr_connect': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:880: undefined reference to + `_mysql_i nit' dbdimp.o(.text+0x16a):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:993: +undefined reference to `_mysql_real_connect' dbdimp.o(.text+0x334):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:897: +undefined reference to `_mysql_options' dbdimp.o(.text+0x41a):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:906: +undefined reference to `_mysql_options' dbdimp.o(.text+0x508):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:917: +undefined reference to `_mysql_options' dbdimp.o(.text+0x5f8):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:927: +undefined reference to `_mysql_options' dbdimp.o(.text+0x76a):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:985: +undefined reference to `_mysql_options' dbdimp.o(.text+0xe52): In function `mysql_db_STORE_attrib': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1353: undefined reference t +o `_mysql_ autocommit' dbdimp.o(.text+0x1472): In function `mysql_db_FETCH_attrib': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1500: undefined reference t +o `_mysql_ get_host_info' dbdimp.o(.text+0x1644):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1484 +: undefine d reference to `_mysql_error' dbdimp.o(.text+0x1681):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1478 +: undefine d reference to `_mysql_errno' dbdimp.o(.text+0x16ec):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1428 +: undefine d reference to `_mysql_insert_id' dbdimp.o(.text+0x17ba):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1507 +: undefine d reference to `_mysql_info' dbdimp.o(.text+0x17ed):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1517 +: undefine d reference to `_mysql_get_proto_info' dbdimp.o(.text+0x1856):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1535 +: undefine d reference to `_mysql_stat' dbdimp.o(.text+0x18c4):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1522 +: undefine d reference to `_mysql_get_server_info' dbdimp.o(.text+0x18fa):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1542 +: undefine d reference to `_mysql_thread_id' dbdimp.o(.text+0x1b96): In function `mysql_st_internal_execute': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1698: undefined reference t +o `_mysql_ real_query' dbdimp.o(.text+0x1bc3):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1698 +: undefine d reference to `_mysql_real_query' dbdimp.o(.text+0x1bde):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x1bec):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x1dcb):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1708 +: undefine d reference to `_mysql_use_result' dbdimp.o(.text+0x1ddb):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1710 +: undefine d reference to `_mysql_errno' dbdimp.o(.text+0x1dfb):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1715 +: undefine d reference to `_mysql_affected_rows' dbdimp.o(.text+0x1f34):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1717 +: undefine d reference to `_mysql_num_rows' dbdimp.o(.text+0x1f47):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x1f55):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x210b):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:803: + undefined reference to `_mysql_store_result' dbdimp.o(.text+0x22a8):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1686 +: undefine d reference to `_mysql_list_fields' dbdimp.o(.text+0x22d2):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x22df):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x27ba):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:803: + undefined reference to `_mysql_free_result' dbdimp.o(.text+0x2a47): In function `mysql_st_execute': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1789: undefined reference t +o `_mysql_ num_fields' dbdimp.o(.text+0x2b1d):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1785 +: undefine d reference to `_mysql_insert_id' dbdimp.o(.text+0x2c3e): In function `mysql_st_fetch': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1863: undefined reference t +o `_mysql_ fetch_row' dbdimp.o(.text+0x2c57):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1874 +: undefine d reference to `_mysql_fetch_lengths' dbdimp.o(.text+0x2e6e):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1865 +: undefine d reference to `_mysql_errno' dbdimp.o(.text+0x2e94):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x2e9f):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x32f8): In function `mysql_st_finish': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1926: undefined reference t +o `_mysql_ free_result' dbdimp.o(.text+0x33ca): In function `mysql_st_FETCH_internal': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:2079: undefined reference t +o `_mysql_ field_seek' dbdimp.o(.text+0x33d7):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:2080 +: undefine d reference to `_mysql_fetch_field' dbdimp.o(.text+0x414e): In function `mysql_db_reconnect': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:2371: undefined reference t +o `_mysql_ errno' dbdimp.o(.text+0x41e9):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x41f9):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x506c): In function `mysql_db_quote': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:2535: undefined reference t +o `_mysql_ real_escape_string' dbdimp.o(.text+0x5689): In function `mysql_db_login': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: undefined reference to + `_mysql_e rrno' dbdimp.o(.text+0x5694):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x590e): In function `mysql_db_commit': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1173: undefined reference t +o `_mysql_ commit' dbdimp.o(.text+0x5934):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x593f):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x5e7e): In function `mysql_db_rollback': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1202: undefined reference t +o `_mysql_ rollback' dbdimp.o(.text+0x5e97):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_errno' dbdimp.o(.text+0x5ea2):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:794: + undefined reference to `_mysql_error' dbdimp.o(.text+0x646e): In function `mysql_db_disconnect': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1244: undefined reference t +o `_mysql_ close' dbdimp.o(.text+0x68dd): In function `mysql_db_destroy': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1244: undefined reference t +o `_mysql_ close' dbdimp.o(.text+0x695d):/cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1307 +: undefine d reference to `_mysql_real_query' dbdimp.o(.text+0x7393): In function `mysql_db_last_insert_id': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:1428: undefined reference t +o `_mysql_ insert_id' dbdimp.o(.text+0x7747): In function `ParseParam': /cygdrive/c/temp/DBD-mysql-2.9006/dbdimp.c:281: undefined reference to + `_mysql_r eal_escape_string' mysql.o(.text+0x599a): In function `XS_DBD__mysql__dr__ListDBs': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:53: undefined reference to +`_mysql_li st_dbs' mysql.o(.text+0x59d7):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:57: u +ndefined r eference to `_mysql_num_rows' mysql.o(.text+0x59f4):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:57: u +ndefined r eference to `_mysql_fetch_row' mysql.o(.text+0x5a6b):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:61: u +ndefined r eference to `_mysql_free_result' mysql.o(.text+0x5a79):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:63: u +ndefined r eference to `_mysql_close' mysql.o(.text+0x5ab2): In function `XS_DBD__mysql__dr__ListDBs': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.c:1125: undefined reference to + `_mysql_n um_rows' mysql.o(.text+0x5afd): In function `XS_DBD__mysql__dr__ListDBs': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:55: undefined reference to +`_mysql_er ror' mysql.o(.text+0x5b0d):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:55: u +ndefined r eference to `_mysql_errno' mysql.o(.text+0x6087): In function `XS_DBD__mysql__dr__admin_internal' +: /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:133: undefined reference to + `_mysql_r eal_query' mysql.o(.text+0x618a):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:145: +undefined reference to `_mysql_close' mysql.o(.text+0x619d):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:141: +undefined reference to `_mysql_error' mysql.o(.text+0x61ad):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:141: +undefined reference to `_mysql_errno' mysql.o(.text+0x62f3):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:106: +undefined reference to `_mysql_refresh' mysql.o(.text+0x6310):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:103: +undefined reference to `_mysql_shutdown' mysql.o(.text+0x6364):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:94: u +ndefined r eference to `_mysql_error' mysql.o(.text+0x636e):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:94: u +ndefined r eference to `_mysql_errno' mysql.o(.text+0x6ae8): In function `XS_DBD__mysql__db__ListDBs': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:179: undefined reference to + `_mysql_l ist_dbs' mysql.o(.text+0x6b22):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:187: +undefined reference to `_mysql_num_rows' mysql.o(.text+0x6b34):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:187: +undefined reference to `_mysql_fetch_row' mysql.o(.text+0x6ba5):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:191: +undefined reference to `_mysql_free_result' mysql.o(.text+0x6bd8): In function `XS_DBD__mysql__db__ListDBs': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.c:1309: undefined reference to + `_mysql_n um_rows' mysql.o(.text+0x6c2c): In function `XS_DBD__mysql__db__ListDBs': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:188: undefined reference to + `_mysql_l ist_dbs' mysql.o(.text+0x6c3e):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:184: +undefined reference to `_mysql_error' mysql.o(.text+0x6c48):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:184: +undefined reference to `_mysql_errno' mysql.o(.text+0x6f7b): In function `XS_DBD__mysql__db_do': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:224: undefined reference to + `_mysql_f ree_result' mysql.o(.text+0x7196): In function `XS_DBD__mysql__db_ping': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:244: undefined reference to + `_mysql_p ing' mysql.o(.text+0x72c7):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:247: +undefined reference to `_mysql_ping' mysql.o(.text+0x771f): In function `XS_DBD__mysql__st_dataseek': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:282: undefined reference to + `_mysql_d ata_seek' mysql.o(.text+0x7dc6): In function `XS_DBD__mysql__GetInfo_dbd_mysql_g +et_info': /cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:367: undefined reference to + `_mysql_g et_parameters' mysql.o(.text+0x7ec0):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:363: +undefined reference to `_mysql_get_server_info' mysql.o(.text+0x7ed1):/cygdrive/c/temp/DBD-mysql-2.9006/mysql.xs:363: +undefined reference to `_is_prefix' collect2: ld returned 1 exit status perlld: *** system() failed to execute gcc -shared -o mysql.dll -Wl,--out-implib=libmysql.dll.a -Wl,--export +-all-symbo ls -Wl,--enable-auto-import -Wl,--stack,8388608 \ -s -L/usr/local/lib dbdimp.o mysql.o /usr/lib/perl5/5.8/cygwin/CORE/l +ibperl.dll .a -L/usr/local/lib -lz -lcrypt -lm make: *** [blib/arch/auto/DBD/mysql/mysql.dll] Error 1
Re: DBD::mysql installation
by dragonchild (Archbishop) on Apr 06, 2005 at 17:08 UTC
Re: DBD::mysql installation
by Joost (Canon) on Apr 06, 2005 at 16:18 UTC
    Looking at those errors, you might not have the mysql client header files installed. Actually, it looks like something else is going wrong. You do have the mysqlclient libraries installed, right?

    I'm not sure if there is a cygwin package for libmysqlclient, but you could try compiling it from source on cygwin. If you get that to work, chances are DBD::mysql will compile too.

      Yes, I have the mysqlclient.lib file installed and available. I think it's finding it, but I'm not 100% sure.

      Now that I'm looking at this again, I think it's not finding the client library. I'm getting an error when I run perl Makefile.PL related to that. However, when it said it was probably harmless, I guess I ignored it. I guess I best look into this some more.

      Here's the error if you want to see it:
      I will use the following settings for compiling and testing: cflags (mysql_config) = -I/usr/local/include libs (mysql_config) = -L/usr/local/lib -lmysqlclient -lz -l +crypt -lns l -lm mysql_config (guessed ) = mysql_config nocatchstderr (default ) = 0 nofoundrows (default ) = 0 ssl (guessed ) = 0 testdb (default ) = test testhost (default ) = testpassword (default ) = testsocket (default ) = testuser (default ) = To change these settings, see 'perl Makefile.PL --help' and 'perldoc INSTALL'. Note (probably harmless): No library found for -lmysqlclient Note (probably harmless): No library found for -lnsl Using DBI 1.48 (for perl 5.008006 on cygwin-thread-multi-64int) instal +led in /us r/lib/perl5/site_perl/5.8/cygwin/auto/DBI/ Writing Makefile for DBD::mysql
Re: DBD::mysql installation
by Limbic~Region (Chancellor) on Apr 06, 2005 at 20:30 UTC
    Anonymous Monk,
    I have. I followed the instructions that bart was kind enough to point out to me. I only encountered one problem with incompatible types in a couple of header files. If you follow these instructions and you run into the same problem, let me know and I will re-figure out how I got around them.

    Cheers - L~R

      Thanks, but these are the same instructions I have been following without success. Like I said in a prior post, for some reason it doesn't seem to be finding the mysqlclient.lib file. Any other ideas?
        Anonymous Monk,
        Maybe - came to me as I was waking up this morning. I remember a handful of minor annoyances when I tried following those instructions to include the header file. As it turned out, I had installed MySQL server (Windows version) and it comes with its own client libraries. The wrong client libraries (Windows) were in the path prior to the Cygwin.

        Your comment concerning the mysqlclient.lib troubles me. It shouldn't be looking for a .lib extension. Are you sure you are pointing to the Cygwin built client library? Believe it or not, the Windows MySQL Server installation comes with shell scripts. If the perl Makefile.PL finds that script instead of the Cygwin client script, it will assume the wrong configuration information. It took me a while to find this.

        Cheers - L~R