Opened 3 years ago

Closed 2 years ago

#62219 closed defect (fixed)

netperf @2.7.0: error: implicit declaration of function 'read' is invalid in C99

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: grimreaper (Eitan Adler)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: catalina bigsur monterey haspatch Cc:
Port: netperf

Description

netperf does not build with Xcode 12 or later due to the well-known implicit declaration of function problem.

https://build.macports.org/builders/ports-11_arm64-builder/builds/10926/steps/install-port/logs/stdio

net_uuid.c:158:5: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    read(fd, seed, 16);
    ^
net_uuid.c:158:5: note: did you mean 'fread'?
/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/stdio.h:158:9: note: 'fread' declared here
size_t   fread(void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream);
         ^
net_uuid.c:159:5: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    close(fd);
    ^

The fix is to patch the code to include the system headers that define these functions. Maybe upstream already fixed it; if so, we use their patch. If not, we report it to them.

Change History (3)

comment:1 Changed 2 years ago by hpux735 (William Dillon)

Did you have a patch for this, or not yet?

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

Keywords: monterey haspatch added

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

Resolution: fixed
Status: assignedclosed

In bb5b4fe058e28335bfadcd0ed7e76944aec93369/macports-ports (master):

netperf: Fix implicit func decls and wrong code

Fix implicit declaration of functions which caused build failure with
Xcode 12 and later.

Fix invocation of mach_port_deallocate which was called with 1 argument
but needs 2. I assume this change is correct but I don't know.

Closes: #62219

Note: See TracTickets for help on using tickets.