You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Jared Rhine <ja...@wordzoo.com> on 2005/07/22 23:39:25 UTC

Dual expat link failure

[Apologies if this is a duplicate; I did not see it make it into the
archives.]

I'm building a new mod_perl2 instance on a new Solaris 10/x86 box.
I'm using gmake and most of the /usr/ccs/bin tools (ar, ld).

A fresh compile to empty directories fails to link libapreq2-2.06-dev
with the following error:

-- begin --

gcc -g -O2 -o .libs/test_cgi test_cgi.o
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/.libs/libapreq2.so
/usr/local/apache-inst-01/lib/libexpat.so -lgdbm -ldb -lexpat -liconv
/usr/local/apache-inst-01/lib/libapr-0.so -lsendfile -lrt -lm -lsocket
-lnsl -lresolv -lpthread /usr/local/apache-inst-01/lib/libaprutil-0.so
-R/usr/local/apache-inst-01/lib

ld: fatal: recording name conflict: file
`/usr/local/apache-inst-01/lib/libexpat.so' and file
`/opt/csw/lib/libexpat.so' provide identical dependency names:
libexpat.so.0 (possible multiple inclusion of the same file) ld:
fatal: File processing errors. No output written to .libs/test_cgi

-- end --

Like everyone, I hate mysterious link problems because they are
generally "user error".  But I'm not sure what I'm doing wrong, or at
least I'm doing the best job I can at using standard procedures on a
Solaris box.

/opt/csw/lib is a just a set of precompiled packages for Solaris
(www.blastwave.org) which install completely into --prefix /opt/csw.
I have no LD_LIBRARY_PATH or LD_RUN_PATH set and no other environment
variables which point there.

I tried lots of permutations of various tools and such, but the
most simple test case (from the following script) seems to provoke the
same behavior.

The resulting apache works fine; just can't get libapreq2 to compile.

Probably user error, but I'm soliciting advice.  If there's anything
libapreq2 should be doing during the build to avoid this situation,
that'd be great too.

Hopefully I can still do mod_perl1 on this box if I can't get around this.

Thanks.

-- begin --

#!/usr/bin/perl

use strict;
use warnings;

my $verbose = 1;

sub run ($);

$ENV{PATH} = '/usr/local/bin:/opt/csw/gcc3/bin:/opt/csw/bin:/usr/bin:/bin:/usr/ccs/bin';

my $prefix = '/usr/local/apache-inst-01';
my $build = '/var/tmp/apache-inst-01-build';
my $archive = '/var/tmp/pkg-archive';
my $apache_url = 'http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz';
my $libapreq_url = 'http://www.apache.org/dist/httpd/libapreq/libapreq2-2.06-dev.tar.gz';

my ($apache, $libapreq) = map { m{/([^/]+)\.tar\.gz$} } ($apache_url, $libapreq_url);

run "rm -rf $build $prefix";
run "mkdir -p $build $prefix";
run "cp $archive/$apache.tar.gz $build 2> /dev/null; true";
run "cp $archive/$libapreq.tar.gz $build 2> /dev/null; true";
run "cd $build && test -r $apache.tar.gz || wget $apache_url";
run "cd $build && test -r $libapreq.tar.gz || wget $libapreq_url";
run "cd $build && gtar zxf $apache.tar.gz";
run "cd $build && gtar zxf $libapreq.tar.gz";

run "cd $build/$apache && ./configure --prefix=$prefix --enable-logio --enable-proxy --enable-modules=all --enable-mods-shared=all";
run "cd $build/$apache && gmake";
run "cd $build/$apache && gmake install";

run "cd $build/$libapreq && perl Makefile.PL --with-apache2-apxs=$prefix/bin/apxs";
run "cd $build/$libapreq && gmake";
run "cd $build/$libapreq && gmake install";

exit;

sub run ($) {
    my $cmd = shift;
    print "[$cmd]\n" if $verbose;
    my $rv = system $cmd;
    die "exiting - command failure\n" if $rv;
}

-- end --

Here's just a couple of snippets from the build with maybe-relevant info:

-- begin --

[...]
checking for Expat in /usr... no
checking for Expat in /usr/local... no
checking for Expat in xml/expat-cvs... no
checking for Expat in xml/expat... yes
configuring package in xml/expat now
[...]
config.status: creating lib/expat.h
config.status: creating config.h
xml/expat configured properly
  adding "/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/xml/expat/lib/libexpat.la" to APRUTIL_EXPORT_LIBS
  setting APRUTIL_INCLUDES to "-I/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/xml/expat/lib"
  setting APRUTIL_LDFLAGS to "-L/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/xml/expat/lib"
  adding "/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/xml/expat/lib/libexpat.la" to APRUTIL_LIBS
