lamuguo / re2

Automatically exported from code.google.com/p/re2
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Makefile error #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. make test

g++ -o obj/test/charclass_test obj/re2/testing/charclass_test.o obj/util/pcre.o 
obj/util/random.o obj/util/thread.o obj/re2/testing/backtrack.o 
obj/re2/testing/dump.o obj/re2/testing/exhaustive_tester.o 
obj/re2/testing/null_walker.o obj/re2/testing/regexp_generator.o 
obj/re2/testing/string_generator.o obj/re2/testing/tester.o  obj/util/test.o 
obj/libre2.a  
obj/util/thread.o: In function `Thread::Join()':
/hanmail/fqa/packages/re2/util/thread.cc:37: undefined reference to 
`pthread_join'
.....

2. make testinstall

cp testinstall.cc obj
(cd obj && g++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 
-pthread -o testinstall)
/tmp/ccfLhR61.o: In function `main':
testinstall.cc:(.text+0xd3): undefined reference to 
`re2::FilteredRE2::FirstMatch(re2::StringPiece const&, std::vector<int, 
std::allocator<int> > const&) const'
collect2: ld returned 1 exit status
.....

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

re2-20140111.tgz,  Red Hat Enterprise Linux Server release 6.3 (Santiago)

NOTE: If you have a suggested patch, please see
http://code.google.com/p/re2/wiki/Contribute
for information about sending it in for review.  Thanks.

Original issue reported on code.google.com by hazzl...@gmail.com on 20 Jan 2014 at 9:16

GoogleCodeExporter commented 9 years ago
I see the same issues on Ubuntu Precise 64bit. 

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

Original comment by kmik...@gmail.com on 12 Feb 2014 at 11:14

GoogleCodeExporter commented 9 years ago
I have same issue with `make testinstall`

kevin@ubuntu:~/re2$ make testinstall
cp testinstall.cc obj
(cd obj && g++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 
-pthread -o testinstall)
/tmp/cccTNGss.o: In function main':
testinstall.cc:(.text+0xce): undefined reference 
tore2::FilteredRE2::FirstMatch(re2::StringPiece const&, std::vector > const&) 
const'
/usr/local/lib/libre2.so: undefined reference to pthread_rwlock_rdlock'
/usr/local/lib/libre2.so: undefined reference topthread_rwlock_wrlock'
/usr/local/lib/libre2.so: undefined reference to pthread_rwlock_destroy'
/usr/local/lib/libre2.so: undefined reference topthread_rwlock_init'
/usr/local/lib/libre2.so: undefined reference to `pthread_rwlock_unlock'
collect2: error: ld returned 1 exit status
make: *** [testinstall] Error 1

Original comment by tobenot...@gmail.com on 21 Feb 2014 at 4:12

GoogleCodeExporter commented 9 years ago
Adding -pthread to the loader flags solved this for me.

Original comment by friedman...@gmail.com on 13 Mar 2014 at 10:06

GoogleCodeExporter commented 9 years ago
The same for me, using vagrant hashicorp/precise64. If add -pthread to LDFLAGS 
then
make test
passes. make install requires sudo, but succeeds. make testinstall fails. And 
any other c-app which requires re2 fails to compile in the same way. Wrong 
paths for h-files?

Original comment by astarshi...@netsertive.com on 18 Mar 2014 at 4:52

GoogleCodeExporter commented 9 years ago
Comment for #5:
solved problems with another app by fixing prefix in Makefile to /usr before 
make install
but make testinstall still not working

Original comment by astarshi...@netsertive.com on 18 Mar 2014 at 9:26

GoogleCodeExporter commented 9 years ago
having the same issue on vagrant hashicorp/precise64

Original comment by da...@bowery.io on 5 Apr 2014 at 12:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
/tmp/cccTNGss.o: In function main':
testinstall.cc:(.text+0xce): undefined reference 
tore2::FilteredRE2::FirstMatch(re2::StringPiece const&, std::vector > const&) 
const'

This error can be fixed, just change your Makefile;
Because the compiler will first search libxxx.so file path folder, if not 
found, search continues libxxx.a (static library).

so,you only need to comment or delete this line in Makefile "ln -sf 
libre2.so.$(SONAME).0.0 $(DESTDIR)$(libdir)/libre2.so "

Original comment by huadong...@gmail.com on 27 May 2014 at 4:49

GoogleCodeExporter commented 9 years ago
So I tried looking for the lines in testinstall.cc that were causing the symbol 
errors and I found out that the only line was on line 18:

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

I commented this line out (so that the FullMatch function below is still 
called) and just ran g++ testinstall.cc -lre2 -pthread -o testinstall 
(basically what the Makefile does) and I was able to get a binary successfully. 
Although this might not really solve the problem, its good to know that we can 
still use the RE2::Fullmatch and partial match functions

If I were to guess, maybe there is a dependency somewhere inside the 
filtered_re2 module?

Original comment by veek...@gmail.com on 28 Jul 2014 at 6:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I changed the exported symbols in libre2.symbols to export the proper symbol.  
Doing this caused the filtered_re2_test to fail the atoms.size() == 0 test in 
SmallOrTest.  The atoms vector contains "foo" and "bar".  What is strange to me 
is that from the comments in FilteredRE2 it seems that the vector *should* 
contain foo and bar, and that it is the test itself which is wrong.  Very 
strange.

Original comment by pmeredit@gmail.com on 12 Aug 2014 at 3:25

GoogleCodeExporter commented 9 years ago
I had all of the same problems as the rest of you guys. But I fixed it with the 
attached patch and then it seemed to work OK on my machine.

Original comment by matthew....@threatstream.com on 4 Oct 2014 at 5:53

Attachments:

GoogleCodeExporter commented 9 years ago
I'd happily submit the patch upstream but the commit workflow is so long, 
complex, and Mercurial-proprietary it's beyond me to figure it out. Hopefully 
somebody with upstream access can give me a hand with it.

Original comment by matthew....@threatstream.com on 4 Oct 2014 at 5:55

GoogleCodeExporter commented 9 years ago
it should be make by gcc 4.x but not 3.x,and then the 
"obj/test/%","obj/dbg/test/%","obj/so/test/%" should be added 
$(libdir)/libpthread.so.

It can be compiled by "make test".and tested by "make testinstall".
I failed in "testinstall.cc:(.text+0xce): undefined reference to 
`re2::FilteredRE2::FirstMatch(re2::StringPiece const&, std::vector<int, 
std::allocator<int> > const&) const'".when i note this func,the func FullMatch 
work correctly.

Original comment by wangt...@gmail.com on 13 Nov 2014 at 10:08

GoogleCodeExporter commented 9 years ago
RE2 has moved to GitHub. I have not moved the issues over. If this issue is 
still important to you, please file a new one at 
https://github.com/google/re2/issues. Thank you.

Original comment by rsc@golang.org on 11 Dec 2014 at 4:45