Answers.Body: <p>After a week-long struggle I found a stupid albeit usable workaround that could be helpful for someone else.</p>
  <p>Windows engines run on a Windows computer (in my case a Windows 10 virtual machine in VirtualBox on the same computer) and Linux GUI runs them remotely using <code>ssh</code>.</p>
  <p>To setup that:</p>
  <p><strong>Windows:</strong><br />
  <a href="https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui" rel="nofollow noreferrer">Install OpenSSH Server</a>.<br />
  Set OpenSSH service to start automatically.<br />
  Copy desired Windows chess engines to that Windows computer, ideally to the home folder C:\Users\myUser.</p>
  <p><strong>Linux:</strong><br />
  Install <code>sshpass</code> using your package manager.<br />
  Connect (at least once) using normal interactive ssh (ssh -l myUser ...) to the Windows computer to accept ssh fingerprint (important!).<br />
  Create a shell script (e.g. myFavoriteEngine.sh) with content like this:</p>
  <pre><code>sshpass -p 'myWindowPassword' ssh myWindowsUser@MY.WINDOWS.IP.ADDRESS myFavoriteEngine.exe %1
  </code></pre>
  <p>Don't forget to flag the script as executable.<br />
  In a Linux GUI, add the engine using the script: <code>sh myFavoriteChessEngine.sh</code> and that's all.</p>
  <p>It's not great setup for engine to engine tournaments (Virtual Box doesn't allow using hyper threading) but it allows having both Linux and Windows engines in the same Linux GUI.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-16T19:20:06.877Z