[...]
srclib/apr-util configured properly
  adding "-L/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/xml/expat/lib" to LDFLAGS
  adding "-I/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/include" to INCLUDES
  adding "-I/var/tmp/apache-inst-01-build/httpd-2.0.54/srclib/apr-util/xml/expat/lib" to INCLUDES
[...]
gcc -shared -Wl,-h -Wl,libapreq2.so.2 -o .libs/libapreq2.so.2.1.3  .libs/util.o .libs/version.o .libs/cookie.o .libs/param.o .libs/parser.o .libs/parser_urlencoded.o .libs/parser_header.o .libs/parser_multipart.o .libs/module.o .libs/module_custom.o .libs/module_cgi.o .libs/error.o  -R/usr/local/apache-inst-01/lib -R/usr/local/apache-inst-01/lib /usr/local/apache-inst-01/lib/libapr-0.so /usr/local/apache-inst-01/lib/libaprutil-0.so -lgdbm -ldb /usr/local/apache-inst-01/lib/libexpat.so -liconv -lsendfile -lrt -lm -lsocket -lnsl -lresolv -lpthread -lc [...from Jared: successfully compiled...]
[...]

-- end --

-- jared@wordzoo.com

"Tiger gotta hunt.  Bird gotta fly.
 Man gotta sit and wonder why, why, why.
 Tiger gotta sleep.  Bird gotta land.
 Man gotta tell himself he understand." -- Kurt Vonnegut Jr.

Dual expat link failure

Posted by Jared Rhine <ja...@wordzoo.com>.
[Joe == joe+gmane@sunstarsys.com on Fri, 22 Jul 2005 18:47:42 -0400]

  Joe> Jared Rhine <ja...@wordzoo.com> writes:
  >> gcc -g -O2 -o .libs/test_cgi test_cgi.o
  >> /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/.libs/libapreq2.so
  >> /usr/local/apache-inst-01/lib/libexpat.so -lgdbm -ldb -lexpat
  >> -liconv /usr/local/apache-inst-01/lib/libapr-0.so -lsendfile -lrt
  >> -lm -lsocket -lnsl -lresolv -lpthread
  >> /usr/local/apache-inst-01/lib/libaprutil-0.so
  >> -R/usr/local/apache-inst-01/lib
  >>
  >> ld: fatal: recording name conflict: file
  >> `/usr/local/apache-inst-01/lib/libexpat.so' and file
  >> `/opt/csw/lib/libexpat.so' provide identical dependency names:
  >> libexpat.so.0 (possible multiple inclusion of the same file) ld:
  >> fatal: File processing errors. No output written to
  >> .libs/test_cgi

Thanks for the response, Joe.  Results of your two suggestions follows:

  Joe> Looks like a bug in some config script.  What's the output of
  Joe>     /usr/local/apache-inst-01/bin/apu-config --link-libtool --libs

# /usr/local/apache-inst-01/bin/apu-config --link-libtool --libs
/usr/local/apache-inst-01/lib/libaprutil-0.la -lgdbm -ldb -lexpat -liconv

After applying your patch to both module/Makefile.{in,am}, the gcc
line and the error has changed, but only in the order (!):

-- begin before the patch --

gcc -g -O2 -o .libs/test_cgi test_cgi.o /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/.libs/libapreq2.so /usr/local/apache-inst-01/lib/libexpat.so -lgdbm -ldb -lexpat -liconv /usr/local/apache-inst-01/lib/libapr-0.so -lsendfile -lrt -lm -lsocket -lnsl -lresolv -lpthread /usr/local/apache-inst-01/lib/libaprutil-0.so -R/usr/local/apache-inst-01/lib

ld: fatal: recording name conflict: file `/usr/local/apache-inst-01/lib/libexpat.so' and file `/opt/csw/lib/libexpat.so' provide identical dependency names: libexpat.so.0 (possible multiple inclusion of the same file)

# grep test_cgi_LDFLAGS /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.{in,am}
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.in:test_cgi_LDFLAGS = `@APREQ_CONFIG@ --link-libtool --libs` @APR_LTFLAGS@
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.in: $(LINK) $(test_cgi_LDFLAGS) $(test_cgi_OBJECTS) $(test_cgi_LDADD) $(LIBS)
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.am:test_cgi_LDFLAGS =  `@APREQ_CONFIG@ --link-libtool --libs` @APR_LTFLAGS@

-- end --

-- begin after the patch --

gcc -g -O2 -o .libs/test_cgi test_cgi.o /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/.libs/libapreq2.so -lexpat /usr/local/apache-inst-01/lib/libapr-0.so /usr/local/apache-inst-01/lib/libaprutil-0.so -lgdbm -ldb /usr/local/apache-inst-01/lib/libexpat.so -liconv -lsendfile -lrt -lm -lsocket -lnsl -lresolv -lpthread -R/usr/local/apache-inst-01/lib

