Page 1 of 4

StockFish engine

Posted: Tue Jan 11, 2011 8:43 pm
by andrejcher
Hi,

Am I allowed to embed StockFish engine in my paid iPhone/iPad application without any changes to it and without opening full source code of my application? It is not another clone of iPhone StockFish application. About my applications - it is FICS/ICC client with ability to play in offline mode too. I want to use engine for analyze game after it is finished online or on observing other one and for local play as well. I know that there is AnalysisBot on a FICS for that purpose but I don't want to use it and integrate in application because it is not for sure that it will exist in future. The same as don't want just copy/paste code from your appliaction without any permissions. If you need more details on application you can visit ichesspack.com

Thanks,
Andriy

Re: StockFish engine

Posted: Tue Jan 11, 2011 9:49 pm
by ppetrov
You can communicate to it (in a separate process) via UCI without restrictions. But as long as you link your and the SF sources in the same executable, the GPL requires you to share code.

Re: StockFish engine

Posted: Wed Jan 12, 2011 12:15 am
by kinderchocolate
Stockfish team? What do you think? iPhone doesn't allow a separate process to spawn, there's no way to create a new process in iPhone. Fundamentally, it's really the same thing, unmodified executable -> UCI communication. The only technical difference is static linking. If the Stockfish team is happy for it, there wouldn't be a problem.

I think the team should give approval, because it will benefit the community (more iPhone apps), since the sources aren't modified, forcing the sources to open wouldn't benefit anyone in the community. We should give some credits to the GUI developer by not forcing him to open source.

Andriy Dzyben, how do you think you will static link Stockfish? You can't link dynamically, Apple wouldn't allow. If you link statically and spawn Stockfish with a new thread, that wouldn't work because the engine assumes the inputs are from standard input and you can't emulate standard input in C++.

Re: StockFish engine

Posted: Wed Jan 12, 2011 9:29 am
by mcostalba
andrejcher wrote:Hi,

Am I allowed to embed StockFish engine in my paid iPhone/iPad application without any changes to it and without opening full source code of my application?
First of all thanks for asking !

In more accurate terms you are asking to relicense Stockfish under LGPL (http://en.wikipedia.org/wiki/GNU_Lesser ... ic_License) when embedded in a mobile/tablet PC.

Personally I don't see problems in this, actually I could even foreseen the possibility of a double GPL / LGPL licensing alltogheter, indipendently from the target platform, but Tord and Joona agreements are both mandatory in this case.

Re: StockFish engine

Posted: Wed Jan 12, 2011 11:36 am
by Michel
In more accurate terms you are asking to relicense Stockfish under LGPL (http://en.wikipedia.org/wiki/GNU_Lesser ... ic_License) when embedded in a mobile/tablet PC.
I think he is asking for a GPL exception. A GPL exception is something which is explicitly added to license to deal with certain special cases. Like apple not allowing a process to start another process on IOS. The latter is not a problem on Android and hence for Android such an exception would not be needed.

A GPL exception is much less radical than relicensing under the LGPL. IMHO such a drastic step should be _very_ carefully evaluated.

Re: StockFish engine

Posted: Wed Jan 12, 2011 12:10 pm
by kinderchocolate
Michel wrote:
In more accurate terms you are asking to relicense Stockfish under LGPL (http://en.wikipedia.org/wiki/GNU_Lesser ... ic_License) when embedded in a mobile/tablet PC.
I think he is asking for a GPL exception. A GPL exception is something which is explicitly added to license to deal with certain special cases. Like apple not allowing a process to start another process on IOS. The latter is not a problem on Android and hence for Android such an exception would not be needed.

A GPL exception is much less radical than relicensing under the LGPL. IMHO such a drastic step should be _very_ carefully evaluated.
Michel is right, LGPL wouldn't fulfill the requirements anyway. I happen to be on the same boat, my yet-to-published chess app uses Stockfish as the underlying engine. I had to modify the main loop in uci.cpp. Instead of waiting for standard inputs, it waits for a message from another thread. This way, I could spawn a Stockfish thread without modifying any other part of the code.

LGPL gives permission for dynamic linking, what we talking about is actual static linking, ie. embed the entire Stockfish code into the project. Apple's license is very strict, it wouldn't approve for dynamic linking, Unless the Stockfish team gives special permission to Andriy Dzyben and myself, I don't think we'd be able to publish Stockfish.

Re: StockFish engine

Posted: Wed Jan 12, 2011 12:31 pm
by hgm
One way aound this limitation would be to write your GUI as an operating system, which ust loads a Stockfish image into a large array, and then start a thread to run it. Or implements its own multi-tasking, if threads are not supported.

Re: StockFish engine

Posted: Wed Jan 12, 2011 1:26 pm
by andrejcher
kinderchocolate wrote:
Michel wrote:
In more accurate terms you are asking to relicense Stockfish under LGPL (http://en.wikipedia.org/wiki/GNU_Lesser ... ic_License) when embedded in a mobile/tablet PC.
I think he is asking for a GPL exception. A GPL exception is something which is explicitly added to license to deal with certain special cases. Like apple not allowing a process to start another process on IOS. The latter is not a problem on Android and hence for Android such an exception would not be needed.

A GPL exception is much less radical than relicensing under the LGPL. IMHO such a drastic step should be _very_ carefully evaluated.
Michel is right, LGPL wouldn't fulfill the requirements anyway. I happen to be on the same boat, my yet-to-published chess app uses Stockfish as the underlying engine. I had to modify the main loop in uci.cpp. Instead of waiting for standard inputs, it waits for a message from another thread. This way, I could spawn a Stockfish thread without modifying any other part of the code.

LGPL gives permission for dynamic linking, what we talking about is actual static linking, ie. embed the entire Stockfish code into the project. Apple's license is very strict, it wouldn't approve for dynamic linking, Unless the Stockfish team gives special permission to Andriy Dzyben and myself, I don't think we'd be able to publish Stockfish.
Yep. It is exactly what I'm asking about - exception in StockFish licensing to embed code. LGPL will not help. The same as communication via UCI - it is not possible on iOS. Writing own engine without cloning other one is crazy idea and it can take years to polish it.

Thank you all for the response.

Re: StockFish engine

Posted: Wed Jan 12, 2011 2:03 pm
by ppetrov
mcostalba wrote:Personally I don't see problems in this, actually I could even foreseen the possibility of a double GPL / LGPL licensing alltogheter, indipendently from the target platform, but Tord and Joona agreements are both mandatory in this case.
It's possible that even the three of you together (Marco, Joona, Tord) don't have the authority to change the license, or grant exceptions. If you have accepted non-trivial patches from other people, without requiring copyright assignment, then their agreement is also required.

Re: StockFish engine

Posted: Wed Jan 12, 2011 6:43 pm
by mcostalba
ppetrov wrote:
mcostalba wrote:Personally I don't see problems in this, actually I could even foreseen the possibility of a double GPL / LGPL licensing alltogheter, indipendently from the target platform, but Tord and Joona agreements are both mandatory in this case.
It's possible that even the three of you together (Marco, Joona, Tord) don't have the authority to change the license, or grant exceptions. If you have accepted non-trivial patches from other people, without requiring copyright assignment, then their agreement is also required.
No, any piece of code in is GPL and is esplicitly stated as that and there is no third party copyrighted code. We can do whatever we want with SF sources.