bryanedds / Nu

Repository hosting the open-source Nu Game Engine and related projects.
MIT License
1.1k stars 155 forks source link

Nu/Core/Math.fs(104,36): error FS3214: Method or object constructor 'RollPitchYaw' is not static #641

Closed Ecsodikas closed 9 months ago

Ecsodikas commented 9 months ago

Hi everyone,

I'd love to try out this engine but I can't get it to run under Ubuntu 22.04.1. I followed the steps in the guide and ran the linux setup script, everything went through fine but when I run dotnet run in die Nu.Gaia project I get the following errors:

/home/ecsodikas/Repositories/Nu/Nu/Nu/Core/Math.fs(104,36): error FS3214: Method or object constructor 'RollPitchYaw' is not static [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Core/Math.fs(488,13): error FS3214: Method or object constructor 'RollPitchYaw' is not static [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Transform/Transform.fs(129,31): error FS0193: Type constraint mismatch. The type     'obj'    is not compatible with type    'Quaternion' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Transform/Transform.fs(274,44): error FS0039: The type 'Object' does not define the field, constructor or member 'X'. [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Transform/Transform.fs(275,44): error FS0039: The type 'Object' does not define the field, constructor or member 'Y'. [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Transform/Transform.fs(276,44): error FS0039: The type 'Object' does not define the field, constructor or member 'Z'. [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Physics/AetherPhysics.fs(120,63): error FS0039: The type 'Object' does not define the field, constructor or member 'Z'. [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Physics/AetherPhysics.fs(249,65): error FS0039: The type 'Object' does not define the field, constructor or member 'Z'. [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Physics/AetherPhysics.fs(345,75): error FS0039: The type 'Object' does not define the field, constructor or member 'Z'. [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Physics/AetherPhysics.fs(436,38): error FS0193: Type constraint mismatch. The type     'obj'    is not compatible with type    'Quaternion' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Effects/Effects.fs(453,28): error FS0041: No overloads match for method 'Transform'.Known types of arguments: Vector3 * objAvailable overloads: - Vector3.Transform(position: Vector3, matrix: Matrix4x4) : Vector3 // Argument 'matrix' doesn't match - Vector3.Transform(value: Vector3, rotation: Quaternion) : Vector3 // Argument 'rotation' doesn't match [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Effects/Effects.fs(493,32): error FS0041: No overloads match for method 'Transform'.Known types of arguments: Vector3 * objAvailable overloads: - Vector3.Transform(position: Vector3, matrix: Matrix4x4) : Vector3 // Argument 'matrix' doesn't match - Vector3.Transform(value: Vector3, rotation: Quaternion) : Vector3 // Argument 'rotation' doesn't match [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Effects/Effects.fs(730,77): error FS0193: Type constraint mismatch. The type     'obj'    is not compatible with type    'Quaternion' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/Effects/Effects.fs(775,77): error FS0193: Type constraint mismatch. The type     'obj'    is not compatible with type    'Quaternion' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1044,48): error FS0001: This expression was expected to have type    'Vector3'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1066,64): error FS0001: This expression was expected to have type    'Vector3'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1074,147): error FS0001: This expression was expected to have type    'Vector3'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1221,50): error FS0001: This expression was expected to have type    'Quaternion'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1228,32): error FS0001: No overloads match for method 'op_Multiply'.Known return type: objKnown type parameters: < Quaternion , obj >Available overloads: - Quaternion.( * )(value1: Quaternion, value2: Quaternion) : Quaternion // Argument 'value2' doesn't match - Quaternion.( * )(value1: Quaternion, value2: float32) : Quaternion // Argument 'value2' doesn't match [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1229,45): error FS0001: This expression was expected to have type    'Quaternion'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1243,66): error FS0001: This expression was expected to have type    'Quaternion'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1247,90): error FS0001: This expression was expected to have type    'Quaternion'    but here has type    'obj' [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]
/home/ecsodikas/Repositories/Nu/Nu/Nu/World/WorldModuleEntity.fs(1260,54): error FS0043: No overloads match for method 'op_Multiply'.Known return type: 'aKnown type parameters: < Quaternion , obj >Available overloads: - Quaternion.( * )(value1: Quaternion, value2: Quaternion) : Quaternion // Argument 'value2' doesn't match - Quaternion.( * )(value1: Quaternion, value2: float32) : Quaternion // Argument 'value2' doesn't match [/home/ecsodikas/Repositories/Nu/Nu/Nu/Nu.fsproj]

dotnet --version gives me 7.0.113 as a result, maybe it's the wrong version? I am not sure what I have to do to fix this, every help is much appreciated. I'm fairly new to the F# ecosystem, so please explain like I'm 5.

bryanedds commented 9 months ago

Hi @Ecsodikas! this is a known issue related to I think something missing in your setup. but i'm trying to remember what it was.... the only thing I can ask first is to see if you followed every step of the Getting Started documentation - https://github.com/bryanedds/Nu/wiki/Getting-Started-with-Nu i'll be trying to remember what it was exactly last time someone encountered it...

bryanedds commented 9 months ago

Now that I remember, this points to an error that arises when an older version of F# compiler is being used. I'm wondering why the existing install instructions aren't yielding an updated F# compiler installation?

Ecsodikas commented 9 months ago

Solution: Together with @bryanedds I found the solution to the problem. It appears that the Ubuntu repositories contain an old version of the dotnet package.

If you have installed dotnet previously via apt you want to remove all traces of it and handle the installation via the microsoft repositories like described here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#register-the-microsoft-package-repository The commands from the above URL are listed here:

# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

# Download Microsoft signing key and repository
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

# Install Microsoft signing key and repository
sudo dpkg -i packages-microsoft-prod.deb

# Clean up
rm packages-microsoft-prod.deb

# Update packages
sudo apt update

Also make sure to lower the priority of the official Ubuntu repositiores for dotnet packages like explained here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-mixup?pivots=os-linux-ubuntu#i-need-a-version-of-net-that-isnt-provided-by-my-linux-distribution, otherwise you will get the old packages at best or a mish-mash of different versions and dependency hell at worst.

After that you should be good to go. If you still get an error as described in the setup instructions where you are greeted with this message System.TypeInitializationException: The type initializer for 'OpenGL.Egl' threw an exception. you could install a package containing the libdl.so package (apt install libc6-dev) and link it into your lib folder via sudo ln -s /usr/lib64/libdl.so.2 /lib/libdl.so. After that Nu.Gaia opened on my system. I hope this helps anyone else.