如何使用Cygwin构建Google RE2?

fit*_*thu 6 c++ windows cygwin

我收到这些错误:

g ++:无法识别的选项'-pthread'util
/test.cc:1:0:警告:-fPIC被目标忽略(所有代码都与位置无关)

(多个),最后:

/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:找不到-lre2 collect2:ld返回1退出状态

有什么建议?

UPD完整的编译器日志

g++ -o obj/so/test/charclass_test obj/so/re2/testing/charclass_test.o obj/so/util/pcre.o obj/so/util/random.o obj/so/util/thread.o obj/so/re2/testing/backtrack.o obj/so/re2/testing/dump.o obj/so/re2/testing/exhaustive_tester.o obj/so/re2/testing/null_walker.o obj/so/re2/testing/regexp_generator.o obj/so/re2/testing/string_generator.o obj/so/re2/testing/tester.o obj/so/util/test.o -Lobj/so -lre2 obj/libre2.a -pthread
g++: unrecognized option '-pthread'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lre2
collect2: ld returned 1 exit status
make: *** [obj/so/test/charclass_test] Error 1
Run Code Online (Sandbox Code Playgroud)

Peo*_*eat 0

您可以更改Makefile以通过编译。然而,测试仍然会失败。我建议您联系 hg 项目所有者,了解为什么这在 cygwin 上不起作用。

$ hg diff
diff -r 9aa1d4f2954d Makefile
--- a/Makefile  Sun Oct 30 15:57:08 2011 +0000
+++ b/Makefile  Mon Dec 05 11:03:39 2011 -0800
@@ -191,7 +191,7 @@

 obj/so/test/%: obj/so/libre2.so obj/libre2.a obj/so/re2/testing/%.o $(STESTOFILES) obj/so/util/test.o
        @mkdir -p obj/so/test
-       $(CXX) -o $@ obj/so/re2/testing/$*.o $(STESTOFILES) obj/so/util/test.o -Lobj/so -lre2 obj/libre2.a $(LDFLAGS) $(LDPCRE)
+       $(CXX) -o $@ obj/so/re2/testing/$*.o $(STESTOFILES) obj/so/util/test.o -Lobj/so obj/libre2.a $(LDFLAGS) $(LDPCRE)

 obj/test/regexp_benchmark: obj/libre2.a obj/re2/testing/regexp_benchmark.o $(TESTOFILES) obj/util/benchmark.o
        @mkdir -p obj/test
Run Code Online (Sandbox Code Playgroud)