Opened 4 years ago

Closed 4 years ago

#61343 closed defect (fixed)

pgplot @5.2.2: error: implicit declaration of function

Reported by: aedolphin Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: haspatch, catalina Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: pgplot

Description

Two files in the current pgplot distribution do not compile on a new mac using Catalina and latest Xcode.

sys/grfileio.c requires the following two additional #includes: <string.h> and <unistd.h>

sys/grtermio.c requires the following three additional #includes: <string.h>, <fcntl.h>, and <unistd.h>

Updated versions of both files are attached.

Attachments (2)

grfileio.c (4.9 KB) - added by aedolphin 4 years ago.
Fixed version of sys/grfileio.c that allows compilation to succeed
grtermio.c (3.7 KB) - added by aedolphin 4 years ago.
Corrected sys/grtermio.c that allows pgplot to build

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by aedolphin

Attachment: grfileio.c added

Fixed version of sys/grfileio.c that allows compilation to succeed

Changed 4 years ago by aedolphin

Attachment: grtermio.c added

Corrected sys/grtermio.c that allows pgplot to build

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: MarcusCalhoun-Lopez added
Milestone: MacPorts 2.7.0
Owner: set to ryandesign
Status: newaccepted
Summary: pgplot fails to buildpgplot @5.2.2: error: implicit declaration of function

Thanks for reporting this and finding the fix.

It's the same type of problem we see with lots of old software when compiling with Xcode 12 or later:

sys/grfileio.c:82:5: error: implicitly declaring library function 'strncpy' with type 'char *(char *, const char *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
    strncpy(buff, name, slen);
    ^
sys/grfileio.c:82:5: note: include the header <string.h> or explicitly provide a declaration for 'strncpy'
--
    strncpy(buff, name, slen);
    ^
sys/grfileio.c:82:5: note: include the header <string.h> or explicitly provide a declaration for 'strncpy'
sys/grfileio.c:129:12: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return close(*fd);
           ^
--
    return close(*fd);
           ^
sys/grfileio.c:158:10: error: implicit declaration of function 'write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  return write(*fd, (void *) buf, *nbytes);
         ^
sys/grfileio.c:158:10: note: did you mean 'fwrite'?
/usr/include/stdio.h:165:9: note: 'fwrite' declared here
size_t   fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite);
         ^
3 errors generated.

I'll get it fixed.

Normally I would recommend sending the fix to the developers too but since the last release was in 2001 they probably aren't listening to bug reports anymore.

comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 3e582721fedf3e30c9021d97487398c4abdc744d/macports-ports (master):

pgplot: Fix implicit declaration of functions

Closes: #61343

Note: See TracTickets for help on using tickets.