2014-02-22 70 views
2

Gurus!Google RE2库无法在ubuntu中使用'make testinstall'进行编译

我使用Ubuntu 13.10 64位编译谷歌最新的RE2库,但 '使testinstall' 无法编译,这里是日志:

凯文@ Ubuntu的:〜/ RE2 $使testinstall

cp testinstall.cc obj (cd obj & & g ++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 -pthread -o testinstall) /tmp/ccSsaSXS.o:In function main': testinstall.cc:(.text+0xce): undefined reference to re2 :: FilteredRE2 :: FirstMatch(re2 :: StringPiece const &,std :: vector> const &)const' /usr/local/lib/libre2.so:未定义参照pthread_rwlock_rdlock' /usr/local/lib/libre2.so: undefined reference to pthread_rwlock_wrlock ' /usr/local/lib/libre2.so:未定义参照pthread_rwlock_destroy' /usr/local/lib/libre2.so: undefined reference to调用pthread_rwlock_init' /usr/local/lib/libre2.so:未定义参考为`pthread_rwlock_unlock” collect2:错误:LD返回1个退出状态 化妆:* [testinstall]错误1

我试图与-lpthread更换-pthread,还是失败了,那么我libre2.so倾倒,发现pthread_xxx在里面。 这里是问题RE2论坛追踪:这里https://code.google.com/p/re2/issues/detail?id=100

任何人都曾经遵循RE2成功?谢谢!

回答

1

this comment

Adding -pthread to LDFLAGS seems to fix make test (all tests are passing), but not make testinstall .

,将让你到下一个错误

+0

是的,如果我什么都不做,'make test'和'make testinstall'都会失败。到现在为止,我找不到一种方法让所有构建都通过: – nonew

0

取决于你建立了用于“使testinstall”什么可能没有必要。 我只需要让Python的re2端口工作,并且可以在运行make install之后安装。

0

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

0

所以我试图寻找testinstall.cc这是导致符号错误的线条和我发现的唯一路线是第18行:

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

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

如果我猜测,也许在filtered_re2模块内某处存在依赖关系?

0

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

nm -C显示.a.so文件中都存在“缺失”符号。