NetBSD Problem Report #54497

From www@netbsd.org  Wed Aug 28 08:29:17 2019
Return-Path: <www@netbsd.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 DA1967A1D3
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 28 Aug 2019 08:29:17 +0000 (UTC)
Message-Id: <20190828082916.D8AF97A1DD@mollari.NetBSD.org>
Date: Wed, 28 Aug 2019 08:29:16 +0000 (UTC)
From: clement.bouvier.europe@gmail.com
Reply-To: clement.bouvier.europe@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/devIL does not build on macos
X-Send-Pr-Version: www-1.0

>Number:         54497
>Category:       pkg
>Synopsis:       devel/devIL does not build on macos
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    macos-pkg-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 28 08:30:00 +0000 2019
>Closed-Date:    Wed Aug 28 13:12:49 +0000 2019
>Last-Modified:  Wed Aug 28 13:15:00 +0000 2019
>Originator:     clement bouvier
>Release:        current
>Organization:
>Environment:
macOS mojave 10.14.6
>Description:
devez/devIL does not build on macos ; malloc.h header is not found.

clang -DHAVE_CONFIG_H -I. -I../include/IL  -I ./../include -I/Users/cbouvier/pkg/include  -O2 -pipe -I/Users/cbouvier/pkg/include -MT ilur.o -MD -MP -MF .deps/ilur.Tpo -c -o ilur.o `test -f '../src-ILU/ilur/ilur.c' || echo './'`../src-ILU/ilur/ilur.c
../src-ILU/ilur/ilur.c:3:10: fatal error: 'malloc.h' file not found
>How-To-Repeat:
build devel/devIL on macosx
>Fix:
It exists the header malloc.h on macOS but it is localized at malloc/malloc.h.
However, if used <malloc/malloc.h> the compiler emits warnings like:

 warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Wimplicit-function-declaration]
        Params * ret_val = (Params *)malloc(sizeof(Params));

warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
                free(to_destroy->Calls_strings[i]);

in the file src-ILU/blur/ilur.c to the project.

Indeed on apple system, malloc and free do not have any declaration in malloc/malloc.h.

The better solution (and probably the more portable) is directly to use stdlib.h header.

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/devIL/distinfo,v
retrieving revision 1.12
diff -u -r1.12 distinfo
--- distinfo	26 Oct 2018 10:18:49 -0000	1.12
+++ distinfo	28 Aug 2019 08:20:43 -0000
@@ -10,5 +10,6 @@
 SHA1 (patch-ad) = c8885607457c9af2d89dcf2d9e163fd224e0fa35
 SHA1 (patch-include_IL_il.h) = 553b2fbbd930ff6bab4b5bc790d13ebcccbfffba
 SHA1 (patch-lib_Makefile.in) = a2ae8d1a97f2cbd9c46b2f5923be06839dd6c64f
+SHA1 (patch-src-ILU_ilur_ilur.c) = 227d90ceaa03c739013b23b3b32de2b461acf6c6
 SHA1 (patch-src-IL_include_il__endian.h) = 25ed5f24fc871ceebb685e1c242a4c7b724142a2
 SHA1 (patch-src-IL_src_il__jp2.c) = 7474bdc6507f4a9daa42800fa626ec9ffe6892fe
Index: patches/patch-src-ILU_ilur_ilur.c
===================================================================
RCS file: patches/patch-src-ILU_ilur_ilur.c
diff -N patches/patch-src-ILU_ilur_ilur.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src-ILU_ilur_ilur.c	28 Aug 2019 08:20:43 -0000
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Use C stdlib header for free and malloc on apple system.
+
+--- src-ILU/ilur/ilur.c.orig	2009-03-08 07:10:12.000000000 +0000
++++ src-ILU/ilur/ilur.c
+@@ -1,6 +1,10 @@
+ #include <string.h>
+ #include <stdio.h>
++#ifdef __APPLE__
++#include <stdlib.h>
++#else
+ #include <malloc.h>
++#endif
+ 
+ #include <IL/il.h>
+ #include <IL/ilu.h>

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->macos-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Wed, 28 Aug 2019 08:41:08 +0000
Responsible-Changed-Why:
pkgsrc on macOS problem


State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 28 Aug 2019 13:12:49 +0000
State-Changed-Why:
Applied, thanks for the patch!


From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54497 CVS commit: pkgsrc/devel/devIL
Date: Wed, 28 Aug 2019 13:12:15 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Wed Aug 28 13:12:15 UTC 2019

 Modified Files:
 	pkgsrc/devel/devIL: distinfo
 Added Files:
 	pkgsrc/devel/devIL/patches: patch-src-ILU_ilur_ilur.c

 Log Message:
 devIL: don't look for malloc in malloc.h.

 Many OSes don't have it, like OS X.

 A non-ifdef version of a patch provided by clement bouvier
 in PR pkg/54497


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.13 pkgsrc/devel/devIL/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/devel/devIL/patches/patch-src-ILU_ilur_ilur.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.