# Unable to install perl from ports



## oiram (Apr 26, 2013)

Guys,

Excuse my ignorance but I went through a number of searching exercises and found nothing really relevant to the issue I'm facing. In short I have upgraded from 9.0-REL to 9.1-REL with no real problems. Previously I had perl5.12 installed from ports and since now 5.14 and 5.16 are available I thought I may upgrade. Went through UPDATING and tried:


```
pkgdb -Ff
env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.16 -f perl-5.12.\*
portupgrade -fr perl
```

with no luck. So then tried to just make them individually, both with no success, even tried to compile 5.12 with no luck as well. Re-fetched the ports tree with no luck as well. What is odd - I tried it on some clean VM with fresh 9.1-REL install and had no problem with any of them so I'm puzzled. Any help really appreciated. Below are errors I'm getting on my machine (for 5.12 but identical for 5.14 and 5.16):


```
LD_LIBRARY_PATH=/usr/ports/lang/perl5.12/work/perl-5.12.4  ./miniperl -Ilib -Icpan/Cwd -Icpan/Cwd/lib lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
Can't locate File/Path.pm in @INC (@INC contains: lib cpan/Cwd cpan/Cwd/lib .) at lib/unicore/mktables line 15.
BEGIN failed--compilation aborted at lib/unicore/mktables line 15.
*** [uni.data] Error code 2

Stop in /usr/ports/lang/perl5.12/work/perl-5.12.4.
*** [do-build] Error code 1

Stop in /usr/ports/lang/perl5.12.
*** [build] Error code 1

Stop in /usr/ports/lang/perl5.12.
```


----------



## jnbek (Apr 26, 2013)

*W*hat are the errors when you run `env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.16 -f perl-5.12.\*`? When I upgraded all my machines to 5.16 (some from 5.10, others 5.12) that command worked perfectly for me. I followed up with a `portupgrade -facv` which slapped all installed packages.. but it worked great.


----------



## cpm@ (Apr 26, 2013)

If was included in the Perl's @INC run `# perl -e 'use File::Path;'` then Perl will simply return without printing any output. 

To solve your upgrade problem, read this thread: http://forums.freebsd.org/showthread.php?t=1911.


----------



## jnbek (Apr 26, 2013)

D'oh! Got pwnd by DutchDaemon for formatting


----------



## cpm@ (Apr 26, 2013)

jnbek said:
			
		

> D'oh!!! Got pwnd by DutchDaemon for formatting



Yeah! @DD is the best advanced spell checker


----------



## oiram (Apr 26, 2013)

And that's what happen, File::Path is there but not while running `make` on perl5.12 or `env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.16 -f perl-5.12.\*` on perl5.16 port


```
# perl -e 'use File::Path;'
#
```

Thanks @cpu82 for suggestion but been there, unfortunately no luck so far.


----------



## cpm@ (Apr 26, 2013)

Try deleting old version using `# pkg_delete -f perl-5.12.4` or `# make deinstall -C /usr/ports/lang/perl5.12`

Then, do following:

```
# pkgdb -Ff
# portupgrade lang/perl5.16
# portupgrade -fr perl
# perl-after-upgrade
# perl-after-upgrade -f
```


----------



## oiram (Apr 27, 2013)

I was thinking of that but have to many other ports (200+) depending on it and just don't want to screw things more than they are at present. How safe will be to remove current version and in the worst case install from packages?

And what is more interesting why is it not building? I even tried to place missing *.pm in lib (following on occurring missing file errors) but then I got to the point where compilation started and errored on ext/DynaLoader and this time error was pointing at missing ExtUtils/xsubpp


```
../../miniperl "-I../../lib" "-I../../lib" ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs > DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c
Can't open perl script "ExtUtils/xsubpp": No such file or directory
*** [DynaLoader.o] Error code 2

Stop in /usr/ports/lang/perl5.12/work/perl-5.12.4/ext/DynaLoader.
Unsuccessful make(ext/DynaLoader): code=256 at make_ext.pl line 449.
*** [DynaLoader.o] Error code 25
```

Tried to put it in -I with no luck and xsubpp is in the PATH though `miniperl` is executing it as ExtUtils/xsubpp. If I put ExtUtils/xsubpp into ext/DynaLoader it starts again with other *.pm. So I'm really lost now.


----------



## oiram (Apr 27, 2013)

So I have deleted 5.12 and fixed the DB (deleted dependencies) but I don't think portupgrade will do anything at that point since

