NetBSD Problem Report #46478

From www@NetBSD.org  Thu May 24 07:21:37 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 1A0B663B88D
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 24 May 2012 07:21:37 +0000 (UTC)
Message-Id: <20120524072136.68BBA63B882@www.NetBSD.org>
Date: Thu, 24 May 2012 07:21:36 +0000 (UTC)
From: joern.clausen@uni-bielefeld.de
Reply-To: joern.clausen@uni-bielefeld.de
To: gnats-bugs@NetBSD.org
Subject: www/curl does not compile on Solaris/sparc with compiler not configured with devel/libelf
X-Send-Pr-Version: www-1.0

>Number:         46478
>Category:       pkg
>Synopsis:       www/curl does not compile on Solaris/sparc with compiler not configured with devel/libelf
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    drochner
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 24 07:25:00 +0000 2012
>Last-Modified:  Tue Jun 26 18:30:02 +0000 2012
>Originator:     Jörn Clausen
>Release:        
>Organization:
University of Bielefeld
>Environment:
>Description:
See http://mail-index.netbsd.org/tech-pkg/2012/05/10/msg009131.html for a short discussion, without a conclusion, though.

Compiling www/curl on Solaris/sparc with a standalone GCC 4.7.0 using native ld and as, configure fails here:

checking for OpenSSL headers version... 0.9.8 - 0x0090818fL
checking for OpenSSL library version... unknown
checking for OpenSSL headers and library versions matching... fail

The actual error from config.log is

configure:20915: gcc -o conftest -O -I/usr/pkgsrc/20120411/include -g0 -Wno-system-headers -I/usr/pkgsrc/20120411/include -I/usr/pkg
src/20120411/include   -L/usr/pkgsrc/20120411/lib -Wl,-R/usr/pkgsrc/20120411/lib -L/usr/pkgsrc/20120411/lib   conftest.c -lssl -lcry
pto -lrt -lsocket  -lnsl -lssl -lcrypto -lsocket -lnsl -ldl   >&5
ld: fatal: file /var/tmp//ccMkGiq4.o: unknown file type
ld: fatal: File processing errors. No output written to conftest

After removing devel/libelf, which was installed only as dependency of devel/glib2, the problem is gone. NB that this problem does not occur on Solaris/i86 with exactly the same setup.
>How-To-Repeat:

