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

Code-Only Development on Linux (Ubuntu) Requires Manual File Copying #2596

Open
VaclavElias opened this issue Jan 18, 2025 · 9 comments
Open
Labels
bug Something isn't working

Comments

@VaclavElias
Copy link
Contributor

VaclavElias commented Jan 18, 2025

Release Type: Official Release

Version: 4.2.0.2293

Platform(s): Linux

Describe the bug
I am able to build and run code-only on Linux but I have to manually copy files here: /home/vaso/.nuget/packages/stride.core.assets.compilerapp/4.2.0.2293/lib/net8.0, see the step 8 below.

To Reproduce
Steps to reproduce the behavior: Steps are below

Expected behavior
There shouldn't be a manual fiddling with Stride files.

Screenshots
Below

Log and callstacks
N/a

Additional context

  1. Ensure your Linux distribution is up to date and has an IDE like VS Code or Rider installed.
  2. Install the .NET 8 SDK:
    sudo apt-get install -y dotnet-sdk-8.0
  3. Verify the .NET SDK installation:
    dotnet --list-sdks
  4. Install the required native libraries as outlined in Stride Linux Setup Requirements:
    sudo apt install libfreetype6-dev
    sudo apt install libopenal-dev
    sudo apt install libsdl2-dev
    sudo apt install libfreeimage-dev
  5. Create a simple code-only project:
    • Add the Stride.CommunityToolkit NuGet package instead of Stride.CommunityToolkit.Windows (We should create probably a package called Stride.CommunityToolkit.Linux).
    • Add the Stride.Core.Assets.CompilerApp NuGet package.
    • Do not build the project yet.
  6. Update your project file (.csproj) to include the following properties (Add RuntimeIdentifier and StrideGraphicsApi, add IncludeAssets to the PackageReference):
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
        <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
        <StrideGraphicsApi>OpenGL</StrideGraphicsApi>
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Include="Stride.CommunityToolkit" Version="1.0.0-preview.49" />
        <PackageReference Include="Stride.Core.Assets.CompilerApp" Version="4.2.0.2293" IncludeAssets="build;buildTransitive" />
      </ItemGroup>
    </Project>
  7. You should be able to build the project successfully with dotnet build
  8. Manual Step: Copy the following .so files to /home/vaso/.nuget/packages/stride.core.assets.compilerapp/4.2.0.2293/lib/net8.0:
    • /home/vaso/.nuget/packages/stride.physics/4.2.0.2293/runtimes/linux-x64/native/libbulletc.so
    • /home/vaso/.nuget/packages/stride.assets/4.2.0.2293/runtimes/linux-x64/native/VHACD.so
    • /home/vaso/.nuget/packages/stride.textureconverter/4.2.0.2293/runtimes/linux-x64/native/DxtWrapper.so
    • /home/vaso/.nuget/packages/stride.textureconverter/4.2.0.2293/runtimes/linux-x64/native/PVRTextLib.so
  9. You should be able to run application dotnet run and see this below (The black debug text is another issue..)
Image

If you skip step 8, you might get this error:

vaso@vaso-stride:~/Projects/Project01$ dotnet build
MSBuild version 17.8.5+b5265ef37 for .NET
  Determining projects to restore...
  Restored /home/vaso/Projects/Project01/Project01.csproj (in 1.14 sec).
  Patch for assembly [Project01, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]
  Project01 -> /home/vaso/Projects/Project01/bin/Debug/net8.0/linux-x64/Project01.dll
  Unhandled exception. System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
   ---> System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
   ---> System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
   ---> System.InvalidOperationException: Could not load native library libbulletc using CPU architecture x64.
     at Stride.Core.NativeLibraryHelper.PreloadLibrary(String libraryName, Type owner) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\core\Stride.Core\Native\NativeLibraryHelper.cs:line 123
     at Stride.Engine.Module.Initialize() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Physics\Module.cs:line 18
     at Stride.Core.CompilerServices.AutoGenerated.ModuleInitializer.<ModuleInitializer>F5D91558074716FFC11AFA8A899C97D0B6F82A81622FFA2C3017C0F689B8C9D8E__ModuleInitializer.Initialize() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Physics\obj\Release\net8.0\Stride.Core.CompilerServices\Stride.Core.CompilerServices.Generators.ModuleInitializerGenerator\ModuleInitializer.cs:line 9
     at .cctor()
     --- End of inner exception stack trace ---
     at UpdateEngineAutoGenerated.UpdateMain0()
     at .cctor()
     --- End of inner exception stack trace ---
     at Stride.Core.DataSerializers.Stride_Core_Assets_CompilerAppSerializerFactory.Initialize()
     at .cctor()
     --- End of inner exception stack trace ---
  Aborted (core dumped)
