luceneplusplus / LucenePlusPlus

Lucene++ is an up to date C++ port of the popular Java Lucene library, a high-performance, full-featured text search engine.
luceneplusplus@googlegroups.com
Other
743 stars 235 forks source link

Error when compiling on windows with mingw-w64/msys2 #109

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi,

I am trying to compile lucene++ with mingw-w64/msys2 and there is an error:

[ 66%] Building CXX object src/demo/CMakeFiles/searchfiles.dir/searchfiles/main.cpp.obj [ 67%] Linking CXX executable searchfiles.exe C:/Developer/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lboost_system collect2.exe: error: ld returned 1 exit status src/demo/CMakeFiles/searchfiles.dir/build.make:109 : la recette pour la cible « src/demo/searchfiles.exe » a échouée make[2]: [src/demo/searchfiles.exe] Erreur 1 CMakeFiles/Makefile2:466 : la recette pour la cible « src/demo/CMakeFiles/searchfiles.dir/all » a échouée make[1]: [src/demo/CMakeFiles/searchfiles.dir/all] Erreur 2

when I look at src/demo/CMakeFiles/searchfiles.dir/build.make I can see that there is the following libs:

-lboost_system -lboost_date_time-mt -lboost_filesystem-mt -lboost_iostreams-mt -lboost_regex-mt -lboost_system-mt -lboost_thread-mt -lboost_chrono-mt -lboost_atomic-mt -lboost_filesystem-mt -lboost_iostreams-mt -lboost_regex-mt -lboost_system-mt

to make it compile I have to remove -lboost_system for

I mean I need to remove it inside the generated makefiles build.make but I don't know how to fix it properly. Is it a problem with cmake or with your makefiles ?

Once I have managed to compile demo programs I still have another error when it tries to compile some tests using google test:

[ 68%] Building CXX object src/test/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj In file included from C:/Developer/msys64/home/Vincent/LucenePlusPlus/src/test/gtest/include/gtest/internal/gtest-internal.h:40:0, from C:/Developer/msys64/home/Vincent/LucenePlusPlus/src/test/gtest/include/gtest/gtest.h:58, from C:/Developer/msys64/home/Vincent/LucenePlusPlus/src/test/gtest/src/gtest-all.cc:39: C:/Developer/msys64/home/Vincent/LucenePlusPlus/src/test/gtest/include/gtest/internal/gtest-port.h:1743:3: error: 'AutoHandle' does not name a type AutoHandle thread_;

I found that there is some problem with mingw and google tests : https://github.com/google/googletest/issues/606 so for now I will try to see what they suggest but in the mean time if you have any suggestions I am all ears.

Platform: Windows 10 Vincent@DESKTOP-O0EU8UN MINGW64 ~/LucenePlusPlus/build $ cmake --version cmake version 3.7.0

Thanks

ghost commented 7 years ago

Finally I have fixed the gtest with the attached patch.

gtest_mingw_patch.txt

About the boost_system I am still thinking about the best way to fix it. I need first to understand why the -lboost_system is generated and if it comes from cmake I could either ask cmake community the logic behind it. if it's normal I could see if inside msys2 we couln't make a copy of libboost_system-mt and rename it into libboost_system.