Opened 10 years ago

Closed 10 years ago

#45623 closed defect (fixed)

realpath fails to build with gcc

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

Description

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

https://build.macports.org/builders/buildports-snowleopard-x86_64/builds/30847/steps/compile/logs/stdio

/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 10 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: https://github.com/user454322/realpath/commit/1358f37ba759524c9c49225ad3b5aa3f314da6c3

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

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

Resolution: fixed
Status: newclosed

Thanks. I added a patchfile in r127428.

Note: See TracTickets for help on using tickets.