/home/vaso/.nuget/packages/stride.core.assets.compilerapp/4.2.0.2293/buildTransitive/Stride.Core.Assets.CompilerApp.targets(154,5): error MSB3073: The command "dotnet "/home/vaso/.nuget/packages/stride.core.assets.compilerapp/4.2.0.2293/buildTransitive/../lib/net8.0/Stride.Core.Assets.CompilerApp.dll"  --disable-auto-compile --project-configuration "Debug" --platform=Linux --project-configuration=Debug --compile-property:StrideGraphicsApi=OpenGL --output-path="/home/vaso/Projects/Project01/bin/Debug/net8.0/linux-x64/data" --build-path="/home/vaso/Projects/Project01/obj/stride/assetbuild/data" --package-file="/home/vaso/Projects/Project01/Project01.csproj" --msbuild-uptodatecheck-filebase="/home/vaso/Projects/Project01/obj/Debug/net8.0/linux-x64/stride/assetcompiler-uptodatecheck"" exited with code 134. [/home/vaso/Projects/Project01/Project01.csproj]

Build FAILED.

/home/vaso/.nuget/packages/stride.core.assets.compilerapp/4.2.0.2293/buildTransitive/Stride.Core.Assets.CompilerApp.targets(154,5): error MSB3073: The command "dotnet "/home/vaso/.nuget/packages/stride.core.assets.compilerapp/4.2.0.2293/buildTransitive/../lib/net8.0/Stride.Core.Assets.CompilerApp.dll"  --disable-auto-compile --project-configuration "Debug" --platform=Linux --project-configuration=Debug --compile-property:StrideGraphicsApi=OpenGL --output-path="/home/vaso/Projects/Project01/bin/Debug/net8.0/linux-x64/data" --build-path="/home/vaso/Projects/Project01/obj/stride/assetbuild/data" --package-file="/home/vaso/Projects/Project01/Project01.csproj" --msbuild-uptodatecheck-filebase="/home/vaso/Projects/Project01/obj/Debug/net8.0/linux-x64/stride/assetcompiler-uptodatecheck"" exited with code 134. [/home/vaso/Projects/Project01/Project01.csproj]
    0 Warning(s)
    1 Error(s)
@VaclavElias VaclavElias added the bug Something isn't working label Jan 18, 2025
@Jklawreszuk
Copy link
Collaborator

Note: You can also use samples to test out and sometimes this issue occurs too

@Kryptos-FR
Copy link
Member

Which command did you use to run after the initial build (and before step 8)?

@VaclavElias
Copy link
Contributor Author

I just updated the instructions above.

Build with dotnet build. Run with dotnet run which causes the errors mentioned at the end, unless I copy manually those files.

@Jklawreszuk
Copy link
Collaborator

I might found the cause of the problem.

Example: VHACD.
Current code it's looking for

~/.nuget/packages/stride.assets/4.2.0.1/lib/net8.0/*.so:

But correct path is :

~/.nuget/packages/stride.assets/4.2.0.1/runtimes/linux-x64/native/*.so

@VaclavElias
Copy link
Contributor Author

Nice digging. So is this a bug or just this wasn't ever tested and corrected?

@Jklawreszuk
Copy link
Collaborator

Everything is possible 😅

@VaclavElias
Copy link
Contributor Author

Stride is like a software from the future which we try to figure out 🤣

@Kryptos-FR
Copy link
Member

Kryptos-FR commented Feb 1, 2025

Was the code-only project built with runtime identifiers?

Edit: apparently yes according to the first post.

@Jklawreszuk
Copy link
Collaborator

Weird..I tried to debug the problem but it only fixed the path search..awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants