[Solved][CMake+Mingw] Compiling errors

[Solved][CMake+Mingw] Compiling errors

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Viod
Posts: 7
Joined: 18 Sep 2012, 13:23

[Solved][CMake+Mingw] Compiling errors

Post by Viod »

I followed the wiki: http://springrts.com/wiki/Building_Spring_on_Windows

1) tdm-gcc-webdl installs GCC 4.7.0
With the 4.7 you have to update the boost libraries in mingwlibs in order to solve the BOOST_DISABLE_THREADS error.

Here you can find the fix. You need to update boost/config/stdlib/libstdcpp3.hpp

Code: Select all

#if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
    || defined(_GLIBCXX_HAS_GTHREADS) \
    || defined(_GLIBCXX__PTHREADS) \
    || defined(WIN32)
2) I'm using CMake and the cloned master branch of Spring.
I tried GCC 4.7.0 but also 4.6.2. Errors are the same.
I have this error and I may need help:

Code: Select all


[ 31%] Building CXX object tools/unitsync/CMakeFiles/unitsync.dir/__/__/rts/System/FileSystem/FileFilter.cpp.obj
In file included from c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/typeindex:35:0,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:28,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash.hpp:6,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/regex/v4/basic_regex.hpp:23,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/regex/v4/regex.hpp:67,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/regex.hpp:31,
                 from O:\Data\GitHub\spring\rts\System\FileSystem\FileFilter.cpp:7:
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabl ed with the -std=c++0x or -std=gnu++0x compiler options.
In file included from O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash.hpp:6:0,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/regex/v4/basic_regex.hpp:23,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/regex/v4/regex.hpp:67,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/regex.hpp:31,
                 from O:\Data\GitHub\spring\rts\System\FileSystem\FileFilter.cpp:7:
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:95:43: error: 'std::size_t boost::hash_value' redeclared as different kind of symbol
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:91:17: error: previous declaration of 'template<class Ch, class A> std::size_t boost::hash_value(const std::basic_string<Ch, std::char_traits<_CharT>, A>&)'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:95:28: error: 'type_index' is not a member of 'std'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:343:40: error: 'boost::hash_value' declared as an 'inline' variable
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:343:40: error: 'std::size_t boost::hash_value' redeclared as different kind of symbol
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:321:24: error: previous declaration of 'template<class Ch, class A> std::size_t boost::hash_value(const std::basic_string<Ch, std::char_traits<_CharT>, A>&)'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:343:35: error: 'type_index' is not a member of 'std'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:454:5: error: 'type_index' is not a member of 'std'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:454:5: error: 'type_index' is not a member of 'std'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:454:5: error: template argument 1 is invalid
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:454:5: error: 'type_index' is not a member of 'std'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:454:5: error: 'type_index' is not a member of 'std'
O:/Data/GitHub/spring/mingwlibs/include/boost/functional/hash/hash.hpp:454:5: error: template argument 1 is invalid
mingw32-make[3]: *** [tools/unitsync/CMakeFiles/unitsync.dir/__/__/rts/System/FileSystem/FileFilter.cpp.obj] Error 1
mingw32-make[2]: *** [tools/unitsync/CMakeFiles/unitsync.dir/all] Error 2
mingw32-make[1]: *** [rts/builds/default/CMakeFiles/install-spring.dir/rule] Error 2
mingw32-make: *** [install-spring] Error 2
I tried to add the CFLAG "-std=c++0x" and it gives a shitload of new errors, so I don't think the custom FLAG is a good solution:

Code: Select all

[  8%] Building CXX object rts/lib/lua/CMakeFiles/lua.dir/src/lapi.cpp.obj
In file included from c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/random:51:0,
                 from c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algo.h:67,
                 from c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/algorithm:63,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/thread/win32/thread_primitives.hpp:18,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/thread/win32/basic_recursive_mutex.hpp:12,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/thread/win32/recursive_mutex.hpp:14,
                 from O:/Data/GitHub/spring/mingwlibs/include/boost/thread/recursive_mutex.hpp:14,
                 from O:\Data\GitHub\spring\rts\lib\lua\src\/lstate.h:15,
                 from O:\Data\GitHub\spring\rts\lib\lua\src\/ldebug.h:11,
                 from O:\Data\GitHub\spring\rts\lib\lua\src\lapi.cpp:20:
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc: In member function 'void std::poisson_distribution<_IntType>::param_type::_M_initialize()':
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc:1172:55: error: no matching function for call to 'max(float, const double&)'
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc:1172:55: note: candidates are:
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algobase.h:210:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algobase.h:254:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/algorithmfwd.h:400:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/algorithmfwd.h:404:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc: In member function 'void std::binomial_distribution<_IntType>::param_type::_M_initialize()':
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc:1365:42: error: no matching function for call to 'max(float, const double&)'
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc:1365:42: note: candidates are:
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algobase.h:210:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algobase.h:254:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/algorithmfwd.h:400:5: note: template<class _Tp> _Tp std::max(st
d::initializer_list<_Tp>)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/algorithmfwd.h:404:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc:1369:42: error: no matching function for call to 'max(float, const double&)'
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/random.tcc:1369:42: note: candidates are:
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algobase.h:210:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_algobase.h:254:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/algorithmfwd.h:400:5: note: template<class _Tp> _Tp std::max(st
d::initializer_list<_Tp>)
c:\mingw32\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/algorithmfwd.h:404:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
mingw32-make[3]: *** [rts/lib/lua/CMakeFiles/lua.dir/src/lapi.cpp.obj] Error 1
mingw32-make[2]: *** [rts/lib/lua/CMakeFiles/lua.dir/all] Error 2
mingw32-make[1]: *** [rts/builds/default/CMakeFiles/install-spring.dir/rule] Error 2
mingw32-make: *** [install-spring] Error 2
Thx.
Last edited by Viod on 26 Sep 2012, 10:23, edited 2 times in total.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: I can't compile at all.

