Bug 155991 - textproc/p5-XML-Parser build error
Summary: textproc/p5-XML-Parser build error
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Jun Kuriyama
Depends on:
Reported: 2011-03-28 10:40 UTC by Dmitry
Modified: 2013-01-12 03:10 UTC (History)
0 users

See Also:

p5-XML-Parser.patch (1.60 KB, patch)
2011-11-09 01:07 UTC, martin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry 2011-03-28 10:40:10 UTC
On fresh machine. With NO any ports installed. Manually deleted all from /usr/local/lib.

Above lines, when was installed perl, expat, etc. skipped.

===>  Vulnerability check disabled, database not found
===>  License check disabled, port has not defined LICENSE
===>  Extracting for p5-XML-Parser-2.40
=> SHA256 Checksum OK for XML-Parser-2.40.tar.gz.
===>   p5-XML-Parser-2.40 depends on file: /usr/local/bin/perl5.10.1 - found
===>  Patching for p5-XML-Parser-2.40
===>   p5-XML-Parser-2.40 depends on file: /usr/local/bin/perl5.10.1 - found
===>   p5-XML-Parser-2.40 depends on file: /usr/local/bin/perl5.10.1 - found
===>   p5-XML-Parser-2.40 depends on shared library: expat.6 - found
===>  Configuring for p5-XML-Parser-2.40

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager.

Or you can download expat from:


If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
===>  Building for p5-XML-Parser-2.40
cp Parser/Encodings/x-sjis-cp932.enc blib/lib/XML/Parser/Encodings/x-sjis-cp932.enc
cp Parser/Encodings/iso-8859-7.enc blib/lib/XML/Parser/Encodings/iso-8859-7.enc
cp Parser/Encodings/iso-8859-10.enc blib/lib/XML/Parser/Encodings/iso-8859-10.enc
cp Parser/Encodings/ibm866.enc blib/lib/XML/Parser/Encodings/ibm866.enc
cp Parser/Style/Tree.pm blib/lib/XML/Parser/Style/Tree.pm
cp Parser/Encodings/iso-8859-9.enc blib/lib/XML/Parser/Encodings/iso-8859-9.enc
cp Parser/Encodings/iso-8859-11.enc blib/lib/XML/Parser/Encodings/iso-8859-11.enc
cp Parser/Encodings/x-euc-jp-unicode.enc blib/lib/XML/Parser/Encodings/x-euc-jp-unicode.enc
cp Parser/Encodings/iso-8859-14.enc blib/lib/XML/Parser/Encodings/iso-8859-14.enc
cp Parser/Encodings/iso-8859-1.enc blib/lib/XML/Parser/Encodings/iso-8859-1.enc
cp Parser/Encodings/iso-8859-6.enc blib/lib/XML/Parser/Encodings/iso-8859-6.enc
cp Parser/Encodings/big5.enc blib/lib/XML/Parser/Encodings/big5.enc
cp Parser/Encodings/windows-1255.enc blib/lib/XML/Parser/Encodings/windows-1255.enc
cp Parser/Encodings/iso-8859-15.enc blib/lib/XML/Parser/Encodings/iso-8859-15.enc
cp Parser/Encodings/x-sjis-jdk117.enc blib/lib/XML/Parser/Encodings/x-sjis-jdk117.enc
cp Parser/Encodings/x-sjis-unicode.enc blib/lib/XML/Parser/Encodings/x-sjis-unicode.enc
cp Parser/LWPExternEnt.pl blib/lib/XML/Parser/LWPExternEnt.pl
cp Parser/Encodings/windows-1251.enc blib/lib/XML/Parser/Encodings/windows-1251.enc
cp Parser/Style/Debug.pm blib/lib/XML/Parser/Style/Debug.pm
cp Parser/Encodings/iso-8859-5.enc blib/lib/XML/Parser/Encodings/iso-8859-5.enc
cp Parser/Encodings/koi8-r.enc blib/lib/XML/Parser/Encodings/koi8-r.enc
cp Parser/Encodings/README blib/lib/XML/Parser/Encodings/README
cp Parser/Encodings/euc-kr.enc blib/lib/XML/Parser/Encodings/euc-kr.enc
cp Parser/Encodings/windows-1250.enc blib/lib/XML/Parser/Encodings/windows-1250.enc
cp Parser/Encodings/windows-1252.enc blib/lib/XML/Parser/Encodings/windows-1252.enc
cp Parser/Encodings/Japanese_Encodings.msg blib/lib/XML/Parser/Encodings/Japanese_Encodings.msg
cp Parser/Encodings/iso-8859-3.enc blib/lib/XML/Parser/Encodings/iso-8859-3.enc
cp Parser/Style/Subs.pm blib/lib/XML/Parser/Style/Subs.pm
cp Parser/Encodings/iso-8859-8.enc blib/lib/XML/Parser/Encodings/iso-8859-8.enc
cp Parser/Encodings/iso-8859-4.enc blib/lib/XML/Parser/Encodings/iso-8859-4.enc
cp Parser/Encodings/x-euc-jp-jisx0221.enc blib/lib/XML/Parser/Encodings/x-euc-jp-jisx0221.enc
cp Parser/Encodings/iso-8859-13.enc blib/lib/XML/Parser/Encodings/iso-8859-13.enc
cp Parser/Encodings/iso-8859-2.enc blib/lib/XML/Parser/Encodings/iso-8859-2.enc
cp Parser/Style/Objects.pm blib/lib/XML/Parser/Style/Objects.pm
cp Parser.pm blib/lib/XML/Parser.pm
cp Parser/Encodings/x-sjis-jisx0221.enc blib/lib/XML/Parser/Encodings/x-sjis-jisx0221.enc
cp Parser/Style/Stream.pm blib/lib/XML/Parser/Style/Stream.pm
Running Mkbootstrap for XML::Parser ()
chmod 644 Parser.bs
rm -f blib/arch/auto/XML/Parser/Parser.so
cc  -shared  -L/usr/local/lib -fstack-protector Parser.o  -o blib/arch/auto/XML/Parser/Parser.so 	    	 
cc: Parser.o: No such file or directory
cc: No input files specified
*** Error code 1

Stop in /usr/ports/textproc/p5-XML-Parser/work/XML-Parser-2.40.
*** Error code 1

Stop in /usr/ports/textproc/p5-XML-Parser.


On my home machine this port compiled and installed successfully. But, on my NetBook I see this error.
How-To-Repeat: cd /var/db/pkg
pkg_delete *
cd /usr/ports/textproc/p5-XML-Parser
Comment 1 Edwin Groothuis freebsd_committer 2011-03-28 10:40:21 UTC
Responsible Changed
From-To: freebsd-ports-bugs->kuriyama

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 admin 2011-04-01 08:09:16 UTC
Anybody help me?

Perl build options

# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for perl-5.10.1_3

Lines from make.conf



# added by use.perl 2011-03-31 17:24:44
Comment 3 Jun Kuriyama freebsd_committer 2011-08-29 14:45:17 UTC
Do you still have this error?  I cannot reproduce it...

Jun Kuriyama <kuriyama@FreeBSD.org> // FreeBSD Project
         <kuriyama@s2factory.co.jp> // S2 Factory, Inc.
Comment 4 Jun Kuriyama freebsd_committer 2011-08-29 14:45:33 UTC
State Changed
From-To: open->feedback

Feedback sent.
Comment 5 martin 2011-09-24 20:09:49 UTC
I had the exactly the same error message as Dmitry, on FreeBSD 8 and now on
FreeBSD 9.

I had my workdir set to a NFS share (WRKDIRPREFIX), setting that to a local
dir solved the problem!

I didn't investigate further, but this should help you reproduce the problem.


Martin Tournoij <martin@arp242.net>
http://arp242.net | http://aragorn.nl | http://daemonforums.org

When smashing monuments, save the pedestals -- they always come in
		-- Stanislaw J. Lec, "Unkempt Thoughts"
Comment 6 admin 2011-10-03 09:26:58 UTC
I forgot it ! I am use NFS too !
I think this bug is reproducible only if ports tree located on the NFS
Comment 7 daniel 2011-10-11 19:24:00 UTC
This actually looks like a bug in Devel::CheckLib.

