Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Clean Install

5 views
Skip to first unread message

Marek Stepanek

unread,
Jun 17, 2011, 8:14:39 AM6/17/11
to MacPerl

Hello all!


Sorry for bothering you again with this long posting! Meanwhile I
decided to make a clean install on my new MBP. Thinking, that this will
help to solve all problems. But a clean install is making really heavy work:

<offtopic>
Just if somebody is going through this hard experience too:
truecrypt and MacFuse (64 bit - hack) - I know the solution
stop spotlight to index your HD - I know the solution
stop to open .zip files after download - still searching for a solution
install Fink with the old gcc - I have only the new XCode 4.0.2
installed - still searching for a solution
Apple is putting us more and more under tutelage ...
</offtopic>

After the advice of Charly Garrison and Chas. Owens in the thread "New
Perl-Installation on new OS X" I installed the perlbrew That's really a
neat piece of software. I only did not understand how to make it
permanent to use perlbrew and Perl 5.14 ...

And I am not sure, whether Perl 5.14 is really "everywhere" (?).
Printing the %ENV I get also these lines:

VERSIONER_PERL_PREFER_32_BIT => no,
VERSIONER_PERL_VERSION => 5.10.0,

Is here the problem?

After a long while, finally I could install DBI and DBD-mysql. The last
module was tricky, because while the "make test" there is an error
message, that the Version Number of MakeMaker.pm "6.57_43" is not a
numeric number ... So I have had to edit this file, and I shortened the
version number to:

our $VERSION = '6.57'; (!)

The tests of DBD-mysql where only possible, by putting the testuser and
testpassword like follows:

perl Makefile.PL --testuser=mstep --testpassword=s3kr1t (!)

although these settings were shown in the default in this process. Ok,
finally everything is installed so far. But executing my humble
mysql-scripts is popping up a new problem:

the content of a test script:

#!/usr/bin/perl

use strict;
use warnings;
use DBI;

my ($dbh, $sth, $anz);
$dbh = DBI->connect("DBI:mysql:host=localhost;database=webdb",
"webdev","webdevpass",
{PrintError => 1, RaiseError => 1});
$sth = $dbh->prepare ("SELECT name, wins, losses FROM teams");
$sth->execute ();
$anz=0;

while (my @zeile = $sth->fetchrow_array ()){
printf "name = %s, wins = %d, losses = %d\n",
$zeile[0], $zeile[1], $zeile[2];
++$anz;
}
print "$anz Zeilen insgesamt \n";
$sth->finish ();
$dbh->disconnect;

exit (0);


And I get the following errors:

% ./intro6.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC
contains: /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level
/Library/Perl/Updates/5.10.0
/System/Library/Perl/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/5.10.0
/Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0
/Network/Library/Perl/5.10.0/darwin-thread-multi-2level
/Network/Library/Perl/5.10.0 /Network/Library/Perl
/System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.10.0 .) at (eval 3) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at ./intro6.pl line 8

And yes, yes, perlbrew activated the right perl:

perl -v

This is perl 5, version 14, subversion 0 (v5.14.0) built for darwin-2level


Thank you for your patience!


marek

Chas. Owens

unread,
Jun 17, 2011, 3:36:33 PM6/17/11
to Marek Stepanek, MacPerl
On Fri, Jun 17, 2011 at 08:14, Marek Stepanek <mareks...@yahoo.co.uk> wrote:
snip
> #!/usr/bin/perl
snip

> And yes, yes, perlbrew activated the right perl:
>
> perl -v
>
> This is perl 5, version 14, subversion 0 (v5.14.0) built for darwin-2level
snip

Take another look at the shebang line. You are asking for the version
of perl installed in /usr/bin. This is the system version of perl
(which is why you are getting 5.10). Your scripts need to start with
one of the following paths:

#!/home/USERNAME/perl5/perlbrew/perls/perl-5.14.0/bin/perl

or

#!/usr/bin/env perl

The benefit of the first is that it will always use that version of
perl, the downside is the same (e.g. when you upgrade to Perl 5.14.1
it will still use 5.14.0). The benefit of the second is that uses the
first perl it finds in your PATH, the downsides are that you have to
have your PATH setup correctly (for instance, cron jobs don't tend
have proper environments) and you always get the version in the PATH
(if you have multiple versions of perl that each are doing different
things, this might not be the best solution).

A third option is to always use the perl interpreter in the commandline:

perl foo.pl

The shebang line is not used to find the perl interpreter in that case
(but I believe some of the switches still have an effect). This is
the solution I tend to use these days.


--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

Sherm Pendley

unread,
Jun 17, 2011, 4:27:28 PM6/17/11
to Chas. Owens, Marek Stepanek, MacPerl
On Fri, Jun 17, 2011 at 3:36 PM, Chas. Owens <chas....@gmail.com> wrote:
> On Fri, Jun 17, 2011 at 08:14, Marek Stepanek <mareks...@yahoo.co.uk> wrote:
> snip
>> #!/usr/bin/perl
> snip
>> And yes, yes, perlbrew activated the right perl:
>>
>> perl -v
>>
>> This is perl 5, version 14, subversion 0 (v5.14.0) built for darwin-2level
> snip
>
> Take another look at the shebang line.  You are asking for the version
> of perl installed in /usr/bin.  This is the system version of perl
> (which is why you are getting 5.10).  Your scripts need to start with
> one of the following paths:
>
> #!/home/USERNAME/perl5/perlbrew/perls/perl-5.14.0/bin/perl

Or:

#!/home/USERNAME/perl5/perlbrew/perls/current/bin/perl

If you want your script to run with whatever Perl perlbrew has
currently selected.

sherm--

--
Cocoa programming in Perl:
http://camelbones.sourceforge.net

Marek Stepanek

unread,
Jun 17, 2011, 5:34:20 PM6/17/11
to mac...@perl.org
On 6/17/11 9:36 PM, Chas. Owens wrote:

>
> #!/home/USERNAME/perl5/perlbrew/perls/perl-5.14.0/bin/perl
>
> or
>
> #!/usr/bin/env perl
>
>
> perl foo.pl
>


Thank you Chas. for your insight! You suggested good ideas.
Unfortunately I get with all your suggestions the same errors like the
following:

$ perl intro6.pl

install_driver(mysql) failed: Can't load
'/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/darwin-2level/auto/DBD/mysql/mysql.bundle'
for module DBD::mysql:
dlopen(/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/darwin-2level/auto/DBD/mysql/mysql.bundle,
1): Library not loaded: libmysqlclient.18.dylib
Referenced from:
/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/darwin-2level/auto/DBD/mysql/mysql.bundle
Reason: image not found at
/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/darwin-2level/DynaLoader.pm
line 194.
at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
at intro6.pl line 12

There is something wrong with the DynaLoader:

/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/darwin-2level/DynaLoader.pm


A nice weekend to all!


marek

John Delacour

unread,
Jun 17, 2011, 5:58:19 PM6/17/11
to mac...@perl.org
At 23:34 +0200 17/06/2011, Marek Stepanek wrote:

>Compilation failed in require at (eval 3) line 3.
>Perhaps a required shared library or dll isn't installed where expected
> at intro6.pl line 12
>

Probably a silly question, but have you installed MySQL?
<http://www.mysql.com/downloads/mysql/>

I'm afraid I can't advise since I can't stand MySQL and find life
much easier with SQLite.

JD

Sherm Pendley

unread,
Jun 17, 2011, 5:58:58 PM6/17/11
to Marek Stepanek, mac...@perl.org
On Fri, Jun 17, 2011 at 5:34 PM, Marek Stepanek
<mareks...@yahoo.co.uk> wrote:
>
> install_driver(mysql) failed: Can't load
> '/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/darwin-2level/auto/DBD/mysql/mysql.bundle'
> for module DBD::mysql:
> dlopen(/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/darwin-2level/auto/DBD/mysql/mysql.bundle,
> 1): Library not loaded: libmysqlclient.18.dylib
>  Referenced from:
> /Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/darwin-2level/auto/DBD/mysql/mysql.bundle
>  Reason: image not found at
> /Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/darwin-2level/DynaLoader.pm
> line 194.
>  at (eval 3) line 3
> Compilation failed in require at (eval 3) line 3.
> Perhaps a required shared library or dll isn't installed where expected
>  at intro6.pl line 12
>
> There is something wrong with the DynaLoader:

