I have some old perl code which recently stopped working on a FreeBSD box. The code which fails looks (in simplest form) like this:
#!/usr/local/bin/perl -w
use strict;
use DBI;
my $datasource = "DBI:mysql:dbname:hostname.domain.com";
my $user = "username";
my $pass = "password";
DBI->connect($datasource, $user, $pass);
This fails with the following error:
/libexec/ld-elf.so.1: /usr/local/lib/mysql/libmysqlclient.so.15: Undefined symbol "gethostbyname_r"
If I change the datasource to reference "localhost" the code succeeds.
I've reinstalled mysql-client, DBI, and DBD-mysql from ports; no effect.
Other applications on this server (PHP, command line tools) are able to access mysql databases by hostname without trouble.
Suggestions for how to resolve this?
EDITED TO ADD: I notice that my box has both libmysqlclient.so.15
and libmysqlclient_r.so.15
. Could the problem be that DBD::mysql is trying to use libmysqlclient when it should be using libmysqlclient_r? And if so, how to resolve?