Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Jan 11, 2017 · 1 comment
Open

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

ghost opened this issue Jan 11, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 11, 2017

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

  • src/demo/deletefiles

  • src/demo/indexfiles

  • src/demo/searchfiles

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 : google/googletest#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
Copy link
Author

ghost commented Jan 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants