shawwn / noh

An open source implementation of Icefrog's DotA, with a pretty amazing engine. Builds in 3 minutes flat; cross-platform.
197 stars 31 forks source link

Building on Windows failed: LINK: fatal error LNK1104: cannot open file 'game_shared.lib' #4

Open adcimon opened 1 year ago

adcimon commented 1 year ago

Hi,

I tried to make a build for Windows following the instructions, and after solving the issue https://github.com/shawwn/noh/issues/1, in the building step, I am getting the following error:

...
[599/629] Building CXX object CMakeFiles\editor_client.dir\src\editor\c_xmlproc_skylistitems.cpp.obj
[600/629] Building CXX object CMakeFiles\K2_ModelViewer.dir\src\shell\misc_cmds.cpp.obj
[601/629] Building CXX object CMakeFiles\bet_client.dir\src\bet_client\c_gameclient.cpp.obj
[602/629] Building CXX object CMakeFiles\K2_ModelViewer.dir\src\shell\main_win32.cpp.obj
[603/629] Linking CXX shared library game_shared.dll
[604/629] Linking CXX shared library hon_shared.dll
FAILED: hon_shared.dll hon_shared.lib 
cmd.exe /C "cd . && "C:\Program Files\JetBrains\CLion 2023.1.4\bin\cmake\win\x64\bin\cmake.exe" -E vs_link_dll --intdir=CMakeFiles\hon_shared.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x86\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\hon_shared.rsp  /out:hon_shared.dll /implib:hon_shared.lib /pdb:hon_shared.pdb /dll /version:0.0 /machine:X86 /debug /INCREMENTAL  && cmd.exe /C "cd /D C:\Users\aciborro\Projects\noh\cmake-build-release && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/Users/aciborro/.clion-vcpkg/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/aciborro/Projects/noh/cmake-build-release/hon_shared.dll -installedDir C:/Users/aciborro/Projects/noh/cmake-build-release/vcpkg_installed/x86-windows/bin -OutVariable out && cd /D C:\Users\aciborro\Projects\noh\cmake-build-release && "C:\Program Files\JetBrains\CLion 2023.1.4\bin\cmake\win\x64\bin\cmake.exe" -E copy C:/Users/aciborro/Projects/noh/cmake-build-release/hon_shared.dll "C:/Users/aciborro/Projects/noh/Heroes of Newerth/hon_shared.dll" && cd /D C:\Users\aciborro\Projects\noh\cmake-build-release && "C:\Program Files\JetBrains\CLion 2023.1.4\bin\cmake\win\x64\bin\cmake.exe" -E copy C:/Users/aciborro/Projects/noh/cmake-build-release/hon_shared.dll C:/Users/aciborro/Projects/noh/Beatopia/hon_shared.dll""
LINK Pass 1: command "C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\hon_shared.rsp /out:hon_shared.dll /implib:hon_shared.lib /pdb:hon_shared.pdb /dll /version:0.0 /machine:X86 /debug /INCREMENTAL /MANIFEST /MANIFESTFILE:CMakeFiles\hon_shared.dir/intermediate.manifest CMakeFiles\hon_shared.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'game_shared.lib'

