Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build Google RE2 using Cygwin?

I'm getting these errors:

g++: unrecognized option '-pthread'
util/test.cc:1:0: warning: -fPIC ignored for target (all code is position independent)

(multiple), and finally:

/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lre2 collect2: ld returned 1 exit status

Any advice?

UPD full compiler log

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
like image 205
fithu Avatar asked Nov 27 '11 10:11

fithu


1 Answers

I've done the following things to compile re2 library and tests on cygwin

1) Compilation and instalation of library

hg clone https://re2.googlecode.com/hg re2
cd re2
make
make install

2) Compilation of tests. Modify Makefile and replace this line:

$(CXX) -o $@ obj/so/re2/testing/$*.o $(STESTOFILES) obj/so/util/test.o -Lobj/so -lre2 obj/libre2.a $(LDFLAGS) $(LDPCRE)

with this line

$(CXX) -o $@ obj/so/re2/testing/$*.o $(STESTOFILES) obj/so/util/test.o -L/usr/local/lib -lre2 obj/libre2.a $(LDFLAGS) $(LDPCRE)

And after that do

make test

Library compiled for me without problem and with exception to one all tests passed.

You may also check this version of re2 for Visual Studio if you just need Windows version of library. http://code.google.com/p/re2win/

like image 197
Zuljin Avatar answered Sep 30 '22 19:09

Zuljin