NetBSD Problem Report #57658

From www@netbsd.org  Sun Oct 15 03:14:24 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E7E491A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Oct 2023 03:14:23 +0000 (UTC)
Message-Id: <20231015031422.537D31A923A@mollari.NetBSD.org>
Date: Sun, 15 Oct 2023 03:14:22 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/binutils not sure if include/ansidecl.h should be installed
X-Send-Pr-Version: www-1.0

>Number:         57658
>Category:       pkg
>Synopsis:       devel/binutils not sure if include/ansidecl.h should be installed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 15 03:15:00 +0000 2023
>Last-Modified:  Sun Oct 15 12:50:01 +0000 2023
>Originator:     David Shao
>Release:        pkgsrc current
>Organization:
>Environment:
NetBSD xxxxx@xxx 10.99.10 NetBSD 10.99.10 (GENERIC) #1: Wed Oct 11 03:08:23 PDT 2023  xxxxx@xxx:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
devel/binutils installs into $PREFIX include/ansidecl.h.  I have my doubts this is a good idea.

For example, building say lang/gcc10, it has its own ansidecl.h, and say the file

gcc-10.5.0/libiberty/objalloc.c

has a line

#include "ansidecl.h"

Unfortunately, gcc10's own ansidecl.h

gcc-10.5.0/include/ansidecl.h

is not the same as binutil's.  In particular, gcc10 defines PTR.

I actually had a reason to do this on DragonFly, but suppose one adds a single line

.include "../../devel/binutils/buildlink3.mk"

to lang/gcc10's Makefile.common.

The compilation will fail with

../../gcc-10.5.0/libiberty/objalloc.c: In function 'objalloc_create':
../../gcc-10.5.0/libiberty/objalloc.c:95:18: error: 'PTR' undeclared (first use in this function)
   95 |   ret->chunks = (PTR) malloc (CHUNK_SIZE);
      |                  ^~~
../../gcc-10.5.0/libiberty/objalloc.c:95:18: note: each undeclared identifier is reported only once for each function it appears in
../../gcc-10.5.0/libiberty/objalloc.c:95:22: error: expected ';' before 'malloc'
   95 |   ret->chunks = (PTR) malloc (CHUNK_SIZE);

What the single line 

.include "../../devel/binutils/buildlink3.mk"

does among other things is add to work/.buildlink/include

ansidecl.h -> /usr/pkg/include/ansidecl.h

The installation of ansidecl.h into /usr/pkg/include by binutils therefore seems to create a potential conflict in such situation.


>How-To-Repeat:

>Fix:
Ravenports removes ansidecl.h from STAGEDIR so that it does not get installed at all.  I don't have the impression Linux From Scratch installs this file either.

>Audit-Trail:
From: Jonathan Perkin <jperkin@mnx.io>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/57658: devel/binutils not sure if include/ansidecl.h should
 be installed
Date: Sun, 15 Oct 2023 13:45:42 +0100

 This is why I switched binutils to use DEPENDS instead of buildlink3 in 
 the versions of GCC that I use.  This should probably be replicated to 
 the other versions too (I don't use them so can't verify).

 -- 
 Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
 Open Source Complete Cloud   www.tritondatacenter.com

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.