Opened 5 years ago

Closed 5 years ago

#45623 closed defect (fixed)

realpath fails to build with gcc

Reported by: ryandesign (Ryan Schmidt) Owned by: user454322 (Javier)
Priority: Normal Milestone:
Component: ports Version: 2.3.2
Keywords: Cc:
Port: realpath


realpath 1.0.0 fails to build on OS X 10.6 with its gcc-4.2 compiler:

/usr/bin/gcc-4.2 -arch x86_64 -o realpath realpath.c -Werror -Wextra
realpath.c:41: error: expected ‘;’, ‘,’ or ‘)’ before ‘stream’
realpath.c:104: error: expected ‘;’, ‘,’ or ‘)’ before ‘stream’

According to wikipedia, restrict was introduced in C99, so the first thing I'd try to fix this would be to specify in the makefile that C99 should be used. C99 is the default for clang, but C89 is the default for the gcc used on 10.6 and earlier.

Change History (2)

comment:1 Changed 5 years ago by user454322 (Javier)

I don't have access to any machine running 10.6 but, as suggested, adding -std=c99 in the Makefile seems to fix the problem.

This have been changed here:

What would be the best approach to incorporate this fix into MacPorts?

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

Resolution: fixed
Status: newclosed

Thanks. I added a patchfile in r127428.

Note: See TracTickets for help on using tickets.