Looking for idiots guide to installing DBI Perl module

I have been trying to get perl DBI working for days and keep running into problems.

I have installed the DBI with the command fink install dbi-pm588.
I have tried fink install dbd-mysql-pm588 but get the error
checking for OpenSSL... Could not find an installation of OpenSSL
### execution of ./configure failed, exit code 1
Removing runtime build-lock...
Removing build-lock package...
/sw/bin/dpkg-lockwait -r fink-buildlock-mysql-5.0.27-1001
(Reading database ... 17251 files and directories currently installed.)
Removing fink-buildlock-mysql-5.0.27-1001 ...
Failed: phase compiling: mysql-5.0.27-1001 failed



fink install openssl097 runs ok.
Does anyone have any ideas what to try? Let me know if I can give any more info which will help a diagnosis.

Powerbook G4, Mac OS X (10.4.9)

Posted on Mar 29, 2007 6:43 AM

Reply
12 replies

Apr 2, 2007 3:19 AM in response to Conor McCarthy

I'm not a fink man, so I can't help you there, but I suspect installing these libraries via any method should install them in the same important Perl relevant location.

Now, the most recent time I've done this, it was on a Core 2 Duo iMac. There might be some slight differences in the commands due to whatever architecture you're running.

So, I used cpan to install DBI. I suspect you, like I, had no trouble getting DBI installed.

I started by launching cpan:

<pre class="command">/usr/bin/sudo /usr/bin/cpan</pre>

Once that's running, you can install DBI via:

<pre class="command">install DBI</pre>

It should run through its paces, maybe ask you for some prerequisites and then complete. I suspect that if fink has previously succeeded, cpan should just tell you that DBI is up to date.

At this point, exit cpan.

Then, get the source for DBD::mysql. I got 4.004:

curl -O http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.004.tar.gz

Decompress and enter the folder and run the makefile command:

<pre class="command">tar -zxvf DBD-mysql-4.004.tar.gz</pre>

<pre class="command">cd DBD-mysql-4.004</pre>

<pre class="command">perl Makefile.PL</pre>

Now, if your setup is like mine, you'll get something like this at the start:

<pre class="command">I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/include/mysql -fno-omit-frame-pointer -arch ppc64 -arch x86_64 -pipe
embedded (mysql_config) =
libs (mysql_config) = -arch ppc64 -arch x86_64 -pipe -L/usr/lib/mysql -lmysqlclient -lz -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 ) = </pre>

And something like this at the end:

<pre class="command">Unrecognized argument in LIBS ignored: '-arch'
Unrecognized argument in LIBS ignored: 'ppc64'
Unrecognized argument in LIBS ignored: '-arch'
Unrecognized argument in LIBS ignored: 'x86_64'
Unrecognized argument in LIBS ignored: '-pipe'</pre>

Basically, the DBD::mysql installer looked at your mysql_config and tried to add whatever flags Apple used to build MySQL, to build DBD::mysql, and some arguments just don't apply/work. Specifically, the DBD::mysql installer doesn't understand the -arch and -pipe arguments.

SO, you need to override `perl Makerfile.PL` to not exclude those by overriding the cflags and libs attributes with everything BUT -arch and -pipe. So, in my case, the updated command should now look like this (don't execute it yet!):

<pre class="command">perl Makefile.PL \
--cflags="-I/usr/include/mysql -fno-omit-frame-pointer" \
--libs="-L/usr/lib/mysql -lmysqlclient -lz -lm"</pre>

Now, I like testing the build before installing it, and to do that successfully, you have to inform the installer which database it can perform tests on. By default, the installer tries to perform tests on the "test" database as the current user using no password. That was no good for me. So, I created a user for mysql using phpMyAdmin named "test" with password of "t3st". So, my completed Makefile line looked like this:

<pre class="command">perl Makefile.PL \
--cflags="-I/usr/include/mysql -fno-omit-frame-pointer" \
--libs="-L/usr/lib/mysql -lmysqlclient -lz -lm" \
--testhost=localhost \
--testdb=test \
--testuser=test \
--testpassword=t3st \
--testsocket=/var/mysql/mysql.sock</pre>

That should all run now without complaint and you should see no "Unrecognized argument" comments. If so, after that, you can run in order:

<pre class="command">./configure</pre>
<pre class="command">make</pre>
<pre class="command">make test</pre>

At that point, everything should have gone smoothly, tests and all. If so, do the last and final command:

<pre class="command">/usr/bin/sudo /usr/bin/make install</pre>

Let me know if anything is not as expected and/or if it works for you. If you have issues copy and paste whatever you did enter and what the output was.

MacBook Mac OS X (10.4.8)

MacBook Mac OS X (10.4.8)

MacBook Mac OS X (10.4.8)

MacBook Mac OS X (10.4.8)

Apr 2, 2007 7:10 AM in response to jaydisc

Thank you for your response.

Unfortunatly I have stumbled at the first step.

On typing
<pre class="command">/usr/bin/sudo /usr/bin/cpan
install DBI</pre>

I get the message:

<pre class="code">.
.
.
Checking if your kit is complete...
Looks good

I see you're using perl 5.008006 on darwin-thread-multi-2level, okay.
Remember to actually read the README file!
Use 'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this working
directory before unpacking and building any DBD::* drivers.

Writing Makefile for DBI
-- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible</pre>

Do you know what is going on here, is this telling my that DBI is not installed?



Apr 2, 2007 6:51 PM in response to jaydisc

Checking my old notes on this, but updating the file versions:

1. Download DBI from CPAN
http://search.cpan.org/~timb/DBI-1.54
2. Unpack the file, eg: tar -xzvf DBI-1.54.tar.gz
3. cd into the directory
4. Type perl Makefile.PL
5. Type make && make test
6. sudo make install (NB: See below !)
7. IMPORTANT: to get DBD to install, you may need to specify the location of your mysql_config file (the following should all be on one line):

perl Makefile.PL --testdb=test --testuser=nameused --testpassword=actualpasswdused --testhost=localhost --mysql config=/usr/local/mysql/bin/mysqlconfig

If something goes wrong, backup by typing: make clean

(You will of course need to have setup a "test" mysql database with appropriate privileges for your "test" user)

8. Download DBD::mysql 4.004 from CPAN
http://search.cpan.org/~capttofu/DBD-mysql-4.004
9. unpack the archive & cd into it
10. perl Makefile.PL --testdb=test --testuser=nameused --testpassword=actualpwdused --testhost=localhost
11. make && make test
12. sudo make install

Apr 2, 2007 10:45 PM in response to davidh

Actually, davidh's post bring something important to light. In davidh's case, he is referring to a non-Apple mysql installation (I'm assuming this by virtue of your path to mysql_config).

Conor, let us know whether you are using Apple's inbuilt MySQL installation or your own aftermarket installation as the instructions will differ.

Apr 3, 2007 10:42 AM in response to jaydisc

I have installed the Xcode 2.4.1 tools, this is what you are to referring to?

I get the same message after installing:
I see you're using perl 5.008008 on darwin-thread-multi-2level, okay.
Remember to actually read the README file!
Use 'make' to build the software (dmake or nmake on Windows).


I also get the same message when using davidh's instructions without using cpan.

Can you think of any other reasons that I'd get this message?

1. Download DBI from CPAN
http://search.cpan.org/~timb/DBI-1.54
2. Unpack the file, eg: tar -xzvf DBI-1.54.tar.gz
3. cd into the directory
4. Type perl Makefile.PL


It seems that you do not have the Developer Tools
installed which are required to compile software.

You can either use the Developer Tools disc that came
with your OS X or your computer, but I would STRONGLY
recommend getting the latest version from Apple
Developer Connection, http://developer.apple.com/

Apr 3, 2007 2:30 PM in response to Conor McCarthy

Yes, I think you need to go through the CPAN setup again so CPAN knows where make is.

Enter cpan and run:

<pre>o conf init</pre>

You should notice that one of the steps has you confirm the location of make.

Once that's done, pickup from the beginning of my instructions.

BUT, don't forget to tell us whether you installed MySQL yourself or whether you intend on using Apple's.

Apr 3, 2007 5:20 PM in response to jaydisc

Success. Thank you very very much jaydisc and davidh.


I used "o conf init" and made the following changes.

<pre class="command">.
o conf init
.
.
.
Where is your gzip program? [/usr/bin/gzip] /sw/bin/gzip
Where is your tar program? [/usr/bin/tar] /sw/bin/tar
Where is your unzip program? [/usr/bin/unzip] /sw/bin/unzip
Where is your make program? [/usr/bin/make] /usr/bin/make
Warning: lynx not found in PATH
Where is your lynx program? []
Warning: wget not found in PATH
Where is your wget program? []
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/bin/ftp]
Warning: gpg not found in PATH
Where is your gpg program? [] ^[[A
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash] v
.
.
.</pre>

<pre class="command">.
curl -O http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.004.tar.gz
</pre>Didn't work so I downloaded manually and I got the same errors as you upon running perl Makefile.PL
I used your command (using my sql details):
<pre class="command">.
perl Makefile.PL \
--cflags="-I/usr/include/mysql -fno-omit-frame-pointer" \
--libs="-L/usr/lib/mysql -lmysqlclient -lz -lm" \
--testhost=localhost \
--testdb=test \
--testuser=test \
--testpassword=t3st \
--testsocket=/var/mysql/mysql.sock
</pre>
and it ran successfully.

The "./configure" command gave me a file not found error and I skipped it.

The rest of the commands worked ok and I can now use DBI in my perl scripts 🙂

BUT, don't forget to tell us whether you installed MySQL yourself or whether you intend on using Apple's.

I think ⚠ I installed MySQL myself ages ago but amn't sure. If you tell me how I can find out I will let you know.

Macbook Pro 17 Mac OS X (10.4.9)

Macbook Pro 17 Mac OS X (10.4.9)

Apr 3, 2007 7:05 PM in response to Conor McCarthy

Excellent! Glad it worked.

The reason my curl command failed is because it redirects you to the best mirror and curl didn't get that. Anyone know the argument to add to that command to fix that?

Regarding whether or not you have installed mysql again, maybe someone else can advise better, but I'd check for these two files:

Indicative of an Apple supplied install:
/usr/bin/mysql

Indicative of a third party supplied install:
/usr/local/bin/mysql

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Looking for idiots guide to installing DBI Perl module

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.