lucaschess icon indicating copy to clipboard operation
lucaschess copied to clipboard

Can Lucas Chess run on Linux?

Open JVAQUEROM opened this issue 6 years ago • 25 comments

Hello,

I would like to know if Lucas Chess can be built for linux. I have tried but I get errors (i think it is related to dependences with python for Windows libraries). It would be a pitty that an open-source program cannot run in an open-source OS.

Thank you.

JVAQUEROM avatar Mar 11 '18 12:03 JVAQUEROM

The distribution has a folder = Linux, with information to install.

lukasmonk avatar Mar 11 '18 17:03 lukasmonk

Thank you, I hadn't notice. I'd suggest saying this in the readme.md. I am having some trouble building it. The LCEngine.so gets created as LCEngineV1.so, and then Lucas.py fails

Traceback (most recent call last):
  File "Lucas.py", line 57, in <module>
    import Code.Init
  File "./Code/Init.py", line 5, in <module>
    from Code import Procesador
  File "./Code/Procesador.py", line 6, in <module>
    from Code import AperturasStd
  File "./Code/AperturasStd.py", line 1, in <module>
    import LCEngineV1 as LCEngine
ImportError: ./LCEngineV1.so: failed to map segment from shared object

JVAQUEROM avatar Mar 11 '18 18:03 JVAQUEROM

I got it working by running xlucas.sh in the Linux folder. Thank you!

I suggest more detailed info in the instructions for linux. I offer my help on this task although I am by no means an expert on GNU/Linux.

JVAQUEROM avatar Mar 11 '18 18:03 JVAQUEROM

I have changed some code, you must download and exec again, xlinux_install.sh.

lukasmonk avatar Mar 11 '18 21:03 lukasmonk

Perfect if you can help.

lukasmonk avatar Mar 12 '18 15:03 lukasmonk

unfortunately this is not an answer... i bypassed the problem (not solved, only avoid it)... install the exe version with wine... it work perfectly

zagabra avatar Aug 24 '18 05:08 zagabra

Unfortunately, I was not able to reinstall LucasChess. I use now opensuse 15.0 (previously, opensuse 42.3). The last commands have some errors I do not understand. I attach in case it is helpful. I also attach a new

xlinux_install.sh since the current one have some "mistakes" (for instance, calls to pip should be with sudo, and it is better to use pip2 since some systems use by default python3, and pip3).

Thanks!

Attachment: Linux.zip

JVAQUEROM avatar Aug 25 '18 17:08 JVAQUEROM

I have done a binary Linux 64 distribution of LucasChess to test:

https://drive.google.com/open?id=1joGQWTmJMVfYGyLLdpayo5KHcTfqxi1-

lukasmonk avatar Sep 02 '18 05:09 lukasmonk

I don't understand, I think that to make an appimage it is necessary binaries that work. I need to know if these downloaded binaries work on distributions other than my virtual box Linux machines. That's why I uploaded these binaries. I assume that this is the place where I can get help, and that the people who comment are likely to be able to help me. But I can be completely wrong, it won't be the first time and it won't be the last time.

lukasmonk avatar Sep 02 '18 20:09 lukasmonk

I have just downloaded a prebuilt image of Manjaro (Manjaro 17.1.6 (64bit).vdi) from https://www.osboxes.org/virtualbox-images/. I have downloaded the file: https://drive.google.com/open?id=1joGQWTmJMVfYGyLLdpayo5KHcTfqxi1-

In the same directory of Downloads I have uncompressed the tar.gz file, then I have run ./xlucas.sh, and the result: image

It works without installing any library.

lukasmonk avatar Sep 02 '18 21:09 lukasmonk

Very important, because it seems it is not clear that: this is only for test, not for production, a first step.

It is not needed to install any libraries, only uncompress the only file and exec ./Lucas There is not needed Pacman. Please copy the file .tar.gz in a new folder, uncompress it, then ./Lucas You must have a 64 bit Linux. (I have done only one to 64 bit Linux, to test) If your system is a 32 bits, say me and I try to create a binary to this.

lukasmonk avatar Sep 02 '18 21:09 lukasmonk

It seems to work on my openSuSE Leap 15.

JVAQUEROM avatar Sep 04 '18 07:09 JVAQUEROM

This test binary works on my Ubuntu 18.04.1

kirillt avatar Nov 15 '18 17:11 kirillt

I installed it on Ubuntu Mate 1.20.1 I already had the dependencies installed. It worked ok with the following advice:

  1. Ensure you edit the 2 paths in xlinux_install.sh for example in my case: cd /home/mark/lucaschess/lucaschess-master cd /home/mark/lucaschess/lucaschess-master/LCEngine respectively.
  2. the file LCEngine/LCEngine2.so Was not readable. The permission change advice in the readme did not enable it to be read during the installation. I resorted to sudo chmod ugo+rwx LCEngine2.so After running the install script the permissions were reset. After that just run xlinux_install.sh and you are good to go by running xlucas.sh

markkozo avatar Jan 10 '19 18:01 markkozo

The last time I tried LucasChess on Linux - native, not via Wine (it does work on Wine) - it did not work. User, you might want to try Wine (though a working native version would of course be better).

LinuxOnTheDesktop avatar Feb 14 '19 22:02 LinuxOnTheDesktop

To LinuxOnDesktop

I have installed it on Linux so I posted just to state my observation. There is no reason to use wine on Linux when it is open source. The code is fine so if you have problems building it you just need to ensure you have the right dependencies.

markkozo avatar Feb 14 '19 22:02 markkozo

Never succeeded to compile. Tried on Mint and on MX Linux. The binary link is working on Mint, not on MX. Of course, I would rather like to be able to compile the source in order to get the latest version.

labette avatar Aug 30 '19 16:08 labette

@labette, were there compilation errors?

As far as I can tell three lines here need to be updated to say LCEngine4 (not 2) https://github.com/lukasmonk/lucaschess/blob/d518e709f217d6ff30fde7be89fc401d304b80f6/LCEngine/xcython_linux.sh#L2

stockfish 64-bit binary lacks executable permission and mccain 64-bit Linux binary is missing and fails to compile, but everything else from LinuxInstallation.md worked for me. (I did compile mccain, but my changes seem to break cache alignment and make it work slower than it can.)

xaizek avatar Aug 30 '19 17:08 xaizek

I got the following errors during installation of dependencies :

$ sudo pip install psutil Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main $ sudo pip install pygal Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main $ sudo pip install chardet Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main $ sudo apt-get install python-chess Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package python-chess $ sudo pip install Pillow Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main $ sudo pip install PhotoHash Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main $ sudo pip install Cython Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main $ sudo pip install scandir Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main

Please note that python-chess is also not found.

There are discrepancies also between the instructions and the file xlinux_install.sh (which is a nice way to implement the installation I think).

Thanks for you reply.

labette avatar Aug 31 '19 03:08 labette

To all those trying to install on Linux: I recommend the following. Since the build system seems pretty broken, and has been for a long time, give up on that and install run Lucas Chess under Wine. It works for me.

LinuxOnTheDesktop avatar Aug 31 '19 07:08 LinuxOnTheDesktop

On my system I installed almost all dependencies with this command:

pip2 install --user python-chess==v0.23.11 setuptools psutil chardet Pillow PhotoHash Cython scandir

Only PyAudio was installed via system's package manager.

ImportError: cannot import name main

You seem to have buggy pip and instead of saying pip install ... you can try doing python2 -m pip install ....

xaizek avatar Aug 31 '19 08:08 xaizek

