Do you get an error “Cannot build module” while compiling OpenCA base 1.5.1? If yes, then this tutorial will explain how to fix the same.
Well, here’s the complete error message.
Build::External PERL modules Building (openca::ac) ... ERROR::Cannot build module make[6]: *** [openca-ac] Error 1 Build::External PERL modules Building (Authen::SASL::215) ... ERROR::Cannot build module
How to fix Cannot build module error
I got “Cannot build module” error for package Authen::SASL
. But this error can occur for any Perl module.
At first, it looked like the package Authen::SASL
was not installed on the system. So I installed one using the below command:
# perl -MCPAN -e 'install Authen::SASL'
By default on CentOS 6, the above command installed Authen::SASL
version 2.16. However, it didn’t solve the error. Later I noticed all the external modules that are required for OpenCA Base installation was located under src/ext-modules
folder. To debug the issue, I had to change directory to the respective module folders and check its log file. For instance, the external Perl module that is causing this error is Authen-SASL-2.15. So let me change directory to Authen-SASL-2.15 under src/ext-modules
.
$ cd src/ext-modules/Authen-SASL-2.15
Found the below error in the log file:
$ vi log.err Only one of PREFIX or INSTALL_BASE can be given. Not both.
What does that error mean? I ran perl Makefile.PL.
[src/ext-modules/Authen-SASL-2.15]$ perl Makefile.PL
Surprisingly, the above command didn’t throw any error. Now I tried make
in the openca-base-1.5.1
directory and saw it passed that particular Perl module and failed while compiling the next module – Convert::ASN1
.
Build::External PERL modules Building (Authen::SASL::215) ... Ok Building (Convert::ASN1::022) ... ERROR::Can not build module
I know in the same way I can switch to Convert::ASN1
folder under src/ext-modules
and try perl Makefile.PL
and get back to OpenCA base directory and execute make
to fix the error. But can I do that for all the 40 external modules that needs to be compiled next? Ahh! This is definitely not right way to solve this issue.
After looking at the error closely, I understand that either one of the environment variable PREFIX or INSTALL_BASE should be set and not both. That hint helped me to solve the error.
Just list all environment variables set for Perl and grep PERL_MB_OPT
.
# perl -V | grep PERL_MB_OPT PERL_MB_OPT="--install_base /root/perl5"
You can see that install_base
is set for PERL_MB_OPT
. Unset the variable and you are good to compile OpenCA Base.
#unset PERL_MB_OPT
Now the issue is fixed globally for every external module inside src/ext-modules
.