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 INSTALL_BASE/lib/perl5/<arch>
to @INC
?
Environment:
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.
According to the documentation, INSTALL_BASE
is used for telling make install
where to put the installed module:
INSTALL_BASE
INSTALL_BASE
can be passed intoMakefile.PL
to change where your module will be installed.INSTALL_BASE
is more like what everyone else calls "prefix" thanPREFIX
is.
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 :
PERL5LIB
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
version/archname/
,version/
, orarchname/
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$Config{inc_version_list}
are added.