FAQ
Hi Catalyst List and Experts,

I am having trouble getting catalyst to hook up to my mysql server via
$MyApp script/myapp_create.pl model DB DBIC::Schema MyApp::Schema
create=static dbi:mysql:myapp 'tutorial' 'password' '{ AutoCommit => 1 }'
as outlined in chapter 10 of the tutorial
https://metacpan.org/module/Catalyst::Manual::Tutorial::10_Appendices#MySQL

I have of course set up a user tutorial, database myapp and use the correct
password. I can log into mysql from the command line with this user.


I made a local install of perl 5.14.2 and installed catalyst there. As far
as I can tell from the tutorial I have all of catalyst and the bits for the
DBIx connection to mysql upgraded to date. I installed DBI, DBD::mysql and
all other modules that are referenced in the error message. The tutorial
and some deviations I made from it work fine until I try to use mysql.

I have
MyApp$ mysql -V
mysql Ver 14.14 Distrib 5.5.15, for osx10.6 (i386)

The error message comes when I try to call the create model script.

DBIx::Class::Schema::Loader::make_schema_at(): DBI Connection failed:
install_driver(mysql) failed: Can't load
'/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle'
for module DBD::mysql:
dlopen(/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle,
1): Library not loaded: libmysqlclient.18.dylib
Referenced from:
/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle
Reason: image not found at
/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-2level/DynaLoader.pm
line 194.
at (eval 429) line 3
Compilation failed in require at (eval 429) line 3.
Perhaps a required shared library or dll isn't installed where expected
at
/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 1249 at
/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Catalyst/Helper/Model/DBIC/Schema.pm
line 635

I have install dependencies set in cpan and have also tried to install
things with cpanm.

I am trying to take what I did in the tutorial and just do the bits in
chapter 10 that update for mysql which just changes the model over and the
schemas after creating the database with the sql file (I checked that, the
tables exist.)

Can anyone help me make sense of the error and move get catlayst to make
the model and talk to mysql? Thank you so much in advance, I have been
picking my limited perl knowledge for a few days now before punting to the
experts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120401/9e231d49/attachment.htm