Stripped it down to the minimum, this should search for the expat lib:
---- 8< ----
use 5.004.005;
use Devel::CheckLib; # make sure devel/p5-Devel-CheckLib is installed
if (
    check_lib (
        lib => 'expat',
        header => 'expat.h',
        incpath =>  '/usr/local/lib',
        libpath => '/usr/local/include' ) ) {
    print "found expat lib\n";
---- 8< ----

Running this in $HOME (not on NFS) works fine. Running this in $HOME/nfs
(some random NFS share) doesn't output anything.

I'm quite new to FBSD, how can I help to resolve this?
Comment 8 martin 2011-11-09 01:07:04 UTC

I ran into this again, I had some spare time and took a deeper look. The
problem is indeed in Devel::CheckLib (Which is included in XML::Parser), it
tries to create a temporary file using File::Temp::tempfile() in the source
directory -- This is known (& documented) not to work over NFS...

I reported this bug at both Devel::CheckLib and XML::Parser ...

In the meanwhile, the attached patch can be used to fix the problem ...
Comment 9 Todd Rinaldo 2011-11-09 08:59:15 UTC
While the provided patch may work, it strikes me that the fix avoids the =
fact that files on a NFS mount aren't behaving correctly. Shouldn't this =
be reported against the kernel or whatever is responsible for =
maintaining the NFS connection?=
Comment 10 martin 2011-11-09 11:04:40 UTC
On Wed, Nov 09, 2011 at 02:59:15AM -0600, Todd Rinaldo wrote:
> While the provided patch may work, it strikes me that the fix avoids the
> fact that files on a NFS mount aren't behaving correctly. Shouldn't this be
> reported against the kernel or whatever is responsible for maintaining the
> NFS connection?

I didn't investigate, but the File::Temp docs say:

"Some problems are associated with using temporary files that reside on NFS
file systems and it is recommended that a local filesystem is used whenever

Comment 11 Martin Cracauer 2012-01-09 20:34:59 UTC
This isn't good.

The only way I could build this port on my diskless machine (I really
love diskless these days) is to move the whole port to /tmp (mfs
filesystem) and symlink back from /tmp into /usr/ports

That's kinda fine for a one-off build but this will happen again on
updates and who knows how many other perl ports have the same problem.

And all I wanted was ports/editors/emacs...

Martin Cracauer <cracauer@cons.org>   http://www.cons.org/cracauer/
Comment 12 John Baldwin freebsd_committer freebsd_triage 2012-01-14 17:11:23 UTC
I just ran into this trying to build a textproc/docproj in a VM with an 
NFS mounted ports tree from the host OS.  Having rpc.lockd and rpc.statd 
running didn't fix it nor did mounting with the 'nolockd' option, so it 
doesn't appear to be related to NFS locking.  That is the only thing 
that programs usually have problems with over NFS.  Given that, I am 
betting this is a bug in Perl's tempfile stuff and not in FreeBSD's NFS 
and the patch should be applied to fix builds over NFS.

John Baldwin
Comment 13 Slaven Rezic 2012-04-18 21:18:40 UTC
I think it *is* related to nfs locking. I just tried the following
(/mnt/test is an nfs mount residing on a linux system, no locking
enabled on the freebsd system):

22:12 eserte@biokovo  (/mnt/test): env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = tempfile("XXXXXXXX", EXLOCK=>0) or die $!'
22:12 eserte@biokovo  (/mnt/test): env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = tempfile("XXXXXXXX", EXLOCK=>1) or die $!'
Error in tempfile() using XXXXXXXX: Could not create temp file tRP8tD0l: Operation not supported at -e line 1

(Note that File::Temp sets EXLOCK=>1 by default on *BSD systems)

Now with nfslocking:

22:12 eserte@biokovo  (/mnt/test): sudo /etc/rc.d/nfslocking start
Starting statd.
Starting lockd.
22:12 eserte@biokovo  (/mnt/test): env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = tempfile("XXXXXXXX", EXLOCK=>1) or die $!'
22:12 eserte@biokovo  (/mnt/test): env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = tempfile("XXXXXXXX", EXLOCK=>0) or die $!'


Slaven Rezic - slaven <at> rezic <dot> de

    Berlin Perl Mongers - http://berlin.pm.org
Comment 14 dfilter service freebsd_committer 2013-01-12 03:06:50 UTC
Author: kuriyama
Date: Sat Jan 12 03:06:37 2013
New Revision: 310260
URL: http://svnweb.freebsd.org/changeset/ports/310260

  - Try to fix build on NFS without lockd (patch provided by Martin
    Tournoij <martin@arp242.net> at ports/155991).
  - Add pre-build check for locking to tell people why build fails.
  PR:		ports/155991, ports/164600
  Submitted by:	"Dmitry S. Luhtionov" <mitya@cabletv.dp.ua>

  head/textproc/p5-XML-Parser/files/check_nfs.pl   (contents, props changed)
  head/textproc/p5-XML-Parser/files/patch-CheckLib.pm   (contents, props changed)

Modified: head/textproc/p5-XML-Parser/Makefile
--- head/textproc/p5-XML-Parser/Makefile	Sat Jan 12 02:46:15 2013	(r310259)
+++ head/textproc/p5-XML-Parser/Makefile	Sat Jan 12 03:06:37 2013	(r310260)
@@ -1,12 +1,8 @@
-# New ports collection makefile for:	XML::Parser
-# Date created:		15 Nov 1998
-# Whom:			Jun Kuriyama <kuriyama@FreeBSD.org>
 # $FreeBSD$
 CATEGORIES=	textproc perl5
@@ -14,7 +10,7 @@ PKGNAMEPREFIX=	p5-
 MAINTAINER=	kuriyama@FreeBSD.org
 COMMENT=	Perl extension interface to James Clark's XML parser, expat
-LIB_DEPENDS=	expat.6:${PORTSDIR}/textproc/expat2
+LIB_DEPENDS=	expat:${PORTSDIR}/textproc/expat2
@@ -57,6 +53,10 @@ post-configure:
 	@${PERL} -i -pe 's|^(CC = ).*|$$1 ${CC}|;' \
 		-e 's|^(CCFLAGS = ).*|$$1 ${CFLAGS}|' ${WRKSRC}/Expat/Makefile
+	@cd ${WRKDIR} && ${PERL} ${FILESDIR}/check_nfs.pl 2>/dev/null || \
+	(${ECHO_MSG} "===>  lockf in \$$TMPDIR required"; ${FALSE})
 XE=	${.CURDIR}/../p5-XML-Encoding
 	@cd ${XE}; \

Added: head/textproc/p5-XML-Parser/files/check_nfs.pl
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/p5-XML-Parser/files/check_nfs.pl	Sat Jan 12 03:06:37 2013	(r310260)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+use strict;
+use warnings;
+use File::Temp qw(tempfile);
+my ($fh, $fn) = tempfile("check-XXXXXX", SUFFIX => '.tmp', TMPDIR => 1, UNLINK => 1);
+#print "$fn\n";

Added: head/textproc/p5-XML-Parser/files/patch-CheckLib.pm
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/p5-XML-Parser/files/patch-CheckLib.pm	Sat Jan 12 03:06:37 2013	(r310260)
@@ -0,0 +1,22 @@
+--- inc/Devel/CheckLib.pm.orig	2013-01-11 11:43:02.293444337 +0900
++++ inc/Devel/CheckLib.pm	2013-01-11 11:48:47.556449831 +0900
+@@ -222,7 +222,7 @@
+     for my $header (@headers) {
+         push @use_headers, $header;
+         my($ch, $cfile) = File::Temp::tempfile(
+-            'assertlibXXXXXXXX', SUFFIX => '.c'
++            'assertlibXXXXXXXX', SUFFIX => '.c', TMPDIR => 1,
+         );
+         print $ch qq{#include <$_>\n} for @use_headers;
+         print $ch qq{int main(void) { return 0; }\n};
+@@ -262,7 +262,7 @@
+     # now do each library in turn with headers
+     my($ch, $cfile) = File::Temp::tempfile(
+-        'assertlibXXXXXXXX', SUFFIX => '.c'
++        'assertlibXXXXXXXX', SUFFIX => '.c', TMPDIR => 1,
+     );
+     print $ch qq{#include <$_>\n} foreach (@headers);
+     print $ch "int main(void) { ".($args{function} || 'return 0;')." }\n";
svn-ports-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 15 Jun Kuriyama freebsd_committer 2013-01-12 03:09:07 UTC
State Changed
From-To: feedback->closed

Patch committed.  Please try again.