greenfork / nimraylib_now

The Ultimate Raylib gaming library wrapper for Nim
MIT License
149 stars 16 forks source link

Crash when compiling with Arraymancer #40

Open XDEmer0r-L0rd-360-G0d-SlayerXD opened 3 years ago

XDEmer0r-L0rd-360-G0d-SlayerXD commented 3 years ago

I'm writing a program, and it runs fine until I import nimraylib_now, to which it then crashes. I'm not using anything from raylib, but just importing is causes the error.

C:\Users\Nicholas\nimcache\Engine0_2_d\@mC@c@sUsers@sNicholas@s.nimble@spkgs@sarraymancer-0.6.2@sarraymancer@slaser@scpuinfo_x86.nim.c: In function 'cpuidX86__eyvyT5w2JfkohhKOIohiAg':
C:\Users\Nicholas\nimcache\Engine0_2_d\@mC@c@sUsers@sNicholas@s.nimble@spkgs@sarraymancer-0.6.2@sarraymancer@slaser@scpuinfo_x86.nim.c:192:21: error: expected ')' before ':' token
  asm("      cpuid\n"
                     ^
                     )
       :"=a"(eaxr), "=b"(ebxr), "=c"(ecxr), "=d"(edxr)
       ~
Error: execution of an external compiler program 'gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -Wall -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -s -O1 -Werror=implicit-function-declaration -IC:\Users\Nicholas\.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled -IC:\Users\Nicholas\.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include -IC:\Users\Nicholas\.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DPHYSAC_IMPLEMENTATION -DPHYSAC_NO_THREADS -DRAYGUI_IMPLEMENTATION   -IC:\Users\Nicholas\.choosenim\toolchains\nim-1.4.4\lib -IE:\dump\Git\Hydris -o C:\Users\Nicholas\nimcache\Engine0_2_d\@mC@c@sUsers@sNicholas@s.nimble@spkgs@sarraymancer-0.6.2@sarraymancer@slaser@scpuinfo_x86.nim.c.o C:\Users\Nicholas\nimcache\Engine0_2_d\@mC@c@sUsers@sNicholas@s.nimble@spkgs@sarraymancer-0.6.2@sarraymancer@slaser@scpuinfo_x86.nim.c' failed with exit code: 1

I can try to provide a little more information if needed

greenfork commented 3 years ago

It could be connected to that importing nimraylib_now requires these flags: https://github.com/greenfork/nimraylib_now/blob/920240c776777b125080aa71e01e6472f4899cf7/src/nimraylib_now/raylib_build_static.nim#L75-L78

And somehow it messes up asm instructions in arraymancer. I don't really have a good context on what happens in arraymancer and since the error in that library's file maybe it's better to ask the author of arraymancer to give some context. There are more flags passed to C, for all builds we also pass https://github.com/greenfork/nimraylib_now/blob/920240c776777b125080aa71e01e6472f4899cf7/src/nimraylib_now/raylib_build_static.nim#L24

and

https://github.com/greenfork/nimraylib_now/blob/920240c776777b125080aa71e01e6472f4899cf7/src/nimraylib_now/raylib_build_static.nim#L30-L32