Ticket #319 (closed defect: fixed)

Opened 3 years ago

Last modified 12 months ago

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
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

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

Change History

Changed 3 years ago by smonai

patch

Changed 23 months ago by strk

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

Changed 23 months ago by strk

  • cc leethomason@… added

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

Changed 23 months ago by strk

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 3.4.0

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

Changed 12 months ago by strk

  • status changed from closed to reopened
  • resolution fixed deleted

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

Changed 12 months 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

Changed 12 months ago by strk

badtest is unrelated to this ticket

Changed 12 months ago by strk

  • status changed from reopened to closed
  • resolution set to fixed

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

Note: See TracTickets for help on using tickets.