ld: fatal: recording name conflict: file `/opt/csw/lib/libexpat.so' and file `/usr/local/apache-inst-01/lib/libexpat.so' provide identical dependency names: libexpat.so.0  (possible multiple inclusion of the same file)

root@g1monitor2 # grep test_cgi_LDFLAGS /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/{Makefile,Makefile.{in,am}}
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile:test_cgi_LDFLAGS = `/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/apreq2-config --link-libtool`
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile:       $(LINK) $(test_cgi_LDFLAGS) $(test_cgi_OBJECTS) $(test_cgi_LDADD) $(LIBS)
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.in:test_cgi_LDFLAGS = `@APREQ_CONFIG@ --link-libtool`
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.in:    $(LINK) $(test_cgi_LDFLAGS) $(test_cgi_OBJECTS) $(test_cgi_LDADD) $(LIBS)
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile.am:test_cgi_LDFLAGS = `@APREQ_CONFIG@ --link-libtool`

# /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/apreq2-config --link-libtool
/var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/libapreq2.la

-- end after --

These tests are still fully scripted, so there's an rm -rf every time.

PS. The test_cgi_LDFLAGS entry in module/Makefile.am has an extra
space after the equals sign.

PPS. One other note:

-- begin --

root@g1monitor2 # grep noinst_PROGRAMS /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/module/Makefile
noinst_PROGRAMS = test_cgi
noinst_PROGRAMS = test_cgi$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
        @list='$(noinst_PROGRAMS)'; for p in $$list; do \

-- end --

noinst_PROGRAMS has two entries in the Makefile?  Harmless, probably?

-- jared@wordzoo.com

"We suffer primarily not from our vices or our weaknesses, but from our
 illusions.  We are haunted, not by reality, but by those images we have put
 in place of reality." - Daniel J. Boorstin

Re: Dual expat link failure

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Joe Schaefer <jo...@sunstarsys.com> writes:

> Jared Rhine <ja...@wordzoo.com> writes:
>
>> gcc -g -O2 -o .libs/test_cgi test_cgi.o
>> /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/.libs/libapreq2.so
>> /usr/local/apache-inst-01/lib/libexpat.so -lgdbm -ldb -lexpat -liconv
>> /usr/local/apache-inst-01/lib/libapr-0.so -lsendfile -lrt -lm -lsocket
>> -lnsl -lresolv -lpthread /usr/local/apache-inst-01/lib/libaprutil-0.so
>> -R/usr/local/apache-inst-01/lib
>>
>> ld: fatal: recording name conflict: file
>> `/usr/local/apache-inst-01/lib/libexpat.so' and file
>> `/opt/csw/lib/libexpat.so' provide identical dependency names:
>> libexpat.so.0 (possible multiple inclusion of the same file) ld:
>> fatal: File processing errors. No output written to .libs/test_cgi
>
>
> Looks like a bug in some config script.  What's the output of
>
>     /usr/local/apache-inst-01/bin/apu-config --link-libtool --libs
> ?

Also take a look at this patch (from the module/ dir), 
which removes some weird linker flags LDFLAGS.  
If you also apply this change to your for Makefile.in, 
see if the extra -lexpat flag goes away.

Index: Makefile.am
===================================================================
--- Makefile.am	(revision 219832)
+++ Makefile.am	(working copy)
@@ -4,7 +4,7 @@
 EXTRA_DIST = t apache
 
 noinst_PROGRAMS = test_cgi
-test_cgi_LDFLAGS =  `@APREQ_CONFIG@ --link-libtool --libs` @APR_LTFLAGS@
+test_cgi_LDFLAGS =  `@APREQ_CONFIG@ --link-libtool`
 
 run_tests : t/TEST
 	-cp -f test_cgi t/cgi-bin

-- 
Joe Schaefer


Re: Dual expat link failure

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Jared Rhine <ja...@wordzoo.com> writes:

> gcc -g -O2 -o .libs/test_cgi test_cgi.o
> /var/tmp/apache-inst-01-build/libapreq2-2.06-dev/library/.libs/libapreq2.so
> /usr/local/apache-inst-01/lib/libexpat.so -lgdbm -ldb -lexpat -liconv
> /usr/local/apache-inst-01/lib/libapr-0.so -lsendfile -lrt -lm -lsocket
> -lnsl -lresolv -lpthread /usr/local/apache-inst-01/lib/libaprutil-0.so
> -R/usr/local/apache-inst-01/lib
>
> ld: fatal: recording name conflict: file
> `/usr/local/apache-inst-01/lib/libexpat.so' and file
> `/opt/csw/lib/libexpat.so' provide identical dependency names:
> libexpat.so.0 (possible multiple inclusion of the same file) ld:
> fatal: File processing errors. No output written to .libs/test_cgi


Looks like a bug in some config script.  What's the output of

    /usr/local/apache-inst-01/bin/apu-config --link-libtool --libs
?

-- 
Joe Schaefer