2014-02-22 71 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文件中都存在「缺失」符號。