pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/54497: devel/devIL does not build on macos



>Number:         54497
>Category:       pkg
>Synopsis:       devel/devIL does not build on macos
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 28 08:30: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>



Home | Main Index | Thread Index | Old Index