perl5.16 is not installed
there is not other port starting with perl in name
as you can actually see below


```
# portupgrade lang/perl5.16
/usr/local/lib/ruby/site_ruby/1.8/pkgtools/pkgtools.rb:483: warning: Insecure world writable dir /tmp/./ in PATH, mode 041777
#                        
# 
# portupgrade -fr perl
/usr/local/lib/ruby/site_ruby/1.8/pkgtools/pkgtools.rb:483: warning: Insecure world writable dir /tmp/./ in PATH, mode 041777
#
```

I will try to `make` now in perl5.16 and will see where that leads me.


----------



## oiram (Apr 27, 2013)

And I'm back to the initial problem


```
LD_LIBRARY_PATH=/usr/ports/lang/perl5.16/work/perl-5.16.2  ./miniperl -Ilib -Idist/Cwd -Idist/Cwd/lib -Idist/Carp/lib lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
Can't locate File/Path.pm in @INC (@INC contains: lib dist/Cwd dist/Cwd/lib dist/Carp/lib .) at lib/unicore/mktables line 31.
BEGIN failed--compilation aborted at lib/unicore/mktables line 31.
*** [uni.data] Error code 2
```


----------



## jnbek (Apr 27, 2013)

try
`portinstall -fvc perl5.16`


----------



## oiram (Apr 27, 2013)

I'm afraid it's still the same 


```
# env DISABLE_CONFLICTS=1 portinstall -cfv lang/perl5.16
--->  Session started at: Sat, 27 Apr 2013 01:39:32 +0100
/usr/local/lib/ruby/site_ruby/1.8/pkgtools/pkgtools.rb:288: warning: Insecure world writable dir /tmp/./ in PATH, mode 041777
[Gathering depends for lang/perl5.16  done]
--->  Fresh installation of lang/perl5.16 started at: Sat, 27 Apr 2013 01:39:33 +0100
--->  Installing 'perl-5.16.2_1' from a port (lang/perl5.16)
--->  Build of lang/perl5.16 started at: Sat, 27 Apr 2013 01:39:39 +0100
--->  Building '/usr/ports/lang/perl5.16'
===>  Cleaning for perl-5.16.2_1
===>  License ART10 GPLv1 accepted by the user
===>  Found saved configuration for perl-5.16.2_1
===> Fetching all distfiles required by perl-5.16.2_1 for building
===>  Extracting for perl-5.16.2_1
=> SHA256 Checksum OK for perl/perl-5.16.2.tar.bz2.
=> SHA256 Checksum OK for perl/BSDPAN-20111107.tar.bz2.
===>  Patching for perl-5.16.2_1
===>  Applying FreeBSD patches for perl-5.16.2_1

[--cut--]

updated lib/Config_heavy.pl
LD_LIBRARY_PATH=/usr/ports/lang/perl5.16/work/perl-5.16.2  ./miniperl -Ilib -Idist/Cwd -Idist/Cwd/lib -Idist/Carp/lib lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
Can't locate File/Path.pm in @INC (@INC contains: lib dist/Cwd dist/Cwd/lib dist/Carp/lib .) at lib/unicore/mktables line 31.
BEGIN failed--compilation aborted at lib/unicore/mktables line 31.
*** [uni.data] Error code 2

Stop in /usr/ports/lang/perl5.16/work/perl-5.16.2.
*** [do-build] Error code 1

Stop in /usr/ports/lang/perl5.16.
*** [build] Error code 1

Stop in /usr/ports/lang/perl5.16.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portinstall20130427-47200-1tj3fqe-0 env make
** Fix the problem and try again.
--->  Build of lang/perl5.16 ended at: Sat, 27 Apr 2013 01:41:58 +0100 (consumed 00:02:19)
--->  Fresh installation of lang/perl5.16 ended at: Sat, 27 Apr 2013 01:41:58 +0100 (consumed 00:02:24)
--->  ** Install tasks 1: 0 done, 0 ignored, 0 skipped and 1 failed
--->  Listing the results (+:done / -:ignored / *:skipped / !:failed)
       ! lang/perl5.16  (missing header)
--->  Packages processed: 0 done, 0 ignored, 0 skipped and 1 failed
--->  Session ended at: Sat, 27 Apr 2013 01:41:58 +0100 (consumed 00:02:26)
#
```


----------



## cpm@ (Apr 27, 2013)

Reinstall devel/p5-File-Path.


----------



## oiram (Apr 27, 2013)

No go my friend, still the same. Not sure if you have noticed but `make` actually executes miniperl with its own environment


