albertoruibal / carballo

Carballo Chess Engine
GNU General Public License v3.0
69 stars 39 forks source link

Java 1.7, tools.jar etc #3

Closed reppolice closed 5 years ago

reppolice commented 7 years ago

Hi, this is the first gradle project I am "using" (I needed a chess engine of about this strength), and I have a couple of issues. First of all it looks like it is actively developed by somehow still targeting the deprecated Java 1.7? I don't know how versions are handled by the various Java tools, but I could not build on Ubuntu with the supplied JDK 1.8 and 1.9, I changed the "target" to 1.8 but then realized the problem was the OpenJDK does not seem to supply tools.jar , or whatever the exact problem may be there. After getting the official Sun JDK tools.jar appeared on my system and the builds went fine, however fastTest produces long list of errors, ending:

Could not open cache directory workerMain (/home/chess/.gradle/caches/2.13/workerMain).

com/tonicsystems/jarjar/asm/commons/SignatureRemapper

That cache directory exists and is left with a .lock, which sounds too bad already, could this be a crash in this SignatureRemapper, or somehow caused by my Java versions?

In other news , "gradle -Dtest.single=WinAtChessTest cleanTest test" and "gradle -Dtest.single=SilentButDeadlyTest cleanTest test" give similar error: Could not find matching test for pattern: WinAtChessTest

Again, I don't know if this is proof of my "Build: Success" was actually not so successful, or some other mystery.

albertoruibal commented 7 years ago

Hello!

1) The source code compliance is set to Java 1.7 because this engine is used in some android apps, and the android tools do not fully support java 1.8 jet.

2) Compile should work with any Java 8 SDK, I use the Oracle SDK in a daily basis without any problem. I just tried a full compile with OpenJDK and it also works.

3) Be careful, you must have installed the openjdk-8-jdk package, not only the openjdk-8-jre, this may be the reason because tools.jar was not found.

4) The gradle cache error is a bit strange... try to remove the gradle cache: # mv /home/chess/.gradle /tmp and compile again

5) The WinAtChessTest and SilentButDeadlyTest must be run from the jse/ directory

Hope it helps! Alberto

reppolice commented 7 years ago

I was using the JDK and in the jse directory, looks like my build was indeed more broken than first thought! Restarting, everything looks the same ....

Download https://jcenter.bintray.com/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.jar :jse:generatePomFileForCarballoJsePublication :core:compileJava UP-TO-DATE :core:processResources UP-TO-DATE :core:classes UP-TO-DATE :core:jar UP-TO-DATE :jse:compileJava UP-TO-DATE :jse:processResources UP-TO-DATE :jse:classes UP-TO-DATE :jse:jar UP-TO-DATE :jse:publishCarballoJsePublicationToMavenLocal :jse:publishToMavenLocal

BUILD SUCCESSFUL

...:jse:proguard UP-TO-DATE

BUILD SUCCESSFUL

...Download https://jcenter.bintray.com/org/vectomatic/lib-gwt-svg/0.5.10/lib-gwt-svg-0.5.10.jar :gwtgui:compileJava UP-TO-DATE :gwtgui:processResources UP-TO-DATE :gwtgui:classes UP-TO-DATE :gwtgui:compileGwt UP-TO-DATE

BUILD SUCCESSFUL

And then, all the same failures. This is an Ubuntu I created yesterday, so haven't had the time to abuse it much. There seems to be something genuinely "incompatible". I guess building on Windows or Mac will suffice for my purposes, and let's see how other people fare. In fact, you could bring back binary releases :)

albertoruibal commented 7 years ago

I work with Debian, so Ubuntu must not be a problem. There is a recent binary release of carballo 1.7 at: https://bintray.com/albertoruibal/maven

I will investigate the test not found errors with a recently installed ubuntu...

reppolice commented 7 years ago

Thanks, on my Mac the tests produce the pretty red-green river!

albertoruibal commented 7 years ago

I tested in a fresh install of a Ubuntu Desktop 16.10 64 bits (in a virtualbox machine):

# sudo apt-get install git openjdk-8-jdk gradle
# git clone https://github.com/albertoruibal/carballo.git
# cd carballo/jse/
# gradle -Dtest.single=WinAtChessTest cleanTest test

And I could reproduce the "> Could not find matching test for pattern: WinAtChessTest" error.

The blundled gradle in Ubuntu 16.10 is the 2.14, and it is a bit outdated. I Downloaded and installed the last gradle 3.2 in /usr/local/:

# cd /tmp
# wget https://services.gradle.org/distributions/gradle-3.2-bin.zip
# cd /usr/local
# sudo unzip /tmp/gradle-3.2-bin.zip

And with this gradle version the tests worked:

# /usr/local/gradle-3.2/bin/gradle -Dtest.single=WinAtChessTest cleanTest test
reppolice commented 7 years ago

right, the tests are running fine now, but neither your binary nor mine responds well to any UCI commands I tried after java -jar carballo-1.7.jar -Xmx1024M

./carballo.sh Carballo Chess Engine v1.7 by Alberto Alonso Ruibal ucinewgame Exception in thread "main" java.lang.NullPointerException at com.alonsoruibal.chess.uci.Uci.loop(Unknown Source) at com.alonsoruibal.chess.uci.Uci.main(Unknown Source)

albertoruibal commented 7 years ago

You must send the commands in the proper order:

# ./carballo.sh
Carballo Chess Engine v1.8 by Alberto Alonso Ruibal
-> uci
id name Carballo Chess Engine v1.8
id author Alberto Alonso Ruibal
option name Hash type spin default 64 min 16 max 1024
option name Ponder type check default true
option name OwnBook type check default true
option name UCI_Chess960 type check default false
option name UCI_LimitStrength type check default false
option name UCI_Elo type spin default 2100 min 500 max 2100
option name Evaluator type combo default complete var simplified var complete var experimental
option name Contempt Factor type spin default 90 min -200 max 200
uciok
-> isready
readyok
-> ucinewgame
reppolice commented 7 years ago

Ok! I was using some engines where "go" was available immediately, must have been bending the protocol!

reppolice commented 7 years ago

A new issue I came across on my Windows machine: there are codepage errors. Perhaps the build scripts would be more generic with something like this?

apply plugin: 'java'

tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }