I’m building DBI and DBD::mysql in a continuous integration build server. The build of DBI is successful, as seen in the excerpt of the build log below. It clearly installs DBI/DBD.pm in the correct location.
pushd DBI-1.643 perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current ... Installing /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/DBI/DBD.pm ... Appending installation info to /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
But the next part of the build for DBD::mysql fails because it can’t find the files installed by DBI.
pushd DBD-mysql-4.050 perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current --ssl Can't locate DBI/DBD.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 15.
You can see, MakeMaker for DBD::mysql isn’t adding the install location to its
@INC at all. It just has default directories.
Is there a way to pass an argument to MakeMaker to add the install directory to
@INC? I suppose I could hard-code it, but that seems improper and hard to maintain. Is there a better way to automatically add
- CentOS 7 Linux
- Perl 5.16.3
I would have preferred to use cpanm of course. But the CI build server is isolated from the internet because of my employer’s security policy. No http proxying is allowed from CI.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
According to the documentation,
INSTALL_BASE is used for telling
make install where to put the installed module:
INSTALL_BASEcan be passed into
Makefile.PLto change where your
module will be installed.
INSTALL_BASEis more like what everyone else
calls “prefix” than
but it does not tell
perl where to look for installed modules. To do that you can use the environment variable
PERL5LIB, according to the documentation :
A list of directories in which to look for Perl library files before
looking in the standard library. Any architecture-specific and
version-specific directories, such as
archname/under the specified locations are automatically included if
they exist, with this lookup done at interpreter startup time. In
addition, any directories matching the entries in