```
===>  Installing for p5-File-Path-2.09
===>   p5-File-Path-2.09 depends on file: /usr/local/bin/perl5.14.2 - found
===>   Generating temporary packing list
Installing /usr/local/lib/perl5/5.14.2/man/man3/File::Path.3
===>   Compressing manual pages for p5-File-Path-2.09
===>   Registering installation for p5-File-Path-2.09
===>  Cleaning for p5-File-Path-2.09
# 

[--cut--]

LD_LIBRARY_PATH=/usr/ports/lang/perl5.16/work/perl-5.16.2  ./miniperl -Ilib -Idist/Cwd -Idist/Cwd/lib -Idist/Carp/lib lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
Can't locate File/Path.pm in @INC (@INC contains: lib dist/Cwd dist/Cwd/lib dist/Carp/lib .) at lib/unicore/mktables line 31.
BEGIN failed--compilation aborted at lib/unicore/mktables line 31.
*** [uni.data] Error code 2
```


----------



## jnbek (Apr 27, 2013)

`pkg_add -r perl`
then
`env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.16 -f perl-5.12.\*`

Replacing 5.12 with whatever version gets installed.


----------



## oiram (Apr 27, 2013)

I did it already. After removing 5.12.4 and `pkg_add -r perl` installed 5.14.2

I think we running in a circle here  If the port does not compile any portupgrade exercises will not succeed.


----------



## cpm@ (Apr 27, 2013)

For the next time, remove the problematic/s Perl module/s (at present case, p5-File-Path), upgrade Perl, running perl-after-upgrade(1) and install the Perl module/s that was/were problematic/s.

And always build from source, always...


----------



## oiram (Apr 27, 2013)

You see the p5-File-Path is removed now


```
# pkg_info | grep p5-File
p5-File-Listing-6.04 Parse directory listings
#
```

and I'm still getting that error (on 5.14 now when trying rebuild)


```
===>  Building for perl-5.14.2_3
LD_LIBRARY_PATH=/usr/ports/lang/perl5.14/work/perl-5.14.2  ./miniperl -Ilib -Idist/Cwd -Idist/Cwd/lib lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
Can't locate File/Path.pm in @INC (@INC contains: lib dist/Cwd dist/Cwd/lib .) at lib/unicore/mktables line 32.
BEGIN failed--compilation aborted at lib/unicore/mktables line 32.
*** [uni.data] Error code 2
```

So I'm not sure what I'm missing . I always build from ports tree  and use packages as a really last resort.


----------



## cpm@ (Apr 27, 2013)

Try following:

```
# perldoc -l File::Path
/usr/local/lib/perl5/5.14.2/File/Path.pm
# setenv PERL5LIB /usr/local/lib/perl5/5.14.2
```

When you have done this, verify the value of the newly configured @INC by executing `# perl -V`. You should see the modified value of @INC:

```
Built under freebsd
  Compiled at Mar 11 2013 00:22:43
  %ENV:
    PERL5LIB="/usr/local/lib/perl5/5.14.2"
  @INC:
    /usr/local/lib/perl5/5.14.2/File
    /usr/local/lib/perl5/5.14.2/BSDPAN
    /usr/local/lib/perl5/site_perl/5.14.2/mach
    /usr/local/lib/perl5/site_perl/5.14.2
    /usr/local/lib/perl5/5.14.2/mach
    /usr/local/lib/perl5/5.14.2
```

Try compile again.



			
				oiram said:
			
		

> ```
> ===>  Building for perl-5.14.2_3
> LD_LIBRARY_PATH=/usr/ports/lang/perl5.14/work/perl-5.14.2  ./miniperl -Ilib -Idist/Cwd -Idist/Cwd/lib lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
> Can't locate File/Path.pm in @INC (@INC contains: lib dist/Cwd dist/Cwd/lib .) at lib/unicore/mktables line 32.
> ...



Show full build output, you can use script(1) to capture console session output.


----------



## oiram (Apr 28, 2013)

Followed with you suggestion but getting to the point where miniperl is unable to execute ExtUtils/xsubpp while building ext/DynaLoader


```
%ENV:
    PERL5LIB="/usr/local/lib/perl5/5.14.2"
  @INC:
    /usr/local/lib/perl5/5.14.2
    /usr/local/lib/perl5/5.14.2/BSDPAN
    /usr/local/lib/perl5/site_perl/5.14.2/mach
    /usr/local/lib/perl5/site_perl/5.14.2
    /usr/local/lib/perl5/5.14.2/mach
    /usr/local/lib/perl5/5.14.2
    .
