#61147 closed defect (fixed)
xournal @0.4.8.2016_1: error: implicit declaration of function 'read', 'write', 'close'
Reported by: | mzucker (Matt Zucker) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.3 |
Keywords: | catalina haspatch | Cc: | |
Port: | xournal |
Description
Apparently the xournal source code makes liberal use of undeclared functions, which are errors with an up-to date macOS and Clang. The build halts on an error when it encounters undeclared functions in the source. Here's a relevant log snippet:
:info:build sft.c:742:33: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] :info:build if (listFind(glyphlist, (void *) (int) index)) { :info:build ^ :info:build sft.c:756:31: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] :info:build listAppend(glyphlist, (void *) (int) index); :info:build ^ :info:build ttcr.c:420:9: error: implicit declaration of function 'write' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build if (write(fd, ptr, length) != length) { :info:build ^ :info:build ttcr.c:420:9: note: did you mean 'fwrite'? :info:build /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:165:9: note: 'fwrite' declared here :info:build sft.c:940:35: warning: cast to 'void *' from smaller integer type 'guint32' (aka 'unsigned int') [-Wint-to-void-pointer-cast] :info:build size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite); :info:build listAppend(glyphlist, (void *) glyphID); :info:build ^ :info:build ^ :info:build ttcr.c:426:5: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build close(fd); :info:build ^ :info:build sft.c:1633:13: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build if (read(fd, buffer, 12) == 12) { :info:build ^ :info:build sft.c:1633:13: note: did you mean 'fread'? :info:build /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:158:9: note: 'fread' declared here :info:build size_t fread(void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream); :info:build ^ :info:build sft.c:1637:9: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build close(fd); :info:build ^ :info:build sft.c:1806:19: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build if (fd != -1) close(fd); :info:build ^ :info:build sft.c:1847:27: warning: cast to 'void *' from smaller integer type 'guint32' (aka 'unsigned int') [-Wint-to-void-pointer-cast] :info:build listAppend(glyphlist, (void *) glyphID);
Adding the line
configure.cflags-append "-std=gnu89 -Wno-implicit-function-declaration"
to the Portfile allows xournal to build successfully.
I will attach a patched Portfile if I can figure out how...
Attachments (1)
Change History (5)
Changed 4 years ago by mzucker (Matt Zucker)
Attachment: | Portfile-xournal.diff added |
---|
comment:1 Changed 4 years ago by mf2k (Frank Schima)
Cc: | ryandesign@… removed |
---|---|
Keywords: | catalina, haspatch → catalina haspatch |
Owner: | set to ryandesign |
Status: | new → assigned |
comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Status: | assigned → accepted |
---|---|
Summary: | xournal @0.4.8.2016_1: build failure with recent clang on Catalina → xournal @0.4.8.2016_1: error: implicit declaration of function 'read', 'write', 'close' |
comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:4 Changed 4 years ago by mzucker (Matt Zucker)
I added the -std=gnu89 because the errors I saw said implicit declarations are invalid in C99. But glad for any fix, thanks!
Note: See
TracTickets for help on using
tickets.
Thanks for letting me know about the problem.
Instead of disabling the compiler check, I will fix the problem by including the correct headers, and I'll report the problem and the patch to the developers.
I'm not sure why you added
-std=gnu89
; we've been compiling the port with clang since Lion (2011) which defaults to C99 which has been fine for this port, as far as I know.