Don't shoot the messenger! :-)

DynaLoader is just doing its job and reporting the problem. DBD::mysql
can't load, because it's linked against libmysqlclient.18.dylib, and
that .dylib is MIA - that's the problem.

Is MySQL installed in the same place it was when you built DBD::mysql?

Marek Stepanek

unread,
Jun 18, 2011, 1:20:14 AM6/18/11
to mac...@perl.org

:-) I am meanwhile professional in installing mysql Databases. I am
installing since one year now all possible variants of this software,
32-bit, 64-bit. I am trying same time to install DBI module and
DBD::mysql over it. DBI is installing always without any problem. But
DBD::mysql only with many tricks. And the reason to change my one and a
half year laptop, was also these troubles between 32-bit and 64-bit
software, and all this Perl mess.

Probably you are right: I should learn an other Database. Or should I
switch to PHP?

mysql daemon is running, when I start my script. The Database webdb is
created:

$dbh = DBI->connect("DBI:mysql:host=localhost;database=webdb",
"webdev","webdevpass",

and there are four entries in "teams" ...

$sth = $dbh->prepare ("SELECT name, wins, losses FROM teams");


Thank you! Nice weekend!


marek

Marek Stepanek

unread,
Jun 18, 2011, 4:46:13 AM6/18/11
to mac...@perl.org
On 6/17/11 11:58 PM, Sherm Pendley wrote:

>
> Don't shoot the messenger! :-)
>
> DynaLoader is just doing its job and reporting the problem. DBD::mysql
> can't load, because it's linked against libmysqlclient.18.dylib, and
> that .dylib is MIA - that's the problem.
>
> Is MySQL installed in the same place it was when you built DBD::mysql?
>
> sherm--
>


Thank you Sherm!


Yes, first I was installing mysql, 64-bit, immediately after DBI, and
than DBD::mysql, with some dirty tricks (see my first posting). And I
have only one mysql installed on my HD ...

MIA - I was googeling this abbreviation. Does it mean "Miami
Dolphins" or "Miami Airport"? Sorry for this question, but some
times there are not only native speakers in such kind of
mailing list.

Should I start over again, install everything for the 40th time? Perhaps
I should try with use lib ... ??? pointing to the right
libmysqlclient.18.dylib ???


marek

John Delacour

unread,
Jun 18, 2011, 6:42:45 AM6/18/11
to Marek Stepanek, mac...@perl.org
At 10:46 +0200 18/06/2011, Marek Stepanek wrote:

>MIA - I was googeling this abbreviation. Does it mean "Miami
>Dolphins" or "Miami Airport"?

Missing in Action == fatally absent


I thought I'd give myself a little useless suffering by installing
MySQL (the Mac 64-bit .dmg) and then trying to install DBD::mysql
with similar results to yours.

I then tried various supposed solutions to no effect.

Finally I discovered this suggestion and hey presto! success with
both installations:


$ cd /usr/local/bin
$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib
/usr/lib/libmysqlclient.18.dylib
$ sudo ./cpan
[...]
cpan[1]> install DBD::mysql
[...]
Appending installation info to
/usr/local/lib/perl5/5.14.0/darwin-2level/perllocal.pod
CAPTTOFU/DBD-mysql-4.019.tar.gz
/usr/bin/make install -- OK
_________________

$ cd
$ sudo cpan
[...]
cpan[1]> install DBD::mysql
[...]
Appending installation info to
/Library/Perl/Updates/5.10.0/darwin-thread-multi-2level/perllocal.pod
CAPTTOFU/DBD-mysql-4.019.tar.gz
/usr/bin/make install -- OK


JD

Marek Stepanek

unread,
Jun 18, 2011, 6:51:34 AM6/18/11
to mac...@perl.org
Ok, Sherm, I did reinstall everything now.

% which perl
/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/bin/perl

mysql-5.5.13-osx10.6-x86_64.dmg

and with cpanp

DBI

and manually DBD::mysql

% perl Makefile.PL --testuser=mstep --testpassword=s3kr1t

% make

% make test

with the result:


PERL_DL_NONLAZY=1 /Users/mstep/perl5/perlbrew/perls/perl-5.14.0/bin/perl
"-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/*.t
t/00base.t .................. 1/6
# Failed test 'use DBD::mysql;'
# at t/00base.t line 21.
# Tried to use 'DBD::mysql'.
# Error: Can't load
'/Users/mstep/.cpanplus/5.14.0/build/DBD-mysql-4.019/blib/arch/auto/DBD/mysql/mysql.bundle'
for module DBD::mysql:
dlopen(/Users/mstep/.cpanplus/5.14.0/build/DBD-mysql-4.019/blib/arch/auto/DBD/mysql/mysql.bundle,
2): Library not loaded: libmysqlclient.18.dylib
# Referenced from:
/Users/mstep/.cpanplus/5.14.0/build/DBD-mysql-4.019/blib/arch/auto/DBD/mysql/mysql.bundle
# Reason: image not found at
/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/darwin-2level/DynaLoader.pm
line 194.
# at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
Bailout called. Further testing stopped: Unable to load DBD::mysql
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 255
[Marek-Stepaneks-MacBook-Pro:5.14.0/build/DBD-mysql-4.019] mstep% which perl
/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/bin/perl


the mysql daemon is running ... Here too this mystic error of DynaLoader
...


marek

Marek Stepanek

unread,
Jun 18, 2011, 7:23:41 AM6/18/11
to mac...@perl.org
On 6/18/11 12:42 PM, John Delacour wrote:

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

Ahhh, I have had this link on my old laptop already. Thank you John!!!
This link made it possible that the manual install succeeded :-) I am
wondering, how I managed before.