```


```
../../miniperl "-I../../lib" "-I../../lib" ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs > DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c
Can't open perl script "ExtUtils/xsubpp": No such file or directory
*** [DynaLoader.o] Error code 2
```

I tried with default cc as well as gcc49 with same outcome. Attached full outputs for both compilers.


----------



## cpm@ (Apr 28, 2013)

You need modify enviroment variable @INC 

```
%ENV:
    PERL5LIB="/usr/local/lib/perl5/5.14.2"
```
 should be: 
	
	



```
[del]%ENV:
    PERL5LIB="/usr/local/lib/perl5/5.14.2/File"[/del]
```
So Perl can locate the module.

```
../../miniperl "-I../../lib" "-I../../lib" ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs > DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c
Can't open perl script "ExtUtils/xsubpp": No such file or directory
*** [DynaLoader.o] Error code 2
```

Re/install devel/p5-ExtUtils-ParseXS.


----------



## oiram (Apr 28, 2013)

Not sure what is the reason you are suggesting adding /File to the path? If you look at the location of File::Path (File/Path.pm) you will notice that perl won't find the module then as it will try to look for


```
/usr/local/lib/perl5/5.14.2/File/File/Path.pm
```

as you can see below


```
%ENV:
    PERL5LIB="/usr/local/lib/perl5/5.14.2/File"
```

and while compiling


```
Can't locate File/Path.pm in @INC (@INC contains: lib dist/Cwd dist/Cwd/lib /usr/local/lib/perl5/5.14.2/File .) at lib/unicore/mktables line 32.
BEGIN failed--compilation aborted at lib/unicore/mktables line 32.
*** [uni.data] Error code 2
```


I mentioned earlier that xsubpp is available from normal shell, but not from within miniperl which is used to run compilation of actual perlx.yy


```
# which xsubpp
/usr/local/bin/xsubpp
```

as well as /usr/local/lib/perl5/site_perl/5.14.2/ExtUtils/xsubpp

I have even rebuilt devel/p5-ExtUtils-ParseXS with no difference. I think there is something well broken with my system but I have no idea at this point where to look  I'm really greatfull for all your help.


----------



## cpm@ (Apr 28, 2013)

oiram said:
			
		

> Not sure what is the reason you are suggesting adding /File to the path? If you look at the location of File::Path (File/Path.pm) you will notice that perl won't find the module then as it will try to look for
> 
> 
> ```
> ...



MMm.. a cluelessness :\

Please, submit a PR to freebsd-questions@ ML.


----------



## oiram (Apr 28, 2013)

I just went last night with `portmaster -o lang/perl5.16 lang/perl5.14` and it completed with no problem  Magic or something?! So now I have 


```
# perl -v
This is perl 5, version 16, subversion 2 (v5.16.2) built for i386-freebsd-64int
```

But still when trying to run `make` it fails  I will work on PR.


----------



## cpm@ (Apr 28, 2013)

An explanation of why portupgrade(1) fails to build Perl, is build Perl with THREADS support enabled, then build a bunch of modules that use shared objects, then reconfigure Perl to be unthreaded and force it to upgrade. The shared objects will fail to load and modules will fall over.

This circular dependency would not be an issue if the uninstall somehow knew that the files where required  by Perl.


----------



## oiram (Apr 28, 2013)

I was thinking about that. Previously I have Perl compiled with THREADS enabled and now disabled option as some port complained about that. Will keep in mind.


----------



## jnbek (Apr 29, 2013)

Nice find, @cpu82, I would have never thought to look at that.


----------



## cpm@ (Apr 29, 2013)

jnbek said:
			
		

> Nice find, @cpu82, I would have never thought to look at that.



I was looking for similar errors on the mailing lists, and the search paid off 

IMHO this kind of problems have allowed that pormaster(8) be enshrined as a good tool to manage ports. It's mostly personal choice.


----------



## frankpeng (Aug 22, 2013)

I installed a fresh 9.1-RELEASE. I have no problem to install Perl 5.18. But on my old machine, it has a 9.1-STABLE kernel, I had perl5.16 installed. When I tried to install perl5.18. It always complains about a conflict with 5.16 no matter how many times I did `make deinstall` of Perl 5.16.

I recompiled the kernel and rebuilt the world. I deleted all 5.14 and 5.6.  Now it is 9.2-RELEASE. Now I am installing perl5.18. It's done. No complaint!


----------