Windows 11 CLion 2023.1.4 (Build #CL-231.9161.40, built on June 20, 2023) Visual Studio 2022 Community Version 17.0 Architecture: x86 Version: 8.1 or Windows 10 SDK CMake (Bundled): 3.25.2 Build Tool: ninja.exe C Compiler: cl.exe C++ Compiler: cl.exe Debbuger (Bundled): LLDB 9.0

Thank you.

ZOulhadj commented 10 months ago

I am getting the same type of error. It's strange since the game_shared library does indeed get built but the hon_shared library cant seem to link to it.

DebugArrow commented 4 months ago

Any new info about this error? i also get it.

shawwn commented 4 months ago

I bet this is due to a misconfiguration in the CMakeLists.txt file for 32-bit architectures. I've only tested 64-bit, mostly because I don't have access to a 32-bit windows machine.

I guess building on 32-bit Windows has never worked. It's frustrating because CMakeLists.txt has very[1] few[2] explicit[3] checks for 64-bit vs 32-bit, so everything should theoretically "just work." But in practice, untested build configurations almost never work.

Could anyone provide 1. a complete log of the build output, 2. a complete file list of everything that was built? Then I can compare those against the successful 64-bit build and see if there are any notable differences.

Alternatively, if anyone has ideas on how I could debug this without access to a 32-bit Windows machine, please let me know. Is there a way to spin up a 32-bit Windows box on Azure somehow with visual studio preinstalled?

(On the off-chance that any of you are comfortable with me remoting into your machine via TeamViewer so I can debug this live, that'd be the most straightforward way to solve it, since I'd be able to try different things on your box until the build stops failing. If you're interested, say so here, and then we can coordinate via twitter DM to set up a teamviewer session.)

DebugArrow commented 4 months ago

I bet this is due to a misconfiguration in the CMakeLists.txt file for 32-bit architectures. I've only tested 64-bit, mostly because I don't have access to a 32-bit windows machine.

I guess building on 32-bit Windows has never worked. It's frustrating because CMakeLists.txt has very[1] few[2] explicit[3] checks for 64-bit vs 32-bit, so everything should theoretically "just work." But in practice, untested build configurations almost never work.

Could anyone provide 1. a complete log of the build output, 2. a complete file list of everything that was built? Then I can compare those against the successful 64-bit build and see if there are any notable differences.

Alternatively, if anyone has ideas on how I could debug this without access to a 32-bit Windows machine, please let me know. Is there a way to spin up a 32-bit Windows box on Azure somehow with visual studio preinstalled?

(On the off-chance that any of you are comfortable with me remoting into your machine via TeamViewer so I can debug this live, that'd be the most straightforward way to solve it, since I'd be able to try different things on your box until the build stops failing. If you're interested, say so here, and then we can coordinate via twitter DM to set up a teamviewer session.)

Hello, let's talk tomorrow about this, btw, my zone time GMT+3.

DebugArrow commented 4 months ago

I bet this is due to a misconfiguration in the CMakeLists.txt file for 32-bit architectures. I've only tested 64-bit, mostly because I don't have access to a 32-bit windows machine.

I guess building on 32-bit Windows has never worked. It's frustrating because CMakeLists.txt has very[1] few[2] explicit[3] checks for 64-bit vs 32-bit, so everything should theoretically "just work." But in practice, untested build configurations almost never work.

Could anyone provide 1. a complete log of the build output, 2. a complete file list of everything that was built? Then I can compare those against the successful 64-bit build and see if there are any notable differences.

Alternatively, if anyone has ideas on how I could debug this without access to a 32-bit Windows machine, please let me know. Is there a way to spin up a 32-bit Windows box on Azure somehow with visual studio preinstalled?

(On the off-chance that any of you are comfortable with me remoting into your machine via TeamViewer so I can debug this live, that'd be the most straightforward way to solve it, since I'd be able to try different things on your box until the build stops failing. If you're interested, say so here, and then we can coordinate via twitter DM to set up a teamviewer session.)

Hello, i can't contact you via twitter, i don't have premium and i am not gonna buy premium for that, we can use discord or any other way to talk? Please, leave a message here or dm me or add this account on discord : cosmicrevolution If you can't find "cosmicrevolution" try to add Fledermaus.

shawwn commented 4 months ago

It looks like Twitter defaulted me to "only verified users are allowed to DM me," which is annoying. I specifically kept my DMs as open as possible.

It should work now. Can you message me?

On Sun, Apr 28, 2024 at 4:48 AM DebugArrow @.***> wrote:

I bet this is due to a misconfiguration in the CMakeLists.txt file for 32-bit architectures. I've only tested 64-bit, mostly because I don't have access to a 32-bit windows machine.

I guess building on 32-bit Windows has never worked. It's frustrating because CMakeLists.txt https://raw.githubusercontent.com/shawwn/noh/main/CMakeLists.txt has very[1] https://github.com/shawwn/noh/blob/66c8c407ef9df07704d551c5c2e6b4f007610e06/CMakeLists.txt#L347 few[2] https://github.com/shawwn/noh/blob/66c8c407ef9df07704d551c5c2e6b4f007610e06/CMakeLists.txt#L372 explicit[3] https://github.com/shawwn/noh/blob/66c8c407ef9df07704d551c5c2e6b4f007610e06/CMakeLists.txt#L469 checks for 64-bit vs 32-bit, so everything should theoretically "just work." But in practice, untested build configurations almost never work.

Could anyone provide 1. a complete log of the build output, 2. a complete file list of everything that was built? Then I can compare those against the successful 64-bit build and see if there are any notable differences.

Alternatively, if anyone has ideas on how I could debug this without access to a 32-bit Windows machine, please let me know. Is there a way to spin up a 32-bit Windows box on Azure somehow with visual studio preinstalled?

(On the off-chance that any of you are comfortable with me remoting into your machine via TeamViewer so I can debug this live, that'd be the most straightforward way to solve it, since I'd be able to try different things on your box until the build stops failing. If you're interested, say so here, and then we can coordinate via twitter DM https://twitter.com/theshawwn to set up a teamviewer session.)

Hello, i can't contact you via twitter, i don't have premium and i am not gonna buy premium for that, we can use discord or any other way to talk? Please, leave a message here or dm me or add this account on discord : cosmicrevolution If you can't find "cosmicrevolution" try to add Fledermaus.

— Reply to this email directly, view it on GitHub https://github.com/shawwn/noh/issues/4#issuecomment-2081414531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOR4GDIMRVWMB3YAQQTJLY7TAVDAVCNFSM6AAAAAA2XCHZU2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGQYTINJTGE . You are receiving this because you commented.Message ID: @.***>

Handfish commented 4 months ago

Just ran into this issue under Windows 11 - 64-bit operating system, x64-based processor. Any resolutions to this linking issue? LINK : fatal error LNK1104: cannot open file 'game_shared.lib'

I don't believe game_shared.lib is ever built when I run cmake / build

Maybe its time to get a 2nd drive and dual boot Ubuntu 😆

Handfish commented 4 months ago

I am also willing to provide full logs / teamviewer if the offer still stands.

Handfish commented 4 months ago

Hi guys,

The solution is to add set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

to this block https://github.com/shawwn/noh/blob/main/CMakeLists.txt#L85-L92.

I'll make a pull.

shawwn commented 4 months ago

Can anyone else confirm that the windows build works now?

Handfish commented 4 months ago

Just as a reminder to the others who may try - #include <functional> needs to be added as described in issue #1, but I didn't want to include that in the pull as I don't know how that might impact other OS