"nimble build" fails on Windows - OpenMesh, AntTweakBar, etc. Errors
Closed this issue · 8 comments
I'm trying to get the project building on Windows to play with it (using a freshly downloaded Nim install), but nimble keeps failing on the OpenMesh dependency:
$ nimble build
Verifying dependencies for fancygl@0.3.2
Info: Dependency on AntTweakBar@>= 1.0.2 already satisfied
Verifying dependencies for AntTweakBar@1.0.2
Info: Dependency on sdl2_nim@>= 2.0.6.1 already satisfied
Verifying dependencies for sdl2_nim@2.0.10.0
Info: Dependency on glm@>= 1.1.1 already satisfied
Verifying dependencies for glm@1.1.1
Info: Dependency on ast_pattern_matching@>= 1.0.0 already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
Installing OpenMesh@>= 0.1.0
Prompt: OpenMesh not found in any local packages.json, check internet for updated packages? [y/N]
Answer: y
Downloading Official package list
Success Package list downloaded.
Tip: 15 messages have been suppressed, use --verbose to show them.
Error: Package not found.
Is there a way to disable this dependency or work around this issue?
-
I managed to comment out the OpenMesh dependency in the "requires" list in fancygl.nimble, and got the first few examples building. The "openmesh.nim" example doesn't look like it's one of those that's supposed to get built - is it one of the broken ones that the readme refers to?
-
The following errors occurred with the AntTweakBar Nim library that
iqm_mesh_loading.exerequires. I should probably file a bugreport of these issues on that library's issue tracker when I get time later, but I thought I'd include some notes here in case it helps anyone out in future.
2a) Include path problems with AntTweakBar.nim --> getAntTweakBarPath()
... Error: execution of an external compiler program 'gcc.exe -c -w -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -I/cAntTweakBar/include -O3 -Wall -fPIC -fno-strict-aliasing -D__PLACEMENT_NEW_INLINE -IC:\Apps\nim\lib -IE:\libs\nim\graphics\opengl-sandbox\examples -o C:\Users\Joshua\nimcache\iqm_mesh_loading_d\TwEventWin.c.o C:\Users\Joshua\.nimble\pkgs\AntTweakBar-1.0.2\cAntTweakBar\src\TwEventWin.c' failed with exit code: 1
... C:\Users\Joshua\.nimble\pkgs\AntTweakBar-1.0.2\cAntTweakBar\src\TwEventWin.c:15:10: fatal error: AntTweakBar.h: No such file or directory
... #include <AntTweakBar.h>
... ^~~~~~~~~~~~~~~
... compilation terminated.
I managed to patch around that by amending AntTweakBar.nim` (the build-script parts) with the following:
when defined(windows):
from strutils import strip
proc getAntTweakBarPath(): string {.compileTime} =
# On Windows with nim 1.0.2, I'm only getting two lines of output from the "nimble path" command: 1) the path we want, 2) a blank line.
result = strip(staticExec("nimble path AntTweakBar"))
else:
... # <-- the existing getAntTweakBarPath() implementation goes here
2b) This however is then followed by errors about #include "release64\TwDirect3D11_LineRectVS.h" not being found in cAntTweakBar\src\TwDirect3D11.cpp.
From the comments in that file, it looks like those header files need to be generated by a pre-compilation step (using the standalone shader compiler - fxc.exe).
I temporarily tried working around this by just commenting out the TWDirect3D<XX>.cpp includes. This gets fixes the immediate compile problem, but ends up breaking later when linking (as lots of event symbol lookups fail. Hopefully I'll manage to get this working, otherwise, I'll just comment out the iqm_mesh_loading example from being built.
2c) The -lGL thing linker flag fails on Linux. AntTweakBar.nim needs to be modified so that Windows will pass -lopengl instead.
Thank you for testing this project on windows. While I use platform independent libraries only, I do not own any version of windows to test things on. Your feedback is well received.
regarding AntTweakBar, since I am the author of those wrappers as well, thank you for your feedback. I didn't know that AntTweakBar had this complicated build process to work on windows. Maybe you can disable the compilation of TwDirect3D11 for now somehow, since the OpenGL backend will be used here anyway.
You may also disable the AntTweakBar code in iqm_mesh_loading. The UI here really is just sugar, nothing important. I integrated it for the reason to have something with AntTweakBar, not because AntTweakBar does something important here. Maybe I should move give AntTweakBar anther example when it causes trouble.
regarding 2c) yes that should be easy to fix. Sorry for that one.
There is another thing. Yesterday I found out there is a bug in Nim that causes trouble in this project:
nim-lang/Nim#12670
This certainly causes problems in some examples where wrong glsl types are generated.
And yes, regarding OpenMesh, that one is mostly a construction site. I did it mostly as a debugging project to develop the OpenMesh library.
@Aligorith can you try to run the base example for AntTweakBar here: https://github.com/krux02/nimAntTweakBar/blob/master/twsimplesdl.nim ? I would really like nimAntTweakBar to run on Windows as well and your feedback is very welcome.
regarding the issue from nim-lang, I implemented a workaround, that should work now again.
@krux02 I've been taking a look at getting that compiling
What I've had to do so far:
- Apply the getAntTweakBarPath() fix to that repo too
- Change the "opengl" for Windows to "opengl32"
- Loaded the solution file for the AntTweakBar in Visual Studio, and tried to build. That failed, but I did manage to get some of the headers that fxc generates. Just leaving them around resolves the gcc errors about not finding those headers. The relevant commands to run this manually are in the solution file
- The next problem I ran into was heaps of linker errors about all the hooks for each and every library's symbols being undefined:
All errors
``` C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x8e): undefined reference to `__imp_TwMouseWheel' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0xe9): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x131): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x15f): undefined reference to `__imp_TwWindowSize' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x252): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x35c): undefined reference to `__imp_TwKeyTest' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x3d5): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x3f5): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x40f): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x435): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x45c): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x4a9): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventWin.c.o:TwEventWin.c:(.text+0x59f): undefined reference to `__imp_TwKeyTest' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0xee6): undefined reference to `__imp_TwDeleteBar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x4833): undefined reference to `__imp_TwSetTopBar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x4890): undefined reference to `__imp_TwSetBottomBar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x12613): undefined reference to `__imp_TwDeleteBar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x1264c): undefined reference to `__imp_TwNewBar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x1281a): undefined reference to `__imp_TwAddButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x12d92): undefined reference to `__imp_TwDeleteBar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwBar.cpp.o:TwBar.cpp:(.text+0x18418): undefined reference to `__imp_TwRemoveVar' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x2a): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x3a): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x4a): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x11e): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x143): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x2fe): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x33a): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x34a): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x35a): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x38e): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x3a3): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLFW.c.o:TwEventGLFW.c:(.text+0x3b3): undefined reference to `__imp_TwMouseWheel' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0x18): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0x50): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0x64): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0x73): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0xeb): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0x126): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventGLUT.c.o:TwEventGLUT.c:(.text+0x18a): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0x38): undefined reference to `__imp_TwWindowSize' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0x76): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0x8f): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0xb4): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0xca): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0xf1): undefined reference to `__imp_TwMouseWheel' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL12.c.o:TwEventSDL12.c:(.text+0xff): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0x58): undefined reference to `__imp_TwWindowSize' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0xae): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0xd7): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0x11b): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0x171): undefined reference to `__imp_TwMouseWheel' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0x17f): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0x195): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL13.c.o:TwEventSDL13.c:(.text+0x1d6): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL20.c.o:TwEventSDL20.c:(.text+0x7b): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL20.c.o:TwEventSDL20.c:(.text+0x8e): undefined reference to `__imp_TwWindowSize' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL20.c.o:TwEventSDL20.c:(.text+0xbb): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL20.c.o:TwEventSDL20.c:(.text+0xcd): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSDL20.c.o:TwEventSDL20.c:(.text+0xf2): undefined reference to `__imp_TwMouseWheel' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x5d): undefined reference to `__imp_TwMouseMotion' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x69): undefined reference to `__imp_TwWindowSize' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0xa5): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x158): undefined reference to `__imp_TwMouseWheel' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x198): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x1f2): undefined reference to `__imp_TwKeyPressed' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x273): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x28f): undefined reference to `__imp_TwMouseButton' C:\Users\Joshua\nimcache\twsimplesdl_d\TwEventSFML.cpp.o:TwEventSFML.cpp:(.text+0x29a): undefined reference to `__imp_TwKeyPressed' collect2.exe: error: ld returned 1 exit status ```I wonder whether it might be easier to wrap this library on Windows by using dynamic calls to a pre-built .dll like the SDL libraries do currently, in order to bypass the whole MSVC-path/environment problems that building the library from source each time would entail. I might give that a try when I get time over the next few days.
I think it might be best to drop out the DirectX backend for the AntTweakBar wrapper. It is mostly causing trouble and there isn't any DirectX wrapper in sight, so these backends can't be used anyway.
Regarding your error messages. I am not used to Microsoft error messages. I don't know what this prefix __imp_ means. To my knowledge everything that starts with __ is reserved for compiler specific symbols. And then I also can't find anything in the source that starts with __imp_. Without the prefix these symbols should be defined in TwMgr.cpp.
OK, I disabled AntTweakBar in iqm_mesh_loading by default for now. It should build now. Please test it again. Thanks a lot for tying out this project, and many thanks more for providing feedback.
By now the project ditched nimble in favor of submoduled and a nim.cfg file. I dislike submodules, but I disleke them less than nimble. The project should be reproducable by now. Tell me if I can close the issue.
I just assume the issue has been fixed or the interest is just gone by now. Anyway feel free to reopen a new issue, if there are still problems left.