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

I have succesfully installed many modules on my Linux box using the CPAN module, but i get errors whenever I try to install DBD-mysql. It seems to be fetching the module from via ftp but then fails with this message.

Running make for J/JW/JWIED/DBD-mysql-2.0902.tar.gz Unwrapped into directory /root/.cpan/build/mysql-2.0902 Had some problem writing Makefile Running make test Make had some problems, maybe interupte? Won't test Running make install Make had some problems, maybe interupte? Won't install

This problem only occurs for DBD-mysql. I do already have DBI installed as well as mysql. I tried installing DBD-mysql manually but was told 'cant find location of mysql.h.

Can anyone help me.
costas

Replies are listed 'Best First'.
Re: Installing DBD via CPAN
by agoth (Chaplain) on Jul 17, 2001 at 13:47 UTC
    I found this in the install.html ::>

    cflags

    This is a list of flags that you want to give to the C compiler. The most important flag is the location of the MySQL header files. For example, on Red Hat Linux the header files are in /usr/include/mysql and you might try

    -I/usr/include/mysql

    NB This may help with a manual install, there is also mention of different required packages for different linux distro's which may assist?

      Ive tried
      perl Makefile>PL --cflags=-I/usr/local/mysql
      I get this error:
      Failed to determine directory of libmysqlclient.a|libmysqlclient.so.

      My command of unix is still quite medium. Can you see what is wrong in my command.
      Costas
        You're making progress... now you just need to tell it where to find your mysql libraries by adding to your perl Makefile.pm commandL
        --cflags=-I/usr/local/mysql -libs=-L/path/to/mysql/libs

        You can find most of this information in the INSTALL.html file that's in the tio level of your DBD-mysql build directory -- if you continue to have difficulty, look for the answer there before posting here -- might save you a lot of time.

        Gack. I totally missed this. (Sorry... it's late... or early rather...)
        --cflags=-I/usr/local/mysql -libs=-L/path/to/mysql/libs
        Should be
        --cflags=-I/usr/local/mysql/include -libs=-L/usr/local/mysql/lib/mysql
        That's why your compiler is unable to find mysql.h and errmsg.h. It doesn't have the right include directory set. (Assuming your mysql install directory is /usr/local/mysql/)
        That seems fine as long as mysql.h is in that directory? At a guess it's found your header files but cant get to the client libraries.

        I'm only getting this from the Doc's you know :) !, though I've had problems with DBD::Oracle in the past....

        In addition to --cflags use the --libs directive as well to specify where the .so or .a files are and see if that gets you over both hurdles.

Re: Installing DBD via CPAN
by costas (Scribe) on Jul 17, 2001 at 14:57 UTC
    Excellent the makefile was succesfully created. I then used ther make command and was given this error after
    In file included from dbdimp.c:29: dbdimp.h:31: mysql.h: No such file or directory dbdimp.h:32: errmsg.h: No such file or director make: *** [dbdimp.o] Error 1

    I always check other resources first (but this time to no avail) and i appreciate you help!
    Costas
      Sure looks to me like you're still missing the mysql include files. /usr/local/mysql/include should contain the following files
      config-win.h  heap.h       my_dir.h         my_tree.h        mysys_err.h        t_ctype.h
      config.h      m_ctype.h    my_global.h      myisam.h         nisam.h            thr_alarm.h
      dbug.h        m_string.h   my_list.h        myisammrg.h      queues.h           thr_lock.h
      errmsg.h      merge.h      my_net.h         myisampack.h     raid.h             violite.h
      ft_global.h   my_alarm.h   my_no_pthread.h  mysql.h          sslopt-case.h
      getopt.h      my_base.h    my_nosys.h       mysql_com.h      sslopt-longopts.h
      global.h      my_bitmap.h  my_pthread.h     mysql_version.h  sslopt-usage.h
      hash.h        my_config.h  my_sys.h         mysqld_error.h   sslopt-vars.h
      If it does, then please post the lines before the error (should be something like gcc dbdimp.c -I./ BLAH BLAH) so we can see the parameters passed to the compiler. If it doesn't, than you need to install the include files with MySQL. (Although I'm pretty sure they're installed by default if you compiled it from source.)