我发现了这些错误:
g++:无法识别的选项“-p线程”
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发布于 2011-12-05 23:38:02
我做了以下工作来编译re2库和在cygwin上进行测试
1)图书馆的编撰及分期付款
hg clone https://re2.googlecode.com/hg re2
cd re2
make
make install2)测试的编制。修改Makefile并替换以下行:
$(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 -L/usr/local/lib -lre2 obj/libre2.a $(LDFLAGS) $(LDPCRE)
在那之后
make test
库为我编译,没有问题,除了一个例外,所有的测试都通过了。
如果您只需要re2版本的库,也可以检查Visual的此版本。http://code.google.com/p/re2win/
发布于 2011-12-05 19:04:42
您可以更改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/testhttps://stackoverflow.com/questions/8284982
复制相似问题