skeeto / w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
The Unlicense
2.68k stars 185 forks source link

only having win32 gcc #89

Closed raisfeld-ori closed 8 months ago

raisfeld-ori commented 8 months ago

i was recently having trouble with neovim, where every time i would compile my code, it would say that it is an "invalid win32 application". i tried looking at why did this happen, and i found out that they were compiling using gcc 13.2.0 from w64devkit. i tried using gcc -dumpmachine and it returned "x86_64-w64-mingw32" so i think my gcc target is win32 for some reason? i thought this repo might've had both win32 and win64 versions of gcc, but i could only find gcc and extra componenet (like gcc-ar, gcc-nm etc) inside of the bin directory. why does this happen and how can i fix this?

(i am using windows 11 with a 64bit machine)

Peter0x44 commented 8 months ago

@raisfeld-ori x86_64 means it is a compiler generating 64-bit code. The "32" is probably in the same sense of "WIN32 API", nothing inherently to do with 32 bits For example, -lws2_32 or -lopengl32 don't really have anything to do with 32 vs 64 bits

Could you elaborate on when you get this message? Is it when compiling or running your executable? Is it possible you have other installations of gcc on your system, that are conflicting with w64devkit?

raisfeld-ori commented 8 months ago

i figured that part out. it seems to me that ld constantly failed when trying to assemble any programs compiled outside of gcc (like neovim *.so files, 64bit assembly programs etc). i actually accidentally deleted my windows OS in the pc that has this error, so i can't really find out more than this. i tried to replicate it in my new computer, and this error occurred out of the box, even when i only had neovim and w64devkit installed

raisfeld-ori commented 8 months ago

this isn't an error with w64devkit. gcc's default settings are to find the OS type and compile to it, but if it can't, then it compiles into 32 bit machine code. to fix this issue, you just need to add the "-m64" to the gcc args, or turn the specs file's default option into 64 bits