Hi everyone, I Just installed version 11.16 on Ubuntu 18.04. I made some changes in particular did not use pip install pip in xlinux_install.sh and changes LCEengine2 into LCEngine4 for copy in xcython_linux.sh. Everything else was fine. Now when I train I have a message saying McCain-X3_x64_linux cannot be found :( How can I solve this please?

Airwan avatar Oct 11 '19 23:10 Airwan

@Airwan, you can try applying this patch:

 Engines/Linux64/mccain/src/syzygy/tbprobe.cpp    |   9 ++++++++-
 Engines/Linux64/mccain/src/thread.h              |   4 +++-
 Engines/Linux64/mccain/src/tt.h                  |   6 +++---
 Engines/Linux64/stockfish/Linux/stockfish_10_x64 | Bin
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Engines/Linux64/mccain/src/syzygy/tbprobe.cpp b/Engines/Linux64/mccain/src/syzygy/tbprobe.cpp
index 7864486..817dac9 100644
--- a/Engines/Linux64/mccain/src/syzygy/tbprobe.cpp
+++ b/Engines/Linux64/mccain/src/syzygy/tbprobe.cpp
@@ -32,10 +32,17 @@
 #include "../movegen.h"
 #include "../position.h"
 #include "../search.h"
-#include "../thread_win32_osx.h"
+// #include "../thread_win32_osx.h"
 #include "../types.h"
 #include "../uci.h"
 
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+using Mutex = std::mutex;
+using ConditionVariable = std::condition_variable;
+using NativeThread = std::thread;
+
 #include "tbprobe.h"
 
 #ifndef _WIN32
diff --git a/Engines/Linux64/mccain/src/thread.h b/Engines/Linux64/mccain/src/thread.h
index 7dbceaf..381ccab 100644
--- a/Engines/Linux64/mccain/src/thread.h
+++ b/Engines/Linux64/mccain/src/thread.h
@@ -33,8 +33,10 @@
 #include "pawns.h"
 #include "position.h"
 #include "search.h"
-#include "thread_win32_osx.h"
 
+using Mutex = std::mutex;
+using ConditionVariable = std::condition_variable;
+using NativeThread = std::thread;
 
 /// Thread class keeps together all the thread-related stuff. We use
 /// per-thread pawn and material hash tables so that once we get a
diff --git a/Engines/Linux64/mccain/src/tt.h b/Engines/Linux64/mccain/src/tt.h
index dd9efcf..2fece56 100644
--- a/Engines/Linux64/mccain/src/tt.h
+++ b/Engines/Linux64/mccain/src/tt.h
@@ -76,13 +76,13 @@ private:
 class TranspositionTable {
 
   static constexpr int CacheLineSize = 64;
-  static constexpr int ClusterSize = 3;
+  static constexpr int ClusterSize = 1;
 
-  struct Cluster {
+  struct alignas(CacheLineSize) Cluster {
     TTEntry entry[ClusterSize];
-    char padding[2]; // Align to a divisor of the cache line size
   };
 
+  static_assert(sizeof(TTEntry) <= 40, "TTEntry size incorrect");
   static_assert(CacheLineSize % sizeof(Cluster) == 0, "Cluster size incorrect");
 
 public:
diff --git a/Engines/Linux64/stockfish/Linux/stockfish_10_x64 b/Engines/Linux64/stockfish/Linux/stockfish_10_x64
old mode 100644
new mode 100755

And then building McCain:

cd Engines/Linux64/mccain/src
make build ARCH=x86-64
mv McCain-X3 ../McCain-X3_x64_linux

Or just switch to an engine which comes prebuilt for 64-bit Linux somewhere in the settings (McCain is the default).

xaizek avatar Oct 12 '19 09:10 xaizek

I installed it on my profile using sudo. It starts as expected when I sh xlucas.sh.

But when I run it on another profile it just outputs x86_64 and then nothing happens. How can I find out what's the issue?

6heads avatar Mar 20 '20 07:03 6heads

The easiest way to run it under linux? Use Wine.

6heads avatar Jul 24 '20 19:07 6heads