And now I spend a lot of time again ... I forgot the hint of Chas. doing:

% ./intro6.pl

Which is not working with my

#!/usr/bin/perl

so I have to do it like that:

% perl intro6.pl

!!

or I have to change like follows:

#!/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/bin/perl


Thank you all for your great help!

marek

John Delacour

unread,
Jun 18, 2011, 7:19:47 AM6/18/11
to Marek Stepanek, mac...@perl.org
At 12:51 +0200 18/06/2011, Marek Stepanek wrote:

>...and with cpanp


>
>DBI
>
>and manually DBD::mysql
>
>% perl Makefile.PL --testuser=mstep --testpassword=s3kr1t
>

>......Library not loaded: libmysqlclient.18.dylib


Just create the symbolic link as I have just (not originally) suggested:

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

You will then get:

$ cd /usr/lib; ls -al | grep *mysql*
lrwxr-xr-x 1 root wheel 44 18 Jun 11:22
libmysqlclient.18.dylib ->
/usr/local/mysql/lib/libmysqlclient.18.dylib


DBD::mysql and install using CPAN.

JD

John Delacour

unread,
Jun 18, 2011, 7:47:51 AM6/18/11
to mac...@perl.org
At 13:23 +0200 18/06/2011, Marek Stepanek wrote:

>And now I spend a lot of time again ... I forgot the hint of Chas. doing:
>
>% ./intro6.pl
>
>Which is not working with my
>
>#!/usr/bin/perl
>
>so I have to do it like that:
>
>% perl intro6.pl
>
>!!
>
>or I have to change like follows:
>
>#!/Users/mstep/perl5/perlbrew/perls/perl-5.14.0/bin/perl

Yes, well portablility is a great thing and that's why I install Perl
in the default location /usr/local/bin, which is linked to from
/usr/bin on most servers. I am sure perlbrew has its uses but I have
a poor memory and if I install things in the usual places I can more
easily find the answers to my problems. In the home environment I
simply use either #!/usr/bin/perl or #!/usr/local/bin/perl depending
which perl I want to use. On most remote servers the two are
equivalent and I have no control over which Perl they have installed.

>Thank you all for your great help!

Glad it worked. If you want some real fun, try installing PDL :-)

JD

0 new messages