NetBSD Problem Report #50173

From www@NetBSD.org  Wed Aug 26 07:09:11 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E5E8DA65B8
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 26 Aug 2015 07:09:10 +0000 (UTC)
Message-Id: <20150826070909.B5D47A65BB@mollari.NetBSD.org>
Date: Wed, 26 Aug 2015 07:09:09 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/libelf BUILDLINK_INCDIRS.libelf?=	include/libelf
X-Send-Pr-Version: www-1.0

>Number:         50173
>Category:       pkg
>Synopsis:       devel/libelf BUILDLINK_INCDIRS.libelf?=	include/libelf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 26 07:10:00 +0000 2015
>Closed-Date:    
>Last-Modified:  Sun Dec 04 07:45:00 +0000 2016
>Originator:     David Shao
>Release:        pkgsrc current
>Organization:
>Environment:
DragonFly  4.3-DEVELOPMENT DragonFly v4.3.1.340.g01e30f-DEVELOPMENT #4: Tue Aug 25 14:11:21 PDT 2015     xxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64
>Description:
Similar to x11/libdrm, devel/libelf in its buildlink3.mk could use

BUILDLINK_INCDIRS.libelf?=	include/libelf

This problem was not seen in MesaLib until adding various options to build glamor etc. exposed a file that had an include of the form

#include <gelf>

  CC       radeon_elf_util.lo
radeon_elf_util.c:32:18: fatal error: gelf.h: No such file or directory
compilation terminated.



>How-To-Repeat:

>Fix:
diff -Nur libelf.orig/buildlink3.mk libelf/buildlink3.mk
--- libelf.orig/buildlink3.mk	2009-03-20 12:24:17.000000000 -0700
+++ libelf/buildlink3.mk	2015-08-25 23:01:18.938476000 -0700
@@ -7,6 +7,7 @@

 BUILDLINK_API_DEPENDS.libelf+=	libelf>=0.8.5
 BUILDLINK_PKGSRCDIR.libelf?=	../../devel/libelf
+BUILDLINK_INCDIRS.libelf?=	include/libelf
 .endif # LIBELF_BUILDLINK3_MK

 BUILDLINK_TREE+=	-libelf

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/50173: devel/libelf BUILDLINK_INCDIRS.libelf?=	include/libelf
Date: Sun, 6 Sep 2015 01:19:36 +0000

 On Wed, Aug 26, 2015 at 07:10:01AM +0000, davshao@gmail.com wrote:
  > Similar to x11/libdrm, devel/libelf in its buildlink3.mk could use
  > 
  > BUILDLINK_INCDIRS.libelf?=	include/libelf
  > 
  > This problem was not seen in MesaLib until adding various options
  > to build glamor etc. exposed a file that had an include of the form
  > 
  > #include <gelf>
  > 
  >   CC       radeon_elf_util.lo
  > radeon_elf_util.c:32:18: fatal error: gelf.h: No such file or directory
  > compilation terminated.

 Is this the officially intended API of the package, or should MesaLib
 be patched to use <libelf/gelf.h> instead?

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50173: devel/libelf BUILDLINK_INCDIRS.libelf?= include/libelf
Date: Sat, 5 Sep 2015 19:37:10 -0700

 On Sat, Sep 5, 2015 at 6:20 PM, David Holland <dholland-pbugs@netbsd.org> wrote:
 > The following reply was made to PR pkg/50173; it has been noted by GNATS.
 >
 > From: David Holland <dholland-pbugs@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: pkg/50173: devel/libelf BUILDLINK_INCDIRS.libelf?= include/libelf
 > Date: Sun, 6 Sep 2015 01:19:36 +0000
 >
 >  On Wed, Aug 26, 2015 at 07:10:01AM +0000, davshao@gmail.com wrote:
 >   > Similar to x11/libdrm, devel/libelf in its buildlink3.mk could use
 >   >
 >   > BUILDLINK_INCDIRS.libelf?=  include/libelf
 >   >
 >   > This problem was not seen in MesaLib until adding various options
 >   > to build glamor etc. exposed a file that had an include of the form
 >   >
 >   > #include <gelf>
 >   >
 >   >   CC       radeon_elf_util.lo
 >   > radeon_elf_util.c:32:18: fatal error: gelf.h: No such file or directory
 >   > compilation terminated.
 >
 >  Is this the officially intended API of the package, or should MesaLib
 >  be patched to use <libelf/gelf.h> instead?
 >
 >  --
 >  David A. Holland
 >  dholland@netbsd.org
 >

 From /usr/pkg/lib/pkgconfig/libelf.pc:

 prefix=/usr/pkg
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
 includedir=${prefix}/include

 Name: libelf
 Description: ELF object file access library
 Version: 0.8.13
 Requires:
 Conflicts:
 Libs: -Wl,-R${libdir} -L${libdir} -lelf
 Cflags: -I${includedir}/libelf -I${includedir}

 Therefore I conclude that the proper API indeed uses
 #include <gelf.h>

 Where MesaLib might need to be patched somewhere is that for libelf it
 is using a manually crafted test for libelf support in configure:

 if ${ac_cv_lib_elf_elf_memory+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lelf  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */

 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
 char elf_memory ();
 int
 main ()
 {
 return elf_memory ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_elf_elf_memory=yes
 else
   ac_cv_lib_elf_elf_memory=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_elf_elf_memory" >&5
 $as_echo "$ac_cv_lib_elf_elf_memory" >&6; }
 if test "x$ac_cv_lib_elf_elf_memory" = xyes; then :
   have_libelf=yes;ELF_LIB=-lelf
 fi

 But I do not know whether it is more accepted to search or not search
 for the pkg-config libelf.pc.

 The major customer of libelf, devel/glib2, already has a pkg-config
 check in configure:

 if test -n "$LIBELF_CFLAGS"; then
     pkg_cv_LIBELF_CFLAGS="$LIBELF_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists
 --print-errors \"libelf >= 0.8.12\""; } >&5
   ($PKG_CONFIG --exists --print-errors "libelf >= 0.8.12") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_LIBELF_CFLAGS=`$PKG_CONFIG --cflags "libelf >= 0.8.12" 2>/dev/null`
               test "x$?" != "x0" && pkg_failed=yes

From: "Tobias Nygren" <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50173 CVS commit: pkgsrc/graphics/MesaLib
Date: Sun, 13 Sep 2015 01:20:05 +0000

 Module Name:	pkgsrc
 Committed By:	tnn
 Date:		Sun Sep 13 01:20:05 UTC 2015

 Modified Files:
 	pkgsrc/graphics/MesaLib: options.mk

 Log Message:
 interim fix for PR pkg/50173 (devel/libelf include directory)
 XXX shouldn't devel/libelf in fact have a builtin.mk?


 To generate a diff of this commit:
 cvs rdiff -u -r1.36 -r1.37 pkgsrc/graphics/MesaLib/options.mk

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

State-Changed-From-To: open->feedback
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Mon, 28 Dec 2015 12:18:56 +0000
State-Changed-Why:
Can this be closed now?


From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50173: devel/libelf BUILDLINK_INCDIRS.libelf?= include/libelf
Date: Sat, 3 Dec 2016 23:44:57 -0800

 When I bmake configure for graphics/MesaLib and do:

 grep -R gelf .

 I still get:

 ./work/mesa-11.2.2/src/gallium/state_trackers/clover/llvm/invocation.cpp:#include
 <gelf.h>

 Is it correct that for graphics/MesaLib and that alone, there is the
 fix in its options.mk of:

 .include "../../devel/libelf/buildlink3.mk"
 CPPFLAGS+=        -I${BUILDLINK_PREFIX.libelf}/include/libelf

 I just don't see what the problem is with altering libelf's
 buildlink3.mk to actually reflect what its pkgconf *.pc file also
 claims to be the correct include path.

 It astounds me how hard the work is to NOT make things work out of the
 box.  Can't use the pkgconf *.pc whose very purpose is to tell other
 packages where to find stuff.  Can't alter the buildlink3.mk to
 reflect what the *.pc file says.

>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.