Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Mono module on Windows 11 throws RuntimeError: File Not found. #64765

Closed
mrbbbaixue opened this issue Aug 23, 2022 · 3 comments · Fixed by #64922
Closed

Build Mono module on Windows 11 throws RuntimeError: File Not found. #64765

mrbbbaixue opened this issue Aug 23, 2022 · 3 comments · Fixed by #64922

Comments

@mrbbbaixue
Copy link
Contributor

Godot version

4.0.dev (commit ebd966a)

System information

Windows 11 x64 10.0.22000.856, Vulkan

Issue description

When compile godot with module_mono_enabled=yes on Windows 11, Scons throws error below:

PS F:\Github\godot> scons -j6 platform=windows target=release_debug module_mono_enabled=yes
scons: Reading SConscript files ...
Configuring for Windows: target=release_debug, bits=default
Found MSVC version 14.3, arch amd64, bits=64
Found .NET Core Sdk root directory: C:\Program Files\dotnet
RuntimeError: File not found: C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win10-x64\6.0.7\runtimes\win10-x64\native\libnethost.lib:
  File "F:\Github\godot\SConstruct", line 852:
    SConscript("modules/SCsub")
  File "C:\Users\user\anaconda3\lib\site-packages\SCons\Script\SConscript.py", line 660:
    return method(*args, **kw)
  File "C:\Users\user\anaconda3\lib\site-packages\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\user\anaconda3\lib\site-packages\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "F:\Github\godot\modules\SCsub", line 34:
    SConscript(base_path + "/SCsub")
  File "C:\Users\user\anaconda3\lib\site-packages\SCons\Script\SConscript.py", line 660:
    return method(*args, **kw)
  File "C:\Users\user\anaconda3\lib\site-packages\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\user\anaconda3\lib\site-packages\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "F:\Github\godot\modules\mono\SCsub", line 12:
    mono_configure.configure(env, env_mono)
  File "F:\Github\godot\modules\mono\build_scripts\mono_configure.py", line 45:
    check_app_host_file_exists("libnethost.lib" if os.name == "nt" else "libnethost.a")
  File "F:\Github\godot\modules\mono\build_scripts\mono_configure.py", line 36:
    raise RuntimeError("File not found: " + file_path)

My folder structure in C:\Program Files\dotnet\packs\
image

I can find libnethost.lib in C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win-x64\6.0.8\runtimes\win-x64\native
image

Run dotnet --info returns:

PS F:\Github\godot> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.400
 Commit:    7771abd614

运行时环境 (Runtime Environment):
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.400\

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  5.0.102 [C:\Program Files\dotnet\sdk]
  6.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Seems it's a windows-only issue that dotnet's RID is still win10-x64 even on Windows 11? Maybe we should use a more reliable way to scan libnethost.lib.

Steps to reproduce

  1. Clone godot repo.
  2. Install Visual Studio 2022 17.3.1 with .NET Desktop workload.
  3. Build with scons -j6 platform=windows target=release_debug module_mono_enabled=yes

Minimal reproduction project

None.

@mrbbbaixue mrbbbaixue changed the title Build Mono (NET 6) module on Windows 11 throws RuntimeError: File Not found. Build Mono module on Windows 11 throws RuntimeError: File Not found. Aug 23, 2022
@akien-mga akien-mga added this to the 4.0 milestone Aug 23, 2022
@raulsntos
Copy link
Member

To find libnethost.lib we first try with a path formed in this way:

def get_runtime_path():
return os.path.join(
dotnet_root,
"packs",
"Microsoft.NETCore.App.Host." + runtime_identifier,
app_host_version,
"runtimes",
runtime_identifier,
"native",
)

The runtime_identifier is determined as win-x64 in your case which seems correct and the app_host_version is determined by executing dotnet --list-runtimes and trying to get the first one that matches the right version (should be Microsoft.NETCore.App and at loosely 6.0).

If the formed path is not found then it falls back to using dotnet --info to get the runtime identifier and use that to form the path which fails, so both ways failed to form a valid path.

I think the first way should have worked but it seems the dotnet --list-runtimes is returning 6.0.7 as the version while the path you have is 6.0.8, that seems to be a problem with .NET packaging so check if there is an update of the .NET SDK that fixes this.

@mrbbbaixue

This comment was marked as outdated.

@derammo
Copy link
Contributor

derammo commented Aug 23, 2022

I just hit this too. Maybe reconsider whether this can really be closed if it is super normal for people to hit this when they try to compile the C# feature? Maybe our SConstruct should actually check for this situation? @akien-mga

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants