Update MeshGL.h for successful build in Mingw Windows#2267
Update MeshGL.h for successful build in Mingw Windows#2267alecjacobson merged 1 commit intolibigl:mainfrom HomayoonT:main
Conversation
Added #include <cstdint> for fixing build failure mingw-w64 "w64devkit"
|
Thank you. And thanks for the tip about |
|
Also, do C++11 threads not work on Windows? I was under the impression that standard was well supported. |
I was reluctant to install Microsoft Visual Studio Compiler. So I tried to build libigl with MingW. On Windows 10, w64devkit passes the tests successfully. Here is what I am referring to: I also tried MingW builds but it would not pass the above tests.
However, I still cannot figure out why the tests do not pass for MingW builds.
I have not yet found an alternative solution. It seems there are reports of the same issue for building other libraries with MingW. For example, here. Libigl example project builds successfully by the fix, that is In addition, this might be irrelevant but while following libigl tutorials I found lines like this |
|
Thanks. Did you try the The cmake build system should be downloading the tutorial data automatically. It should get put in libigl/tutorial/data |
Regarding the compiler flag |
|
You could try timing the full test suite for a rough benchmark.
…On Fri, Sep 8, 2023, 1:24 PM HomayoonT ***@***.***> wrote:
Thanks.
Did you try the -Wa,-mbig flags mentioned in the link you sent?
The cmake build system should be downloading the tutorial data
automatically. It should get put in libigl/tutorial/data
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig") worked for me *after
a clean rebuild* (It took some time to build, Build completed:
00:11:08.439). Here is a complete report:
[build] [10/20 5% :: 2.620] Building C object _deps/glad-build/CMakeFiles/glad.dir/src/glad.c.obj
[build] [11/20 10% :: 3.187] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/init.c.obj
[build] [12/20 15% :: 3.251] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/context.c.obj
[build] [13/20 20% :: 3.291] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/vulkan.c.obj
[build] [14/20 25% :: 3.402] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/win32_joystick.c.obj
[build] [15/20 30% :: 3.513] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/window.c.obj
[build] [16/20 35% :: 3.531] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/monitor.c.obj
[build] [17/20 40% :: 3.541] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/win32_init.c.obj
[build] [18/20 45% :: 3.591] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/input.c.obj
[build] [18/20 50% :: 4.142] Linking C static library lib\libglad.a
[build] [18/20 55% :: 6.114] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/win32_time.c.obj
[build] [18/20 60% :: 6.129] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/win32_monitor.c.obj
[build] [18/20 65% :: 6.210] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/win32_thread.c.obj
[build] [18/20 70% :: 6.403] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/osmesa_context.c.obj
[build] [18/20 75% :: 6.465] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/wgl_context.c.obj
[build] [18/20 80% :: 6.520] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/egl_context.c.obj
[build] [18/20 85% :: 6.534] Building C object _deps/glfw-build/src/CMakeFiles/glfw.dir/win32_window.c.obj
[build] [19/20 90% :: 6.736] Linking C static library lib\libglfw3.a
[build] [19/20 95% :: 76.363] Building CXX object CMakeFiles/example.dir/main.cpp.obj
[build] [20/20 100% :: 668.097] Linking CXX executable example.exe
[driver] Build completed: 00:11:08.439
Regarding the compiler flag -Og, it seems it does some optimization. Here
is the link <https://stackoverflow.com/a/16179105/969718>. I also tested
-O1 and -O2 flags and they did actually work. I would be happy to know
how much performance boost would be gained by using -Wa,-mbig flags
instead of -Og. (Don't even know how one would go for benchmarking Libigl
for such cases)
—
Reply to this email directly, view it on GitHub
<#2267 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARDJGOMQWUYY2VQGXUIGZDXZNIGXANCNFSM6AAAAAA4OJ3LOM>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Added #include for fixing build failure for mingw-w64 "w64devkit"
The reason to use w64devkit on Windows is the toolchain includes pthreads, C++11 threads, and OpenMP.
Fixes the following types of errors in libigl example project:
libigl-example-project/build/_deps/libigl-src/include/igl/opengl/MeshGL.h:91:5: error: 'uint32_t' does not name a type 91 | uint32_t dirty_flag;andlibigl-example-project/build/_deps/libigl-src/include/igl/opengl/MeshGL.cpp:56:3: error: 'dirty' was not declared in this scope 56 | dirty = MeshGL::DIRTY_ALL;After the fix, the project builds successfully. However, the following line must be added to libigl-example-project
CMakeLists.txtto prevent the errorFatal error: CMakeFiles/example.dir/main.cpp.obj: file too bigfrom happening.set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")Checklist