Timmoth / Sapling

A strong dotnet UCI Chess engine - My leaf nodes are growing
https://iblunder.com
Apache License 2.0
39 stars 2 forks source link

compiling v1.1.4 fails (Linux) #15

Closed tissatussa closed 1 month ago

tissatussa commented 1 month ago

compiling v1.1.4 fails on my Linux :

$ make -j1
dotnet publish Sapling/Sapling.csproj -c Release --runtime linux-x64 --self-contained \
        -p:PublishSingleFile=true -p:DeterministicBuild=true -o ./
  Determining projects to restore...
  Restored /home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj (in 598 ms).
  Restored /home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj (in 598 ms).
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Tuning/SpsaOptions.cs(15,23): warning CS8618: Non-nullable field 'Name' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Tuning/SpsaOptions.cs(16,23): warning CS8618: Non-nullable field 'Type' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Tuning/SpsaOptions.cs(17,23): warning CS8618: Non-nullable field 'DefaultValue' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Tuning/SpsaOptions.cs(18,23): warning CS8618: Non-nullable field 'MinValue' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Tuning/SpsaOptions.cs(19,23): warning CS8618: Non-nullable field 'MaxValue' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Tuning/SpsaOptions.cs(20,26): warning CS8618: Non-nullable field 'FieldHandle' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Evaluation/NnueWeights.cs(45,20): warning CS8602: Dereference of a possibly null reference. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/RepetitionDetector.cs(92,26): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '0' is not covered. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/Sapling.Engine.csproj]
  Sapling.Engine -> /home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/bin/Release/net8.0/Sapling.Engine.dll
  Successfully created package '/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/bin/Release/SaplingEngine.1.1.0.nupkg'.
  Successfully created package '/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling.Engine/bin/Release/SaplingEngine.1.1.0.symbols.nupkg'.
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/UciEngine.cs(29,23): warning CS8602: Dereference of a possibly null reference. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Program.cs(20,34): warning CS8602: Dereference of a possibly null reference. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
  Sapling -> /home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/bin/Release/net8.0/linux-x64/Sapling.dll
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018: System.UnauthorizedAccessException: Access to the path '/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling' is denied. [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:  ---> System.IO.IOException: Permission denied [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    --- End of inner exception stack trace --- [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError) [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException) [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite) [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
/home/roelof/dotnet8/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1038,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/home/roelof/Compiled/Sapling-main-v1.1.4/Sapling/Sapling.csproj]
make: *** [Makefile:42: publish] Error 1

i often have trouble compiling dotnet / C# programs .. previous v1.1.3 went well (except a few warnings) but now i can't solve it ..

Timmoth commented 1 month ago

Thanks for notifying me! I was working on the SPSA tuning and it required some changes to the make file, I've not tested them on linux yet so will try tomorrow and see if I can fix it.

For now the old make file should still work. https://github.com/Timmoth/Sapling/blob/e5d642ea59d65de565dd4823ed1e7ac13d721137/Makefile

Timmoth commented 1 month ago

I've added a new set of build scripts, would you be able to pull down the source and run ./scripts/build_linux_avx256.sh and let me know if it works for you?

tissatussa commented 1 month ago

..run ./scripts/build_linux_avx256.sh and let me know if it works for you?

first, the folder is named 'Scripts', with a capital 'S', which is important on Linux, so i changed that .. second, it seems you aim 'avx256' but i only can do avx2, so i hope this doesn't spoil anything .. anyhow, after setting executable rights to the .sh file, i executed your command, but :

$ ./Scripts/build_linux_avx256.sh
MSBUILD : error MSB1009: Project file does not exist.
Switch: ../src/Sapling/Sapling.csproj

I tried to solve this quickly, but i didn't succeed yet .. also, be aware Linux uses '/' in paths, not '\' like Windows does .. is it important in this case ?

Timmoth commented 1 month ago

It does work for me on ubuntu. I think the problem is that you're trying to execute the script from the root dir, try:

cd ./Scripts
./build_linux_avx256.sh
tissatussa commented 1 month ago

..the problem is that you're trying to execute the script from the root dir..

indeed, now compiling succeeded :

(base) roelof@roelof-HP-Elite-x2-1012-G2:~/Compiled/Sapling-v1.1.8/Scripts$ ./build_linux_avx256.sh 
  Determining projects to restore...
  Restored /home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Sapling.csproj (in 501 ms).
  Restored /home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj (in 501 ms).
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Tuning/SpsaOptions.cs(7,23): warning CS8618: Non-nullable field 'Name' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Tuning/SpsaOptions.cs(8,23): warning CS8618: Non-nullable field 'Type' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Tuning/SpsaOptions.cs(9,23): warning CS8618: Non-nullable field 'DefaultValue' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Tuning/SpsaOptions.cs(10,23): warning CS8618: Non-nullable field 'MinValue' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Tuning/SpsaOptions.cs(11,23): warning CS8618: Non-nullable field 'MaxValue' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Tuning/SpsaOptions.cs(12,26): warning CS8618: Non-nullable field 'FieldHandle' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Evaluation/NnueWeights.cs(56,20): warning CS8602: Dereference of a possibly null reference. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/RepetitionDetector.cs(63,26): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '0' is not covered. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/Sapling.Engine.csproj]
  Sapling.Engine -> /home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/bin/Release/net8.0/Sapling.Engine.dll
  Successfully created package '/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/bin/Release/SaplingEngine.1.1.0.nupkg'.
  Successfully created package '/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling.Engine/bin/Release/SaplingEngine.1.1.0.symbols.nupkg'.
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/UciEngine.cs(31,23): warning CS8602: Dereference of a possibly null reference. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Sapling.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Program.cs(34,34): warning CS8602: Dereference of a possibly null reference. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Sapling.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Program.cs(23,31): warning CS8618: Non-nullable field '_fileStream' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Sapling.csproj]
/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Program.cs(24,33): warning CS8618: Non-nullable field '_logWriter' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/Sapling.csproj]
  Sapling -> /home/roelof/Compiled/Sapling-v1.1.8/src/Sapling/bin/Release/net8.0/linux-x64/Sapling.dll
  Sapling -> /home/roelof/Compiled/Sapling-v1.1.8/Scripts/
  Attempting to rename executable file from /home/roelof/Compiled/Sapling-v1.1.8/Scripts//Sapling to /home/roelof/Compiled/Sapling-v1.1.8/Scripts//Sapling_linux_avx256

(base) roelof@roelof-HP-Elite-x2-1012-G2:~/Compiled/Sapling-v1.1.8/Scripts$ ./Sapling_linux_avx256 
uci
id name Sapling 1-1-8
id author Tim Jones
option name Threads type spin default 1 min 1 max 1024
option name Ponder type check default false
option name Hash type spin default 319 min 32 max 2046
uciok

NOTE: i got warnings, but no errors

Timmoth commented 1 month ago

All of those warnings are benign, though I will go through and sort them!