>Fix:
either fix www/curl of remove dependency of glib2 on devel/libelf

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Thu, 24 May 2012 18:39:43 +0000

 On Thu, May 24, 2012 at 07:25:00AM +0000, joern.clausen@uni-bielefeld.de wrote:
  > The actual error from config.log is
  > 
  > configure:20915: gcc -o conftest -O -I/usr/pkgsrc/20120411/include -g0 -Wno-system-headers -I/usr/pkgsrc/20120411/include -I/usr/pkg
  > src/20120411/include   -L/usr/pkgsrc/20120411/lib -Wl,-R/usr/pkgsrc/20120411/lib -L/usr/pkgsrc/20120411/lib   conftest.c -lssl -lcry
  > pto -lrt -lsocket  -lnsl -lssl -lcrypto -lsocket -lnsl -ldl   >&5
  > ld: fatal: file /var/tmp//ccMkGiq4.o: unknown file type
  > ld: fatal: File processing errors. No output written to conftest
  > 
  > After removing devel/libelf, which was installed only as dependency
  > of devel/glib2, the problem is gone. NB that this problem does not
  > occur on Solaris/i86 with exactly the same setup.

 Do you have any idea how libelf is affecting gcc and/or native ld?
 That in theory at least shouldn't happen...

 -- 
 David A. Holland
 dholland@netbsd.org

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: David Holland <dholland-pbugs@NetBSD.org>, pkg-manager@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Fri, 25 May 2012 08:53:41 +0200

 >   Do you have any idea how libelf is affecting gcc and/or native ld?
 >   That in theory at least shouldn't happen...

 No. Unfortunately, the generated object file is deleted immediately, so 
 I have no chance to analyze it. I've already extracted the code fragment 
 from the configure script, but I can't remember if I was even able to 
 reproduce the error. I'll try to dig a little bit deeper into the GCC 
 tool chain and catch the file.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Fri, 25 May 2012 08:15:08 +0000

 On Fri, May 25, 2012 at 06:55:02AM +0000, J?rn Clausen wrote:
  >  >   Do you have any idea how libelf is affecting gcc and/or native ld?
  >  >   That in theory at least shouldn't happen...
  >  
  >  No. Unfortunately, the generated object file is deleted immediately, so 
  >  I have no chance to analyze it. I've already extracted the code fragment 
  >  from the configure script, but I can't remember if I was even able to 
  >  reproduce the error. I'll try to dig a little bit deeper into the GCC 
  >  tool chain and catch the file.

 Blah, that's a mess...

 possible theory: is one or more of the tools linked against a base
 system libelf, such that if pkgsrc's libelf is installed it ends up
 using that at runtime instead? If so, that could certainly explain it
 not working.

 If not, I really have no idea...

 -- 
 David A. Holland
 dholland@netbsd.org

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: David Holland <dholland-pbugs@NetBSD.org>, pkg-manager@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Fri, 25 May 2012 10:37:45 +0200

 >   possible theory: is one or more of the tools linked against a base
 >   system libelf, such that if pkgsrc's libelf is installed it ends up
 >   using that at runtime instead? If so, that could certainly explain it
 >   not working.

 Oh, that's definitely the case. I did a complete build under "truss -f" 
 and the libelf from pkgsrc was used instead of the native one. That gave 
 me the idea to check what happens if I remove devel/libelf. As I use 
 native ld/as and not devel/binutils, I don't really need/want pkgsrc's 
 libelf.

 But I don't understand why this a) does not fail on Solaris/i86 and b) 
 fails only with this test. I have built hundreds of other packages after 
 devel/libelf were installed, and of course that version of libelf was 
 used there as well.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@NetBSD.org, gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Fri, 01 Jun 2012 16:16:38 +0200

 I did some more tests, finally:

 I can compile the test from the configure script stand alone without 
 problems. If I truss the complete compile run, I see that the system 
 libelf is used twice:

 20943:  open("/lib/libelf.so", O_RDONLY)                = 4
 ...
 20947:  open("/lib/libelf.so.1", O_RDONLY)              = 3

 The first process is the assembler (/usr/ccs/bin/as), the second one the 
 linker (/usr/ccs/bin/ld). When I repeat this with LD_LIBRARY_PATH set to 
 pkgsrc's library directory, this happens:

 20856:  open("/usr/pkgsrc/20120411/lib/libelf.so", O_RDONLY) = 4
 ...
 20860:  open("/lib/libelf.so.1", O_RDONLY)              = 3

 I.e. the assembler uses pkgsrc's libelf, the linker still the native 
 one. Apart from the fact, that ELF should be ELF and the code generated 
 with one libelf should probably still be readable by the other, this 
 seems to be root of the problem.

 Note that the assembler uses the library without version number, the 
 linker requests a specific version of the library. Note further, that 
 pkgsrc's libelf only provides the suffixes .0 and .0.0.0.

 So, why is this only a problem on sparc but not on i86? It turns out, 
 that the assembler on i86 does not read libelf at all, so it can't 
 switch between the native and the pkgsrc version.

 One workaround might be to add a symlink libelf.so.1 pointing to 
 pkgsrc's version of libelf, so that one is always used. But maybe 
 someone has a better idea.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Sun, 24 Jun 2012 20:55:35 +0000

 On Fri, Jun 01, 2012 at 02:20:06PM +0000, J?rn Clausen wrote:
  >  I can compile the test from the configure script stand alone without 
  >  problems. If I truss the complete compile run, I see that the system 
  >  libelf is used twice:
  >  
  >  20943:  open("/lib/libelf.so", O_RDONLY)                = 4
  >  ...
  >  20947:  open("/lib/libelf.so.1", O_RDONLY)              = 3
  >  
  >  The first process is the assembler (/usr/ccs/bin/as), the second one the 
  >  linker (/usr/ccs/bin/ld). When I repeat this with LD_LIBRARY_PATH set to 
  >  pkgsrc's library directory, this happens:
  >  
  >  20856:  open("/usr/pkgsrc/20120411/lib/libelf.so", O_RDONLY) = 4
  >  ...
  >  20860:  open("/lib/libelf.so.1", O_RDONLY)              = 3
  >  
  >  I.e. the assembler uses pkgsrc's libelf, the linker still the native 
  >  one. Apart from the fact, that ELF should be ELF and the code generated 
  >  with one libelf should probably still be readable by the other, this 
  >  seems to be root of the problem.

 The two copies of libelf may not be entirely compatible though. One
 would hardly expect them to be, especially since one was shipped by
 Sun using who knows what sources of who knows what antiquity.

  >  Note that the assembler uses the library without version number, the 
  >  linker requests a specific version of the library. Note further, that 
  >  pkgsrc's libelf only provides the suffixes .0 and .0.0.0.
  >  
  >  So, why is this only a problem on sparc but not on i86? It turns out, 
  >  that the assembler on i86 does not read libelf at all, so it can't 
  >  switch between the native and the pkgsrc version.
  >  
  >  One workaround might be to add a symlink libelf.so.1 pointing to 
  >  pkgsrc's version of libelf, so that one is always used. But maybe 
  >  someone has a better idea.

 Sun's assembler needs to be using only Sun's libelf. Otherwise the
 behavior of the assembler is undefined. It is a bug in the assembler
 that it will randomly pick up some other libelf (not even of the right
 soname) but that is after all the sort of quality one expects from Sun
 userlands.

 The right fix, I think, is to make sure the assembler doesn't see the
 pkgsrc libelf. As long as it's being run via the pkgsrc tool wrappers,
 it should be possible to arrange this; either making sure
 LD_LIBRARY_PATH is set to a known value, or using LD_PRELOAD to load
 the correct libelf explicitly, should do the trick. I don't know
 offhand how to arrange either of these things, but I'm sure it can be
 figured out.

 -- 
 David A. Holland
 dholland@netbsd.org

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: David Holland <dholland-pbugs@NetBSD.org>, pkg-manager@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Mon, 25 Jun 2012 09:18:10 +0200

 On 24.06.12 23:00, David Holland wrote:
 >   The two copies of libelf may not be entirely compatible though. One
 >   would hardly expect them to be, especially since one was shipped by
 >   Sun using who knows what sources of who knows what antiquity.

 It's the system's libelf, and that should be good enough. Obviously they 
 are not compatible, and replacing the native one with a 
 who-knows-where-it-came-from version is not a good idea either.

 >   Sun's assembler needs to be using only Sun's libelf. Otherwise the
 >   behavior of the assembler is undefined. It is a bug in the assembler
 >   that it will randomly pick up some other libelf (not even of the right
 >   soname) but that is after all the sort of quality one expects from Sun
 >   userlands.

 Please keep any religious issues you might have out of this discussion.

 Yes, Solaris assembler has a bug, which has been reported and will 
 probably get fixed. I don't expect the fix to be backported to Solaris 
 10, though.

 >   The right fix, I think, is to make sure the assembler doesn't see the
 >   pkgsrc libelf.

 The right solution is not to use devel/libelf on Solaris at all. The 
 *only* binary, that actually uses that libelf instead of the native one 
 is "gresource" from devel/glib2. And that binary segfaults both on sparc 
 and i86. And looking at the README of devel/libelf, I don't think that 
 that library is able to fix the problem with the native libelf (large 
 file support) in the first place. Please remove the dependency of 
 devel/glib2 on devel/libelf and revert to the old workaround.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46478: www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf
