2

大师!

我正在使用 Ubuntu 13.10 64 位编译最新的 Google RE2 库,但“make testinstall”编译失败,这里是日志:

kevin@ubuntu:~/re2$ 进行测试安装

cp testinstall.cc obj (cd obj && g++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 -pthread -o testinstall) /tmp/ccSsaSXS.o: 在函数main': testinstall.cc:(.text+0xce): undefined reference tore2::FilteredRE2 ::FirstMatch(re2::StringPiece const&, std::vector > const&) const' /usr/local/lib/libre2.so: 未定义引用pthread_rwlock_rdlock' /usr/local/lib/libre2.so: undefined reference topthread_rwlock_wrlock' /usr/local/lib/libre2.so: 未定义引用pthread_rwlock_destroy' /usr/local/lib/libre2.so: undefined reference topthread_rwlock_init ' /usr/local/lib/libre2.so: 未定义引用 `pthread_rwlock_unlock' collect2: 错误: ld 返回 1 退出状态 make: * [testinstall] 错误 1

我试图用-lpthread替换-pthread,仍然失败,然后我转储libre2.so,发现pthread_xxx在其中。这是 RE2 论坛中的问题跟踪:https ://code.google.com/p/re2/issues/detail?id=100

这里有人成功地遵守了RE2吗?谢谢!

4

5 回答 5

1

看到这个评论

将 -pthread 添加到 LDFLAGS 似乎可以修复make test(所有测试都通过了),但不是make testinstall.

这将使您进入下一个错误

于 2014-02-26T03:18:15.920 回答
0

根据您为“make testinstall”构建的内容,可能不需要。我只需要让 python re2 端口工作,这可以在运行 make install 后安装。

于 2014-05-26T04:07:48.713 回答
0

所以我尝试在 testinstall.cc 中查找导致符号错误的行,我发现唯一的行在第 18 行:

18 - f.firstMatch(:abbccc:, ids);

我注释掉了这一行(以便仍然调用下面的 FullMatch 函数)并运行 g++ testinstall.cc -lre2 -pthread -o testinstall (基本上是 Makefile 所做的),我能够成功获得二进制文件。虽然这可能不能真正解决问题,但很高兴知道我们仍然可以使用 RE2::Fullmatch 和部分匹配功能

如果我猜的话,也许在过滤后的_re2 模块中的某个地方存在依赖关系?

于 2014-07-28T06:00:57.953 回答
0

我有同样的问题。但是,如果您编译-static一切顺利。

nm -C表明“缺失”符号存在于.a.so文件中。

于 2014-11-01T09:53:28.453 回答
0

我以前遇到过这个问题。修改 makefile 并使用 -lpthread 代替 -pthread。

于 2014-06-17T08:16:53.187 回答