如何使用Cygwin构建Google RE2
How to build Google RE2 using Cygwin?
我得到这些错误:
g++:无法识别的选项'-pthread'
util/测试。cc:1:0:警告:-fPIC忽略目标(所有代码与位置无关)
(multiple),最后:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lre2Collect2: 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
我已经做了以下事情来编译re2库并在cygwin上进行测试
1)编译和安装库
hg clone https://re2.googlecode.com/hg re2
cd re2
make
make install
2)测试的编译。修改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
为我编译的库没有问题,除了一个之外,所有测试都通过了。
如果你只需要Windows版本的库,你也可以检查这个版本的re2 for Visual Studio。http://code.google.com/p/re2win/
您可以更改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
- 如何使用Google Mock来模拟gettimeofday()
- 在Google Kick start中提交时出错
- CHECK(调用)函数在Google Colab中出错
- Google protobuf 时间戳未声明标识符,在 Windows 上具有C++
- 如何使用 Google Test 向测试添加元数据 / 如何将数据从 Google Test 发送到 TestEven
- 在macOS Mojave上发布BOOST unit_test_framework/Google测试
- RE2 不匹配非 ASCII 字符
- Google Test for OpenCv c++
- 使用 Google Test 对自定义断言函数进行单元测试
- Google Cloud Pubsub Async Streaming API in C++
- 如何在Google Cloud Functions上运行C++文件?
- 在jupyter notebook和google colab中使用.so
- gmock / google-mock发出警告,并且通过模拟异常未通过测试
- Google Or-Tools Glop:如何创建指向 const 对象的指针数组?
- 如何读取 google::p rotobuf::io::CodedOutputStream::WriteVarint32
- Google Sparsehash 在类型上使用 realloc(),这很难复制
- 如何在 google test in windows 中管理断言
- CMake 在编译 Google 的 protobuf 示例时找不到 protobuf
- Google RE2 库无法在 ubuntu 中使用 'make testinstall' 编译
- 如何使用Cygwin构建Google RE2