Date: Mon, 25 Jun 2012 20:15:12 +0000

 On Mon, Jun 25, 2012 at 07:20:04AM +0000, J?rn Clausen wrote:
  >  Please keep any religious issues you might have out of this discussion.

 Excuse me?

 -- 
 David A. Holland
 dholland@netbsd.org

Responsible-Changed-From-To: pkg-manager->drochner
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 25 Jun 2012 21:15:03 +0000
Responsible-Changed-Why:
Can you please take a look if we can get rid of the libelf dependency in glib2?


From: "Matthias Drochner" <drochner@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46478 CVS commit: pkgsrc/devel/glib2
Date: Tue, 26 Jun 2012 18:21:25 +0000

 Module Name:	pkgsrc
 Committed By:	drochner
 Date:		Tue Jun 26 18:21:25 UTC 2012

 Modified Files:
 	pkgsrc/devel/glib2: Makefile

 Log Message:
 don't pull in libelf on SunOS, to fix build problems (PR pkg/46478)
 This is a poor fix for an apparently not well understood problem, so
 we should consider it a stopgap fix and find a sustainable solution
 after the freeze.


 To generate a diff of this commit:
 cvs rdiff -u -r1.205 -r1.206 pkgsrc/devel/glib2/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: <gnats-bugs@NetBSD.org>
Cc: <wiz@NetBSD.org>, <drochner@NetBSD.org>, <pkg-manager@netbsd.org>,
	<pkgsrc-bugs@netbsd.org>, <gnats-admin@netbsd.org>,
	<joern.clausen@uni-bielefeld.de>
Subject: Re: pkg/46478 (www/curl does not compile on Solaris/sparc with
 compiler not configured with devel/libelf)
Date: Tue, 26 Jun 2012 20:25:08 +0200

 On Mon, 25 Jun 2012 21:15:05 +0000
 <wiz@NetBSD.org> wrote:
 > Can you please take a look if we can get rid of the libelf dependency
 > in glib2?

 OK, I've killed the dependency for SunOS. Don't know whether the
 builtin libelf will be picked up or not... NetBSD-current also
 has a crippled or incompatible libelf in its base system, it
 causes the build to fail if not overridden by pkgsrc libelf.


 ---------------------------------------------------------------------------=
 ---------------------
 ---------------------------------------------------------------------------=
 ---------------------
 Forschungszentrum Juelich GmbH
 52425 Juelich
 Sitz der Gesellschaft: Juelich
 Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
 Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
 Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
 Prof. Dr. Sebastian M. Schmidt
 ---------------------------------------------------------------------------=
 ---------------------
 ---------------------------------------------------------------------------=
 ---------------------

 Kennen Sie schon unseren neuen Film? http://www.fz-juelich.de/film
 Kennen Sie schon unsere app? http://www.fz-juelich.de/app

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.