Search Discussions

  • Daniel J. Luke at Apr 1, 2012 at 6:48 pm

    On Apr 1, 2012, at 2:30 PM, Robyn Jonahs wrote:
    DBIx::Class::Schema::Loader::make_schema_at(): DBI Connection failed: install_driver(mysql) failed: Can't load '/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
    Referenced from: /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle
    Reason: image not found at /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-2level/DynaLoader.pm line 194.
    at (eval 429) line 3
    This error is saying that darwin's dyld can't find the mysql library (libmysqlclient.18.dylib) when trying to load DBD::mysql.

    You can see what libraries the mysql.bundle is linked against by running:

    otool -L /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle

    I don't know how you have the mysql libraries installed, but knowing where libmysqlclient.18.dylib is located could help you figure out what is going wrong.

    You might be able to fix things just by rebuilding DBD::mysql ...
    --
    Daniel J. Luke
    +========================================================+
    *---------------- dluke@geeklair.net ----------------* |
    *-------------- http://www.geeklair.net -------------* |
    +========================================================+
    Opinions expressed are mine and do not necessarily |
    reflect the opinions of my employer. |
    +========================================================+
  • Robyn Jonahs at Apr 1, 2012 at 8:24 pm
    Thank you thank you thank you so much. That guided me in the correct
    direction.

    You got me to search for libmysqlclient.18.dylib which led me to

    http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on-mac-os-x/

    which helped me to understand that I need to get the system to see the
    file. It was there on my system in
    /usr/local/mysql-5.5.15-osx10.6-x86_64/lib/libmysqlclient.18.dylib
    and also in
    /usr/local/mysql/lib/libmysqlclient.18.dylib
    which diff said were identical.

    Based on the web article, or better the first comment, I figured that I
    needed either directory in the path or as the guy recommends, set a
    symbolic link. I went with the symbolic link option to make it visible in
    /usr/lib
    which the comment at the link above says is "the standard MAC OS X
    dyld-library-path (/usr/lib/)"

    ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib
    /usr/lib/libmysqlclient.18.dylib

    The problem may have been caused by the mysql installation from root and
    the perl installation being local? I am not sure or not that interested. I
    am just giving thanks and my solution to the list and Daniel for getting me
    on the correct path. Seems pretty specific but here it is in case anyone
    else needs the info.


    On Sun, Apr 1, 2012 at 2:48 PM, Daniel J. Luke wrote:
    On Apr 1, 2012, at 2:30 PM, Robyn Jonahs wrote:

    DBIx::Class::Schema::Loader::make_schema_at(): DBI Connection failed:
    install_driver(mysql) failed: Can't load
    '/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle'
    for module DBD::mysql:
    dlopen(/FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle,
    1): Library not loaded: libmysqlclient.18.dylib
    Referenced from:
    /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle
    Reason: image not found at
    /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-2level/DynaLoader.pm
    line 194.
    at (eval 429) line 3
    This error is saying that darwin's dyld can't find the mysql library
    (libmysqlclient.18.dylib) when trying to load DBD::mysql.

    You can see what libraries the mysql.bundle is linked against by running:

    otool -L
    /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle

    I don't know how you have the mysql libraries installed, but knowing where
    libmysqlclient.18.dylib is located could help you figure out what is going
    wrong.

    You might be able to fix things just by rebuilding DBD::mysql ...
    --
    Daniel J. Luke
    +========================================================+
    *---------------- dluke@geeklair.net ----------------* |
    *-------------- http://www.geeklair.net -------------* |
    +========================================================+
    Opinions expressed are mine and do not necessarily |
    reflect the opinions of my employer. |
    +========================================================+




    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120401/284f0315/attachment.htm
  • Daniel J. Luke at Apr 1, 2012 at 9:51 pm

    On Apr 1, 2012, at 4:24 PM, Robyn Jonahs wrote:
    ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
    I guess that works, but you usually don't want to mess around with system locations as updates from Apple might interfere with your changes there...)
    The problem may have been caused by the mysql installation from root and the perl installation being local?
    If you run the otool command I recommended, you would know more.

    I don't use mysql, so I haven't had this issue and don't know offhand what is specifically going on for you.

    What likely happened is that DBD::mysql built with an incorrect install_name set for libmysqlclient.

    The page you linked to showed how you can use install_name_tool to change the location dyld would look for to find that library at runtime (this gets set at build time).

    It's also possible that the install_name in libmysqlclient got set wrong when it was built, so the wrong path got set on your DBD::mysql install (install_name_tool could be used to fix both, in that case).

    By adding the symlink there, you're relying on the default fallback behavior of dyld (see DYLD_FALLBACK_LIBRARY_PATH in man dyld) to find the lib.

    --
    Daniel J. Luke
    +========================================================+
    *---------------- dluke@geeklair.net ----------------* |
    *-------------- http://www.geeklair.net -------------* |
    +========================================================+
    Opinions expressed are mine and do not necessarily |
    reflect the opinions of my employer. |
    +========================================================+
  • Robyn Jonahs at Apr 2, 2012 at 4:22 am
    Ok so if I remove the link or leave it, the output from otool -L is

    /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle:
    libmysqlclient.18.dylib (compatibility version 18.0.0, current version
    18.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
    version 125.2.11)

    Which I did, but I did not understand what to do with the info. Any help
    there?


    I can also do the fix at the link by setting the path to the file in the
    environment variable
    export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"

    I don't have an indexer or /usr/local/bin/search files so I don't know what
    to do with the install_name_tool exactly to set the paths. Won't this go
    away if the system gets updated link the symbolic link?

    sudo install_name_tool -change libmysqlclient.18.dylib
    /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/indexer
    2
    3
    4sudo install_name_tool -change libmysqlclient.18.dylib
    /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/search

    It seems that adding it to the path for DYLD_LIBRARY_PATH is safe and
    stable and local so system updates are not a problem.


    On Sun, Apr 1, 2012 at 5:51 PM, Daniel J. Luke wrote:
    On Apr 1, 2012, at 4:24 PM, Robyn Jonahs wrote:

    ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib
    /usr/lib/libmysqlclient.18.dylib

    I guess that works, but you usually don't want to mess around with system
    locations as updates from Apple might interfere with your changes there...)
    The problem may have been caused by the mysql installation from root and
    the perl installation being local?

    If you run the otool command I recommended, you would know more.

    I don't use mysql, so I haven't had this issue and don't know offhand what
    is specifically going on for you.

    What likely happened is that DBD::mysql built with an incorrect
    install_name set for libmysqlclient.

    The page you linked to showed how you can use install_name_tool to change
    the location dyld would look for to find that library at runtime (this gets
    set at build time).

    It's also possible that the install_name in libmysqlclient got set wrong
    when it was built, so the wrong path got set on your DBD::mysql install
    (install_name_tool could be used to fix both, in that case).

    By adding the symlink there, you're relying on the default fallback
    behavior of dyld (see DYLD_FALLBACK_LIBRARY_PATH in man dyld) to find the
    lib.

    --
    Daniel J. Luke
    +========================================================+
    *---------------- dluke@geeklair.net ----------------* |
    *-------------- http://www.geeklair.net -------------* |
    +========================================================+
    Opinions expressed are mine and do not necessarily |
    reflect the opinions of my employer. |
    +========================================================+




    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120402/3a679588/attachment.htm
  • Daniel J. Luke at Apr 2, 2012 at 2:29 pm

    On Apr 2, 2012, at 12:22 AM, Robyn Jonahs wrote:
    Ok so if I remove the link or leave it, the output from otool -L is

    /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle:
    libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

    Which I did, but I did not understand what to do with the info. Any help there?
    To me, it looks like the install_name on libmysqlclient.18.dylib is incorrect (which would have happened when you built/installed mysql). I took a quick look at the Macports port for mysql and didn't see any patching to fix that there - so I don't know why your mysql build would have an incorrect install_name. Did you build mysql yourself or install a binary/package from somewhere?

    The 'correct' fix would be to adjust the install_name on libmysqlclient.18.dylib and then rebuild DBD::mysql (there are, of course, lots of other ways you could fix it).
    I can also do the fix at the link by setting the path to the file in the environment variable
    export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"
    There's almost never a time when setting the DYLD_* environment variables on Mac OS X is a good idea (and you would want DYLD_FALLBACK_LIBRARY_PATH anyway...)
    I don't have an indexer or /usr/local/bin/search files so I don't know what to do with the install_name_tool exactly to set the paths. Won't this go away if the system gets updated link the symbolic link?
    stuff in /usr/local is stuff you installed so Apple won't touch it with updates
    sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/indexer
    see the manpage for install_name_tool for details on how to use it.

    You could fix just your mysql.bundle, libmysqlclient.18.dylib and mysql.bundle, or maybe even just add an rpath to mysql.bundle to get it to search /usr/local/mysql/lib

    --
    Daniel J. Luke
    +========================================================+
    *---------------- dluke@geeklair.net ----------------* |
    *-------------- http://www.geeklair.net -------------* |
    +========================================================+
    Opinions expressed are mine and do not necessarily |
    reflect the opinions of my employer. |
    +========================================================+
  • Robyn Jonahs at Apr 4, 2012 at 10:55 am
    I installed a DMG of mysql from the mysql site. I am thinking to upgrade
    MySQL to the current version and try to deal with the location when I do
    that. I will try to locate the install_name. They have tar balls along with
    the dmg's so I could try to build it.

    Thanks for the help. It is all appreciated since I am not a programmer by
    trade.

    On Mon, Apr 2, 2012 at 10:29 AM, Daniel J. Luke wrote:
    On Apr 2, 2012, at 12:22 AM, Robyn Jonahs wrote:

    Ok so if I remove the link or leave it, the output from otool -L is

    /FOO/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level/auto/DBD/mysql/mysql.bundle:
    libmysqlclient.18.dylib (compatibility version 18.0.0, current
    version 18.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
    version 125.2.11)
    Which I did, but I did not understand what to do with the info. Any help
    there?

    To me, it looks like the install_name on libmysqlclient.18.dylib is
    incorrect (which would have happened when you built/installed mysql). I
    took a quick look at the Macports port for mysql and didn't see any
    patching to fix that there - so I don't know why your mysql build would
    have an incorrect install_name. Did you build mysql yourself or install a
    binary/package from somewhere?

    The 'correct' fix would be to adjust the install_name on
    libmysqlclient.18.dylib and then rebuild DBD::mysql (there are, of course,
    lots of other ways you could fix it).
    I can also do the fix at the link by setting the path to the file in the
    environment variable
    export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"
    There's almost never a time when setting the DYLD_* environment variables
    on Mac OS X is a good idea (and you would want DYLD_FALLBACK_LIBRARY_PATH
    anyway...)
    I don't have an indexer or /usr/local/bin/search files so I don't know
    what to do with the install_name_tool exactly to set the paths. Won't this
    go away if the system gets updated link the symbolic link?

    stuff in /usr/local is stuff you installed so Apple won't touch it with
    updates
    sudo install_name_tool -change libmysqlclient.18.dylib
    /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/indexer

    see the manpage for install_name_tool for details on how to use it.

    You could fix just your mysql.bundle, libmysqlclient.18.dylib and
    mysql.bundle, or maybe even just add an rpath to mysql.bundle to get it to
    search /usr/local/mysql/lib

    --
    Daniel J. Luke
    +========================================================+
    *---------------- dluke@geeklair.net ----------------* |
    *-------------- http://www.geeklair.net -------------* |
    +========================================================+
    Opinions expressed are mine and do not necessarily |
    reflect the opinions of my employer. |
    +========================================================+




    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120404/73478c38/attachment.htm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 1, '12 at 6:30p
activeApr 4, '12 at 10:55a
posts7
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Robyn Jonahs: 4 posts Daniel J. Luke: 3 posts

People

Translate

site design / logo © 2021 Grokbase