Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#319 closed defect (fixed)

GEOS 3.2.0 fails to build from source in Cygwin 1.7.1 (gcc 4.3.4)

Reported by: smonai Owned by: pramsey
Priority: trivial Milestone: 3.4.0
Component: Build/Install Version: 3.2.0
Severity: Unassigned Keywords: -ansi snprintf patch history
Cc: leethomason@…


A build initiated with ./configure && make && make install in Cygwin 1.7.1 (gcc 4.3.4) fails within the tests/ subdirectory. The problem is that the -ansi compilation flag filters the prototype of snprintf() out of stdio.h, causing the compilation of tests/xmltester/tinyxml/tinyxml.cpp to fail, with error messages stating:

'snprintf' was not declared in this scope

This error is actually correct behaviour on the compiler's part, since snprintf() is not described in the C89/C++98 ISO standards, and the -ansi flag is intended to enforce precisely those standards.

I have attached a patch to tests/xmltester/tinyxml/tinyxml.h which allows the build to succeed. I believe the patch should not interfere with proper building on non-Cygwin platforms, although I have not tested this.

Attachments (1)

geos-3.2.0-1.src.patch (402 bytes ) - added by smonai 14 years ago.

Download all attachments as: .zip

Change History (9)

by smonai, 14 years ago

Attachment: geos-3.2.0-1.src.patch added


comment:1 by strk, 13 years ago

I'd rather drop -ansi and replace it with -std=c99

comment:2 by strk, 13 years ago

Cc: leethomason@… added

I've added tinyxml author in Cc for this as this is really a tinyxml issue after all.

comment:3 by strk, 13 years ago

Milestone: 3.4.0
Resolution: fixed
Status: newclosed

r3441 (in trunk) drops -ansi -pedantic (but also other flags) from compilation of XMLTester.

comment:4 by strk, 12 years ago

Resolution: fixed
Status: closedreopened

The over-drop might have broken builds on windows (due to missing -DGEOS_INLINE)

comment:5 by robe, 12 years ago

Reverting this change did fix the xmltester make check for me in #552.

However -- badtest doesn't compile then. Not sure if its related to this or not.

I get this error:

make  threadtest.exe badthreadtest.exe
make[4]: Entering directory `/c/ming64/projects/geos/branches/trunk/tests/thread
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include/geos
-I../../include -I../../tests/unit/tut -I../../capi   -pedantic -Wall -ansi -Wno
-long-long  -ffloat-store -g -O2 -MT threadtest.o -MD -MP -MF .deps/threadtest.T
po -c -o threadtest.o threadtest.c
In file included from c:\ming64\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/
                 from threadtest.c:19:
../../include/geos/io.h:19:11: error: expected '=', ',', ';', 'asm' or '__attrib
ute__' before 'geos'
In file included from ../../include/geos/io.h:48:0,
                 from c:\ming64\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/
                 from threadtest.c:19:
../../include/geos/io/ByteOrderDataInStream.h:30:61: fatal error: iosfwd: No suc
h file or directory
compilation terminated.
make[4]: *** [threadtest.o] Error 1
make[4]: Leaving directory `/c/ming64/projects/geos/branches/trunk/tests/thread'

make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/c/ming64/projects/geos/branches/trunk/tests/thread'

make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/c/ming64/projects/geos/branches/trunk/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/c/ming64/projects/geos/branches/trunk'
make: *** [check] Error 2

comment:6 by strk, 12 years ago

badtest is unrelated to this ticket

comment:7 by strk, 12 years ago

Resolution: fixed
Status: reopenedclosed

r3673 re-adds the GEOS_INLINE switch, should be a better fix (although it still strips warning and optimization and debugging switches)

comment:8 by robe, 11 years ago

Keywords: history added
Note: See TracTickets for help on using tickets.