How to create Google RE2 using Cygwin?

I get the following errors:

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

(several) and finally

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

Any tips?

Complete UPD 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 
+6
source share
2 answers

I did the following things to compile the re2 library and tests on cygwin

1) Compilation and installation of the library

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

2) Compilation of tests. Modify the 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

A library compiled for me without problems and with the exception of one test.

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

+4
source

You can modify the Makefile to pass the compilation. However, the test still fails. I suggest you contact the owner of the hg project to understand why this does not work on cygwin.

 $ hg diff diff -r 9aa1d4f2954d Makefile --- a/Makefile Sun Oct 30 15:57:08 2011 +0000 +++ b/Makefile Mon Dec 05 11:03:39 2011 -0800 @@ -191,7 +191,7 @@ obj/so/test/%: obj/so/libre2.so obj/libre2.a obj/so/re2/testing/%.o $(STESTOFILES) obj/so/util/test.o @mkdir -p obj/so/test - $(CXX) -o $@ obj/so/re2/testing/$*.o $(STESTOFILES) obj/so/util/test.o -Lobj/so -lre2 obj/libre2.a $(LDFLAGS) $(LDPCRE) + $(CXX) -o $@ obj/so/re2/testing/$*.o $(STESTOFILES) obj/so/util/test.o -Lobj/so obj/libre2.a $(LDFLAGS) $(LDPCRE) obj/test/regexp_benchmark: obj/libre2.a obj/re2/testing/regexp_benchmark.o $(TESTOFILES) obj/util/benchmark.o @mkdir -p obj/test 
0
source

Source: https://habr.com/ru/post/902483/


All Articles