Answers.LastActivityDate: 2022-09-16T19:20:06.877Z
Answers.UserDisplayName: user681768917
Body: <p>There's no problem with native Linux engines or with JAVA engines, only with Windows engines started using <code>wine</code>.</p>
  <p>All Windows engines behave the same, both win32 and x64, both UCI and XB.</p>
  <p>Windows engines seem to work fine in a terminal window.</p>
  <pre><code>&gt; wine uci_engine.exe   
  &gt; go
  
  info depth 2
  info depth 2 score cp 12 time 8 nodes 96 nps 12288 pv b1c3  
  ....
  </code></pre>
  <p>They even work in a Windows GUI started using wine (e.g. <code>wine Arena.exe</code>).</p>
  <p>But they don't work in any Linux GUI (CuteChess, Arena for Linux, XBoard).<br />
  Engines initialize OK (e.g. UCI options can be set etc.) but the main thread doesn't start calculating.</p>
  <p>If this is a single thread UCI engine, the process starts sleeping instead of calculating after the <code>go</code> command.<br />
  If this is a multi thread engine, the main thread starts sleeping and the remaining threads start calculating.</p>
  <p>Example output from the CuteChess engine debug window:</p>
  <pre><code>&lt;rybka1(1): id name Rybka 1.2n 32-bit
  &lt;rybka1(1): id author Vasik Rajlich
  &lt;rybka1(1): option name Hash type spin min 2 max 4096 default 32
  &lt;rybka1(1): option name NalimovPath type string default &lt;empty&gt;
  &lt;rybka1(1): option name NalimovCache type spin min 1 max 256 default 1
  &lt;rybka1(1): option name NalimovUsage type combo default Normally var Frequently var Normally var Rarely
  &lt;rybka1(1): option name Preserve Analysis type check default false
  &lt;rybka1(1): option name Clear Hash type button
  &lt;rybka1(1): option name Ponder type check default true
  &lt;rybka1(1): option name MultiPV type spin default 1 min 1 max 100
  &lt;rybka1(1): option name UCI_ShowCurrLine type check default false
  &lt;rybka1(1): option name UCI_ShowRefutations type check default false
  &lt;rybka1(1): option name UCI_LimitStrength type check default false
  &lt;rybka1(1): option name UCI_Elo type spin default 1200 min 1200 max 2400 
  &lt;rybka1(1): option name Server Buffer type check default false
  &lt;rybka1(1): option name UCI_AnalyseMode type check default false
  &lt;rybka1(1): option name UCI_Opponent type string default &lt;empty&gt;
  &lt;rybka1(1): option name UCI_EngineAbout type string default www.rybkachess.com
  &lt;rybka1(1): option name Contempt type spin default 0 min -100 max 100
  &lt;rybka1(1): option name Outlook type combo default Neutral var Very Pessimistic var Slightly Pessimistic var Neutral var Slightly Optimistic var Very Optimistic var Ultra Optimistic
  &lt;rybka1(1): option name Rate Of Play type combo default Normal var Ultraslow var Slow var Normal var Fast var Ultrafast
  &lt;rybka1(1): option name Time Usage type combo default Varied var Constant var Varied
  &lt;rybka1(1): option name Emergency Time Buffer type combo default Medium var Small var Medium var Large
  &lt;rybka1(1): uciok
  &gt;rybka1(1): setoption name Contempt value 0
  &gt;rybka1(1): setoption name Emergency Time Buffer value Medium
  &gt;rybka1(1): setoption name Hash value 32
  &gt;rybka1(1): setoption name MultiPV value 1
  &gt;rybka1(1): setoption name NalimovCache value 1
  &gt;rybka1(1): setoption name NalimovPath value &lt;empty&gt;
  &gt;rybka1(1): setoption name NalimovUsage value Normally
  &gt;rybka1(1): setoption name Outlook value Neutral
  &gt;rybka1(1): setoption name Preserve Analysis value false
  &gt;rybka1(1): setoption name Rate Of Play value Normal
  &gt;rybka1(1): setoption name Server Buffer value false
  &gt;rybka1(1): setoption name Time Usage value Varied
  &gt;rybka1(1): setoption name UCI_Elo value 1200
  &gt;rybka1(1): setoption name UCI_LimitStrength value false
  &gt;rybka1(1): isready
  &lt;rybka1(1): info contempt set to 0 centipawns
  &lt;rybka1(1): info setting emergency time buffer to medium
  &lt;rybka1(1): info displaying 1 variations
  &lt;rybka1(1): info setting nalimov usage to normally
  &lt;rybka1(1): info setting outlook to neutral
  &lt;rybka1(1): info setting preserve analysis to false
  &lt;rybka1(1): info setting rate of play to normal
  &lt;rybka1(1): info Server Buffer set to false
  &lt;rybka1(1): info setting time usage style to varied
  &lt;rybka1(1): info UCI_Elo set to 1200
  &lt;rybka1(1): info UCI_LimitStrength set to false
  &lt;rybka1(1): readyok
  &gt;rybka1(1): ucinewgame
  &gt;rybka1(1): setoption name Ponder value false
  &gt;rybka1(1): setoption name UCI_Opponent value none none human adam
  &gt;rybka1(1): position startpos
  &gt;rybka1(1): isready
  &lt;rybka1(1): info UCI_Opponent set to none none human adam
  &lt;rybka1(1): readyok
  &gt;rybka1(1): go wtime 300000 btime 300000 movestogo 40
  </code></pre>
  <p>After the last command this single thread engine starts sleeping. It doesn't terminate but it does nothing.</p>
  <p>I believe there is a bug somewhere but maybe somebody knows a workaround?<br />
  Tried wine 6 (stable) and 7 (devel).</p>
  <p>The system in question is Linux Mint 21 (x64, Cinnamon) on i7-6700/32GB RAM.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-15T20:10:07.947Z
Comments.Text: The UCI protocol is all text so could it be something silly like different newlines? This is mentioned in the UCI protocol.
Comments.UserDisplayName: qwr
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-15T20:17:45.993Z
Comments.Text: I've been thinking about that. But all the previous UCI (or XB) commands are accepted by the engine. Moreover, with a multi-thread engine, the last 'go ...' starts calculating on the remaining threads, only the main thread handling the communication starts sleeping instead of calculating.
Comments.UserDisplayName: user681768917
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-16T03:04:53.540Z
Comments.Text: Better ask this on StackOverflow. This question requires more computer skills than chess skills :)
Comments.UserDisplayName: Déjà vu
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-16T03:57:39.697Z
Comments.Text: @Déjàvu but a significantly higher proportion of people here are familiar with using a chess engine.
Comments.UserDisplayName: qwr
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-16T05:02:13.277Z
Comments.Text: @qwr To me it looks like a recurrent problem of wine / Linux / Windows program running problem, would it be a chess engine or a washing machine, which is better addressed in SO or superuser...
Comments.UserDisplayName: Déjà vu
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-16T05:57:03.487Z
Comments.Text: Thanks. The problem is very specific to this setup, no other system problems detected. Too specific for Superuser. I've even tried to write a JAVA wrapper for the wine engine call and that's what I'm going to ask at SO. But I'm keeping the question here - somebody might have faced the problem a possibly knows what to do to fix it.
Comments.UserDisplayName: user681768917
Tags: <engines><linux>
Title: Workaround for strange behavior of Windows chess engines in Linux GUIs?
ThreadText: # Workaround for strange behavior of Windows chess engines in Linux GUIs?
  
  (Asked by: username_0 on 2022-09-15)
  
  There's no problem with native Linux engines or with JAVA engines, only with Windows engines started using `wine`.
  
  All Windows engines behave the same, both win32 and x64, both UCI and XB.
  
  Windows engines seem to work fine in a terminal window.
  
  ```
  > wine uci_engine.exe   
  > go
  
  info depth 2
  info depth 2 score cp 12 time 8 nodes 96 nps 12288 pv b1c3  
  ....
  
  ```
  
  They even work in a Windows GUI started using wine (e.g. `wine Arena.exe`).
  
  But they don't work in any Linux GUI (CuteChess, Arena for Linux, XBoard).  
  Engines initialize OK (e.g. UCI options can be set etc.) but the main thread doesn't start calculating.
  
  If this is a single thread UCI engine, the process starts sleeping instead of calculating after the `go` command.  
  If this is a multi thread engine, the main thread starts sleeping and the remaining threads start calculating.
  
  Example output from the CuteChess engine debug window:
  
  ```
  <rybka1(1): id name Rybka 1.2n 32-bit
  <rybka1(1): id author Vasik Rajlich
  <rybka1(1): option name Hash type spin min 2 max 4096 default 32
  <rybka1(1): option name NalimovPath type string default <empty>
  <rybka1(1): option name NalimovCache type spin min 1 max 256 default 1
  <rybka1(1): option name NalimovUsage type combo default Normally var Frequently var Normally var Rarely
  <rybka1(1): option name Preserve Analysis type check default false
  <rybka1(1): option name Clear Hash type button
  <rybka1(1): option name Ponder type check default true
  <rybka1(1): option name MultiPV type spin default 1 min 1 max 100
  <rybka1(1): option name UCI_ShowCurrLine type check default false
  <rybka1(1): option name UCI_ShowRefutations type check default false
  <rybka1(1): option name UCI_LimitStrength type check default false
  <rybka1(1): option name UCI_Elo type spin default 1200 min 1200 max 2400 
  <rybka1(1): option name Server Buffer type check default false
  <rybka1(1): option name UCI_AnalyseMode type check default false
  <rybka1(1): option name UCI_Opponent type string default <empty>
  <rybka1(1): option name UCI_EngineAbout type string default www.rybkachess.com
  <rybka1(1): option name Contempt type spin default 0 min -100 max 100
  <rybka1(1): option name Outlook type combo default Neutral var Very Pessimistic var Slightly Pessimistic var Neutral var Slightly Optimistic var Very Optimistic var Ultra Optimistic
  <rybka1(1): option name Rate Of Play type combo default Normal var Ultraslow var Slow var Normal var Fast var Ultrafast
  <rybka1(1): option name Time Usage type combo default Varied var Constant var Varied
  <rybka1(1): option name Emergency Time Buffer type combo default Medium var Small var Medium var Large
  <rybka1(1): uciok
  >rybka1(1): setoption name Contempt value 0
  >rybka1(1): setoption name Emergency Time Buffer value Medium
  >rybka1(1): setoption name Hash value 32
  >rybka1(1): setoption name MultiPV value 1
  >rybka1(1): setoption name NalimovCache value 1
  >rybka1(1): setoption name NalimovPath value <empty>
  >rybka1(1): setoption name NalimovUsage value Normally
  >rybka1(1): setoption name Outlook value Neutral
  >rybka1(1): setoption name Preserve Analysis value false
  >rybka1(1): setoption name Rate Of Play value Normal
  >rybka1(1): setoption name Server Buffer value false
  >rybka1(1): setoption name Time Usage value Varied
  >rybka1(1): setoption name UCI_Elo value 1200
  >rybka1(1): setoption name UCI_LimitStrength value false
  >rybka1(1): isready
  <rybka1(1): info contempt set to 0 centipawns
  <rybka1(1): info setting emergency time buffer to medium
  <rybka1(1): info displaying 1 variations
  <rybka1(1): info setting nalimov usage to normally
  <rybka1(1): info setting outlook to neutral
  <rybka1(1): info setting preserve analysis to false
  <rybka1(1): info setting rate of play to normal
  <rybka1(1): info Server Buffer set to false
  <rybka1(1): info setting time usage style to varied
  <rybka1(1): info UCI_Elo set to 1200
  <rybka1(1): info UCI_LimitStrength set to false
  <rybka1(1): readyok
  >rybka1(1): ucinewgame
  >rybka1(1): setoption name Ponder value false
  >rybka1(1): setoption name UCI_Opponent value none none human adam
  >rybka1(1): position startpos
  >rybka1(1): isready
  <rybka1(1): info UCI_Opponent set to none none human adam
  <rybka1(1): readyok
  >rybka1(1): go wtime 300000 btime 300000 movestogo 40
  
  ```
  
  After the last command this single thread engine starts sleeping. It doesn't terminate but it does nothing.
  
  I believe there is a bug somewhere but maybe somebody knows a workaround?  
  Tried wine 6 (stable) and 7 (devel).
  
  The system in question is Linux Mint 21 (x64, Cinnamon) on i7-6700/32GB RAM.
  
  **Tags:** engines, linux
  
  > **Comments:**
  > **username_1**: The UCI protocol is all text so could it be something silly like different newlines? This is mentioned in the UCI protocol.  
  > **username_0**: I've been thinking about that. But all the previous UCI (or XB) commands are accepted by the engine. Moreover, with a multi-thread engine, the last 'go ...' starts calculating on the remaining threads, only the main thread handling the communication starts sleeping instead of calculating.  
  > **username_2**: Better ask this on StackOverflow. This question requires more computer skills than chess skills :)  
  > **username_1**: @username_2 but a significantly higher proportion of people here are familiar with using a chess engine.  
  > **username_2**: @username_1 To me it looks like a recurrent problem of wine / Linux / Windows program running problem, would it be a chess engine or a washing machine, which is better addressed in SO or superuser...  
  > **username_0**: Thanks. The problem is very specific to this setup, no other system problems detected. Too specific for Superuser. I've even tried to write a JAVA wrapper for the wine engine call and that's what I'm going to ask at SO. But I'm keeping the question here - somebody might have faced the problem a possibly knows what to do to fix it.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2022-09-16. Score: 2
  
  After a week-long struggle I found a stupid albeit usable workaround that could be helpful for someone else.
  
  Windows engines run on a Windows computer (in my case a Windows 10 virtual machine in VirtualBox on the same computer) and Linux GUI runs them remotely using `ssh`.
  
  To setup that:
  
  **Windows:**  
  [Install OpenSSH Server](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui).  
  Set OpenSSH service to start automatically.  
  Copy desired Windows chess engines to that Windows computer, ideally to the home folder C:\Users\myUser.
  
  **Linux:**  
  Install `sshpass` using your package manager.  
  Connect (at least once) using normal interactive ssh (ssh -l myUser ...) to the Windows computer to accept ssh fingerprint (important!).  
  Create a shell script (e.g. myFavoriteEngine.sh) with content like this:
  
  ```
  sshpass -p 'myWindowPassword' ssh myWindowsUser@MY.WINDOWS.IP.ADDRESS myFavoriteEngine.exe %1
  
  ```
  
  Don't forget to flag the script as executable.  
  In a Linux GUI, add the engine using the script: `sh myFavoriteChessEngine.sh` and that's all.
  
  It's not great setup for engine to engine tournaments (Virtual Box doesn't allow using hyper threading) but it allows having both Linux and Windows engines in the same Linux GUI.
  
  
  ---
  
  