NetBSD Problem Report #53002

From triaxx@mail.triaxx.org  Sat Feb 10 11:40:22 2018
Return-Path: <triaxx@mail.triaxx.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 64C697A1B7
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Feb 2018 11:40:22 +0000 (UTC)
Message-Id: <20180210114025.CDE06D2FCC@mail.triaxx.org>
Date: Sat, 10 Feb 2018 12:40:25 +0100 (CET)
From: triaxx@NetBSD.org
Reply-To: triaxx@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: net/vsftpd does not compile with clang due to -idirafter
X-Send-Pr-Version: 3.95

>Number:         53002
>Category:       pkg
>Synopsis:       net/vsftpd does not compile with clang due to -idirafter
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 10 11:45:00 +0000 2018
>Last-Modified:  Sat Feb 10 12:00:59 +0000 2018
>Originator:     Frédéric Fauberteau
>Release:        FreeBSD 11.1-RELEASE-p4
>Organization:

>Environment:


System: FreeBSD defiler.triaxx.org 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
Architecture: x86_64
Machine: amd64
>Description:
When compiling net/vsftpd with clang, the following error occurs:

clang -c sysdeputil.c -O2 -DPKG_SYSCONFDIR="\"/zp0/pkg/etc/vsftpd\"" -I/zp0/pkg/include -I/usr/include -idirafter dummyinc                                                                                                                                                       
sysdeputil.c:616:3: error: use of undeclared identifier 'cap_t'                                                                                                                                                                                                                  
cap_t current_caps = cap_get_proc();                                                                                                                                                                                                                                           
^                                                                                                                                                                                                                                                                              
sysdeputil.c:617:3: warning: implicit declaration of function 'cap_free' is invalid in C99 [-Wimplicit-function-declaration]                                                                                                                                                     
cap_free(current_caps);

[...]

sysdeputil.c:640:30: error: use of undeclared identifier 'CAP_EFFECTIVE'
    cap_set_flag(adopt_caps, CAP_EFFECTIVE, 1, &cap_value, CAP_SET);
                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
*** [sysdeputil.o] Error code 1

bmake: stopped in /zp0/pkgsrc/net/vsftpd/work/vsftpd-2.3.4
1 error

bmake: stopped in /zp0/pkgsrc/net/vsftpd/work/vsftpd-2.3.4
*** Error code 2

Stop.
bmake[1]: stopped in /zp0/pkgsrc/net/vsftpd
*** Error code 1

Stop.
bmake: stopped in /zp0/pkgsrc/net/vsftpd

After checking, it appears that -idirafter does not correctly include sys/capability.h from dummyinc directory.
It works fine for gcc.
I did not perform more investigation for clang...
>How-To-Repeat:
bmake build
>Fix:
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/net/vsftpd/Makefile,v
retrieving revision 1.43
diff -u -r1.43 Makefile
--- Makefile	12 Apr 2016 08:07:50 -0000	1.43
+++ Makefile	10 Feb 2018 11:24:37 -0000
@@ -44,6 +44,13 @@
 SUBST_FILES.dirfd=	port/solaris_bogons.h
 SUBST_SED.dirfd=	-e '/dirfd_extras/d'
 .endif
+.if ${OPSYS} == "FreeBSD"
+SUBST_CLASSES+=		idirafter
+SUBST_MESSAGE.idirafter=Fix buggy -idirafter for clang
+SUBST_STAGE.idirafter=	pre-build
+SUBST_FILES.idirafter=	Makefile
+SUBST_SED.idirafter=	-e 's,-idirafter ,-I,'
+.endif

 VSFTPD_USER?=	vsftpd
 VSFTPD_GROUP?=	vsftpd

>Release-Note:

>Audit-Trail:

>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.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.