GEOS 构建错误
Posted
技术标签:
【中文标题】GEOS 构建错误【英文标题】:GEOS build errors 【发布时间】:2016-08-26 11:01:23 【问题描述】:GEOS 库 geos-3.5.0.tar.bz2 在 make 过程中失败。看到类似的 SE 查询 MinGW / CxxTest bizarre errors 但我不确定要更改哪个文件,因为命令位于配置和 makefile 中。
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../include -I../../../include/geos -I../../../include -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -g -O2 -MT IndexedPointInAreaLocator.lo -MD -MP -MF .deps/IndexedPointInAreaLocator.Tpo -c -o IndexedPointInAreaLocator.lo IndexedPointInAreaLocator.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../include -I../../../include/geos -I../../../include -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -g -O2 -MT IndexedPointInAreaLocator.lo -MD -MP -MF .deps/IndexedPointInAreaLocator.Tpo -c IndexedPointInAreaLocator.cpp -o IndexedPointInAreaLocator.o
In file included from c:\mingw\include\wchar.h:208:0,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h:40,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\string:40,
from ../../../include/geos/geom/Coordinate.h:24,
from ../../../include/geos/geom/Envelope.h:25,
from ../../../include/geos/geom/Geometry.h:27,
from IndexedPointInAreaLocator.cpp:17:
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
【问题讨论】:
我遇到了同样的错误。 【参考方案1】:我在 x64 系统上使用 MinGW-x64 https://sourceforge.net/projects/mingw-w64 解决了我的问题
【讨论】:
【参考方案2】:我采用的解决方案是根据G++ updated on MingW gets massive error messages 的 SE 建议更改 Makefile 中的 CXXFLAGS。
在 Makefile 中搜索 CXXFLAGS 看起来像
CXXFLAGS = -g -O2
我改成
CXXFLAGS = -g -O2 -std=gnu++11 -c -Wall
由于子文件夹中有几十个Makefile,我一次使用python批处理脚本进行了更改。
import os, fnmatch
def findReplace(directory, find, replace, filePattern):
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, filePattern):
filepath = os.path.join(path, filename)
with open(filepath) as f:
s = f.read()
s = s.replace(find, replace)
with open(filepath, "w") as f:
f.write(s)
findReplace(r"C:\MinGW\git_rep\geos-3.5.0", "CXXFLAGS = -g -O2", "CXXFLAGS = -g -O2 -std=gnu++11 -c -Wall", "Makefile")
【讨论】:
以上是关于GEOS 构建错误的主要内容,如果未能解决你的问题,请参考以下文章