# Help to compile ThirdParty/loguru under Windows 10 with gnu c++ 9.2

**URL:** https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588
**Category:** Support
**Created:** [November 6, 2020, 12:55am UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588 "2020-11-06T00:55:56Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [November 6, 2020, 12:55am UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/1 "2020-11-06T00:55:56Z")

</div>

Hi,

I am trying to compile VTK under Window 10 with gnu 9.2 for Windows from here: [http://www.equation.com/servlet/equation.cmd?fa=fortran](http://www.equation.com/servlet/equation.cmd?fa=fortran)

The cmake command is:  
cmake -DCMAKE\_MAKE\_PROGRAM=make -DCMAKE\_CXX\_COMPILER=g++ -G “Unix Makefiles” …

I have compiled all other Third Party package successfully, but this loguru gives some errors like:

error: ‘recursive\_mutex’ in namespace ‘std’ does not name a type

I searched the net, maybe it is about multithreading like this:

> <https://stackoverflow.com/questions/14191566/c-mutex-in-namespace-std-does-not-name-a-type>

As said in that post, maybe I should use the GCC-related tools suffixed `-posix` as opposed to `-win32`, how do I do it?

BTW: could I switch off this package and try compile the rest first?

Thanks for help.

Cheers

Cean

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 7, 2020, 9:53pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/2 "2020-11-07T21:53:01Z")

</div>

Hi, cean,

So you’re under Windows and want to generate Unix makefiles, right? Then I guess you’re using a `gcc` from some Unix environment/toolset in Windows like MSYS, MSYS2, MinGW, MinGW64 or Cygwin. Which one are you using?

regards,

Paulo

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 7, 2020, 10:03pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/3 "2020-11-07T22:03:02Z")

</div>

I’ve just realized you’re using a compiler I’ve never heard of. Interesting. Yes, mutexes (short of mutual exclusion) are structures to avoid race conditions in mutithreading programs (such as trying to write to the same file from different threads at the same time).

After reading the topic in SO, I agree that you should switch to MinGW64 as suggested by the answers there. As a plus, you’ll be able to compile 64-bit programs.

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [November 9, 2020, 10:26pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/4 "2020-11-09T22:26:35Z")

</div>

I added ‘-std=c++11’ in the CMakeLists.txt at the root folder like these:  
set(CMAKE\_CXX\_FLAGS “-std=c++11”)  
But seems no effect. Can’t see any ‘-std=c++11’ in the generated Makefile

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 9, 2020, 10:31pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/5 "2020-11-09T22:31:16Z")

</div>

Which toolset are you using?

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [November 9, 2020, 10:34pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/6 "2020-11-09T22:34:27Z")

</div>

The gnu c++ from equation. It has MinGW64 underneath it.

Also I found an option in Cmakefiles.txt to switch off logging. Will try switch it off.  
option(VTK\_ENABLE\_LOGGING “Enable logging support.” OFF)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 9, 2020, 10:39pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/7 "2020-11-09T22:39:26Z")

</div>

Which Makefile generator did you choose to configure CMake?

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [November 9, 2020, 10:40pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/8 "2020-11-09T22:40:12Z")

</div>

Scanning dependencies of target CommonCore  
[1%] Building CXX object Common/Core/CMakeFiles/CommonCore.dir/vtkArrayIteratorTemplateInstantiate.cxx.obj  
[2%] Building CXX object Common/Core/CMakeFiles/CommonCore.dir/vtkGenericDataArray.cxx.obj  
d:/00prg/gcc/bin/…/lib/gcc/x86\_64-w64-mingw32/9.2.0/…/…/…/…/x86\_64-w64-mingw32/bin/as.exe: CMakeFiles/CommonCore.dir/vtkGenericDataArray.cxx.obj: too many sections (41279)  
C:\Users\ian\AppData\Local\Temp\ccqyCt4W.s: Assembler messages:  
C:\Users\ian\AppData\Local\Temp\ccqyCt4W.s: Fatal error: can’t write 101 bytes to section .text of CMakeFiles/CommonCore.dir/vtkGenericDataArray.cxx.obj because: ‘File too big’  
d:/00prg/gcc/bin/…/lib/gcc/x86\_64-w64-mingw32/9.2.0/…/…/…/…/x86\_64-w64-mingw32/bin/as.exe: CMakeFiles/CommonCore.dir/vtkGenericDataArray.cxx.obj: too many sections (41279)  
C:\Users\ian\AppData\Local\Temp\ccqyCt4W.s: Fatal error: can’t close CMakeFiles/CommonCore.dir/vtkGenericDataArray.cxx.obj: File too big  
make[2]: \*\*\* [Common/Core/CMakeFiles/CommonCore.dir/build.make:83: Common/Core/CMakeFiles/CommonCore.dir/vtkGenericDataArray.cxx.obj] Error 1  
make[1]: \*\*\* [CMakeFiles/Makefile2:1453: Common/Core/CMakeFiles/CommonCore.dir/all] Error 2  
make: \*\*\* [makefile:141: all] Error 2

‘File too big’. Have to find out this now.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 9, 2020, 10:40pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/9 "2020-11-09T22:40:22Z")

</div>

Oh… I see you chose “Unix Makefiles”

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [November 9, 2020, 10:49pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/10 "2020-11-09T22:49:12Z")

</div>

Need this switch now:

-Wa,-mbig-obj

> <https://stackoverflow.com/questions/16596876/object-file-has-too-many-sections>

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 9, 2020, 10:49pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/11 "2020-11-09T22:49:42Z")

</div>

From the errors, you need to enable “big object” support: `-Wa,-mbig-obj` (GNU) or `/bigobj` (Visual Studio). These can be set in your `CMAKE_CXX_FLAGS` and `CMAKE_C_FLAGS` CMake variables.

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [November 9, 2020, 10:59pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/12 "2020-11-09T22:59:00Z")

</div>

– Performing Test EIGEN\_COMPILER\_SUPPORT\_CPP11 - Failed  
– Performing Test standard\_math\_library\_linked\_to\_automatically  
– Performing Test standard\_math\_library\_linked\_to\_automatically - Failed  
– Performing Test standard\_math\_library\_linked\_to\_as\_m  
– Performing Test standard\_math\_library\_linked\_to\_as\_m - Failed  
CMake Error at ThirdParty/eigen/vtkeigen/CMakeLists.txt:123 (message):  
Can’t link to the standard math library. Please report to the Eigen  
developers, telling them about your platform.

Configuring incomplete.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 10, 2020, 11:18am UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/13 "2020-11-10T11:18:21Z")

</div>

Make sure the Eigen third party source is of the latest version. There is a recent bug in one of its CMake files: [https://gitlab.com/libeigen/eigen/-/commit/ecb7bc9514b12051d050299234b2a74ac76b5a8e](https://gitlab.com/libeigen/eigen/-/commit/ecb7bc9514b12051d050299234b2a74ac76b5a8e) .

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [January 13, 2021, 12:04pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/14 "2021-01-13T12:04:48Z")

</div>

This issue [cmake failure Can’t link to the standard math library (#538) · Issues · libeigen / eigen · GitLab](https://gitlab.com/libeigen/eigen/-/issues/538)

But VtK-9.0.1/ThirdParty/eigen is an old simplified version. New version eigen is a bit hard to build.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 13, 2021, 2:14pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/15 "2021-01-13T14:14:26Z")

</div>

Well, if upgrading (the recommended action to fix the bug) is not an option, then you can try tweaking Eigen’s CMake script that come with VTK: `cmake/FindStandardMathLibrary.cmake`:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/d689b6d5fc5d1c6f43cee0eddea815f49c8ad0cb.png)

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [January 13, 2021, 11:37pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/16 "2021-01-13T23:37:48Z")

</div>

I can compile that little program, but still got that error. I left a comment under that issue.

Bypassing this check, I finished to configure.

I use :  
set (CMAKE\_CXX\_FLAGS “-std=c++0x -Wa -mbig-obj”)

When Make, got an error:

```
[1%] Building CXX object Utilities/KWSys/vtksys/CMakeFiles/vtksys.dir/Directory.cxx.obj
g++.exe: error: unrecognized command line option '-Wa'; did you mean '-W'?
g++.exe: error: unrecognized command line option '-mbig-obj'
make[2]: *** [Utilities/KWSys/vtksys/CMakeFiles/vtksys.dir/build.make:153: Utilities/KWSys/vtksys/CMakeFiles/vtksys.dir/Directory.cxx.obj] Error 1

```

Searching for -mbig-obj, got this:  
[c++ - GCC equivalent of MS’s /bigobj - Stack Overflow](https://stackoverflow.com/questions/16596876/gcc-equivalent-of-mss-bigobj)

Change ‘-Wa -mbig-obj’ with ‘-O1’, the Make can keep going.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 14, 2021, 2:21pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/17 "2021-01-14T14:21:42Z")

</div>

I recommend you to use MinGW64 instead of MinGW. MinGW64 supports `-Wa -mbig-obj`. I use it myself. Home page: [http://mingw-w64.org/doku.php](http://mingw-w64.org/doku.php) .

---

<div class="post-metadata">

### Author: ![cean\_wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cean_wang/32/2570_2.png) [@cean\_wang](https://discourse.vtk.org/u/cean_wang)
#### Post date: [January 17, 2021, 11:22pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/18 "2021-01-17T23:22:37Z")

</div>

This eq-gnu compiler I am using has an x86\_64-w64-mingw32 sub folder. So it’s also a MINGW.

Running into error with mutex, I decided to give MinGW a go. I downloaded [x86\_64-posix-sjlj](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/sjlj/x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0.7z), also I changed to use MinGW generator. Then I finished build VTK.

Also tried to build a test project like this: [Help to Build project under WIn 10 - Support - VTK](https://discourse.vtk.org/t/help-to-build-project-under-win-10/4585/9)

After changing the setting of RenderingContextOpenGL2 from DEFAULT to YES, I got the project running. This time I changed it by editing the CMakeCache.txt file.

I think the eq-gnu compiler is the same as [x86\_64-win32-sjlj](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z), but has a newer version c/c++.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 18, 2021, 1:26pm UTC](https://discourse.vtk.org/t/help-to-compile-thirdparty-loguru-under-windows-10-with-gnu-c-9-2/4588/19 "2021-01-18T13:26:21Z")

</div>

It’s good that you managed to compile VTK, but you are restricted to 32-bit binaries with MinGW. MinGW64, despite its name, is a different project and, thus, a different toolset. Alternatively, you can try Visual Studio Community to have 64-bit capability in Windows. With 32-bit, you may run into problems if your project grows by including certain header-only libraries like Boost, Eigen and ExpressTK, as they tend to result in too many symbols in your program, especially in Debug mode. 32-bit programs are also prone to memory fragmentation which is more likely as your scene grows in complexity.
