# Can't Reinstall mod_perl2 Port After Deinstall



## spomerg (Jan 25, 2011)

Hello,

After doing a portupgrade from perl 5.12.2 to 5.2.13 this morning on my digital archives server (and running the perl-after-upgrade utility, without and then with the -f option), I decided to restart apache for good measure with [cmd=]apachectl graceful[/cmd] and got the following error:


```
httpd: Syntax error on line 106 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/mod_perl.so into server: 
Shared object "libperl.so" not found, required by "mod_perl.so"
```

Fortunately [cmd=]ps ax | grep httpd[/cmd] shows me apache is still running. I then decided to cd to /usr/ports/www/mod_perl2 and run [cmd=]make deinstall[/cmd] and then [cmd=]make reinstall[/cmd] to see if that would fix the problem of mod_perl.so finding libperl.so, but now I have this error:


```
===>  Installing for ap22-mod_perl2-2.0.4_2,3
===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/lib/perl5/site_perl/5.12.3/mach/BSD/Resource.pm - found
===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/sbin/apxs - found
===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/bin/perl5.12.3 - found
===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/sbin/apxs - found
===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/bin/perl5.12.3 - found
===>   Generating temporary packing list
===>  Checking if www/mod_perl2 already installed
make: don't know how to make /usr/local/lib/perl5/5.12.2/mach/Config.pm. Stop
*** Error code 2

Stop in /usr/ports/www/mod_perl2.
*** Error code 1

Stop in /usr/ports/www/mod_perl2.
```

Kinda strange that although it finds perl5.12.3, the latest version I just upgraded TO, the make line is looking for something in the 5.12.2 directory path, the version I just upgraded FROM.

Before I make things worse with "trying stuff", I thought I'd try a less reckless way and ask at the forums here.


----------



## wblock@ (Jan 26, 2011)

spomerg said:
			
		

> ```
> ===>  Installing for ap22-mod_perl2-2.0.4_2,3
> ===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/lib/perl5/site_perl/5.12.3/mach/BSD/Resource.pm - found
> ===>   ap22-mod_perl2-2.0.4_2,3 depends on file: /usr/local/sbin/apxs - found
> ...



Two things that may be going on:

1. The object code that had already been compiled was still in the work directory of the port, and you didn't clean it.  The reinstall target comes along, says "hey, it's already all built" and happily reinstalls it without rebuilding.

2. perl-after-upgrade(1) wasn't used after upgrading Perl.


----------



## DutchDaemon (Jan 26, 2011)

You can always reinstall Perl recursively. This is probably better done using a port managing utility like ports-mgmt/portmaster. Using 'make' to manage ports and their dependencies is not a fun job.


----------



## spomerg (Jan 26, 2011)

wblock said:
			
		

> Two things that may be going on:
> 
> 1. The object code that had already been compiled was still in the work directory of the port, and you didn't clean it.  The reinstall target comes along, says "hey, it's already all built" and happily reinstalls it without rebuilding.
> 
> 2. perl-after-upgrade(1) wasn't used after upgrading Perl.



Thanks wblock. :beer Well, I know it wasn't #2 as I said in my original message that I had run the perl-after-upgrade utility, first without any options, then with the -f option.

But I think you are spot-on with #1. I changed to the /usr/ports/www/mod_perl2 directory and did [cmd=]make clean[/cmd] then [cmd=]make reinstall[/cmd] and I have mod_perl2 back. I then did [cmd=]apachectl graceful[/cmd] and found my original problem (mod_perl.so not finding libperl.so) was solved as well. I was reasonably sure it would be; I was looking in our staff helpdesk database and saw reinstalling mod_perl2 was how I solved that on another occasion.

I wonder why I had to issue [cmd=]make clean[/cmd]
? I _always_ install ports with [cmd=]make install clean[/cmd]


----------



## DutchDaemon (Jan 26, 2011)

When you run [cmd=]make install clean[/cmd] and the port build fails, the 'install' and 'clean' steps are not executed. So your port's work directory is filled with already compiled (and obviously failing) code. What you did this time was (more or less) [cmd=]make clean install clean[/cmd] with the first 'clean' wiping the old work directory.


----------



## spomerg (Jan 26, 2011)

DutchDaemon said:
			
		

> When you run [cmd=]make install clean[/cmd] and the port build fails, the 'install' and 'clean' steps are not executed. So your port's work directory is filled with already compiled (and obviously failing) code. What you did this time was (more or less) [cmd=]make clean install clean[/cmd] with the first 'clean' wiping the old work directory.



Thanks DutchDaemon, now I think I understand what happened. When I reinstalled mod_perl2 the first time (the previous helpdesk ticket I mentioned), it was rebuilt upon [CMD=]make reinstall[/CMD] and not cleaned afterwards.

One last question: Is it possible to do [CMD=]make reinstall clean[/CMD]? Reading the man page for ports would suggest that I could, but am verifying. Thanks.


----------



## DutchDaemon (Jan 26, 2011)

You can put all of these directives in any order you like. It's basically an abbreviation for [cmd=]make && make reinstall && make clean[/cmd] So as soon as a step fails, the other ones are omitted.


----------

