Opened 8 years ago

Closed 6 years ago

Last modified 4 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@…

Description

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 8 years ago.
patch

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by smonai

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

patch

comment:1 Changed 6 years ago by strk

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

comment:2 Changed 6 years ago by strk

Cc: leethomason@… added

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

comment:3 Changed 6 years ago by strk

Milestone: 3.4.0
Resolution: fixed
Status: newclosed

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

comment:4 Changed 6 years ago by strk

Resolution: fixed
Status: closedreopened

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

comment:5 Changed 6 years ago by robe

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/
../../../../x86_64-w64-mingw32/include/unistd.h:10:0,
                 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/
../../../../x86_64-w64-mingw32/include/unistd.h:10,
                 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 Changed 6 years ago by strk

badtest is unrelated to this ticket

comment:7 Changed 6 years ago by strk

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 Changed 4 years ago by robe

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