Post by Beherith »

With VS2005, master branch throws the following:
Platform/Threading.h(42) : error C2061: syntax error : identifier 'uint32_t'

and

1>LobbyConnection.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\complex(177) : error C2039: 'atan2l' : is not a member of '`global namespace''

Zerver, got any ideas?
Viod
Posts: 7
Joined: 18 Sep 2012, 13:23

Re: I can't compile at all.

Post by Viod »

Tried with CMake again and the develop branch.

Same c++0x error with /Lua/LuaParser.cpp
So if I use the -std=c++0x FLAG I'm able to compile that file, but I have errors with all the other std:: functions that are not compatible with c++0x.

:/
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: I can't compile at all.

Post by jK »

Viod wrote:With the 4.7 you have to update the boost libraries in mingwlibs in order to solve the BOOST_DISABLE_THREADS error.
You are not qualified to update the boost libs! It's NOT a simple copy files from here to there procedure.
When you got such a problem INFORM us, we will see if we can help you or update the libs. But NEVER start a thread with a non-saying "I can't compile at all.".
Viod
Posts: 7
Joined: 18 Sep 2012, 13:23

Re: I can't compile at all.

Post by Viod »

jK wrote:
Viod wrote:With the 4.7 you have to update the boost libraries in mingwlibs in order to solve the BOOST_DISABLE_THREADS error.
You are not qualified to update the boost libs! It's NOT a simple copy files from here to there procedure.
I'm qualified to update all I desire on my machine. :P
Btw I only suggested you a patch for libstdcpp3.hpp in order to use GCC 4.7.0
As a suggestion, you can choose to patch the file, update boost, keep the error, ban GCC 4.7.0 or solve in another way. It's up to you. I chose to mantain the original mingwlibs folder, using GCC 4.6.2
jK wrote: When you got such a problem INFORM us, we will see if we can help you or update the libs.
I'm INFORMing you.
jK wrote:But NEVER start a thread with a non-saying "I can't compile at all.".
I changed the title, hoping the problem is more clear now.



Beherith suggested me to use VS2005, so i tried with it, but after installing the vclibs, the Windows SDK and the DirectX SDK I had two errors (with the master branch):
1) Platform/Threading.h(42) : error C2061: syntax error : identifier 'uint32_t'

The boost header containing the definition of uint32_t is correctly linked and included in Threading.h, but I have this error and that's really odd.

2)1>LobbyConnection.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\complex(177) : error C2039: 'atan2l' : is not a member of '`global namespace''

I have errors everywhere there is a complex call. Even calling sqrt gives me error.

Btw I don't really like working with VS, so I think I'm going to try to set up an Ubuntu 32bit virtual machine (I'm working on Windows 7 Professional 64bit now), to try again. That's not a solution, but I hope it will work. If you have suggestion I'm here to follow them. Thank you for your time.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: [CMake+Mingw] Compiling errors

Post by hoijui »

i think what jk refers to is, that the title suggests, that compiling fails by default, but it only fails cause you changed something on the default, recommended setup. so maybe that change should be mentioned in the title aswell.
Viod
Posts: 7
Joined: 18 Sep 2012, 13:23

Re: [CMake+Mingw] Compiling errors

Post by Viod »

hoijui wrote:i think what jk refers to is, that the title suggests, that compiling fails by default, but it only fails cause you changed something on the default, recommended setup. so maybe that change should be mentioned in the title aswell.
Everything is on default.
I'm using the original mingwlibs with GCC 4.6.2

The use of an updated file of boost is only needed (IMHO) with GCC 4.7.0
You can try it yourself compiling with that version of GCC, which is installed by tdm-gcc-webdl. After solving the BOOST_DISABLE_THREADS error with the patched file as I said, the compiler gives me the c++0x error.

However I chose to use GCC 4.6.2, using mingw-get-inst and reverting back your mingwlibs folder (with the original boost/config/stdlib/libstdcpp3.hpp). It gives me the same c++0x error with FileFilter.cpp and now with LuaParser.cpp.
It's like someone is using c++0x functions in the code without mantain the compatibility, but I may be wrong.

Edit: Now it seems to work. I've compiled succesfully LuaParser.cpp but only with GCC 4.6.2
Let's see if it's going to finish.

Edit2: Compiled! The problem was that I'm a moron and I missed a semicolon in the System PATH variable of Windows. I was still using GCC 4.7.0
With 4.6.2 installed from www.mingw.org everything works fine!

Sorry for the time lost here and thank you again. ^^
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [Solved][CMake+Mingw] Compiling errors

Post by jK »

https://github.com/spring/mingwlibs/commits/master
mingwlibs are now updated to boost 1.50
(only develop branch compiles)
Post Reply

Return to “Engine”