need help in compiling xboard for the Mac gtk version

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

need help in compiling xboard for the Mac gtk version

Post by MikeB »

I'm at the last hurdle I believe - have already worked my way through ./autogen.sh and ./config - due to errors they took multiple hours to work through

now I have this make error that I have not been able to resolve:

Code: Select all

Mac:xboard-master michaelbyrne$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0

iMac:xboard-master michaelbyrne$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in po
  CCLD     xboard
ld: library not found for -lgtkmacintegration-gtk2
collect2: error: ld returned 1 exit status
make[2]: *** [xboard] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
iMac:xboard-master michaelbyrne$
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: need help in compiling xboard for the Mac gtk version

Post by MikeB »

Went to the pre complied version for the mac - now my problem is that if try to run xboard from the command line so I can run with the -nogui , it brings up the old xboard. If you double click the app. it does not start another instance - so how can I run multiple instances new xboard 4.8d for tournament play using the command line ?
zd3nik
Posts: 193
Joined: Wed Mar 11, 2015 3:34 am
Location: United States

Re: need help in compiling xboard for the Mac gtk version

Post by zd3nik »

It's been a while since I did development on a mac. But I would try using the "port" command to find and install the gtkmacintegration-gtk2 library.

If you don't have macports installed (e.g. the "port" command) start here: http://www.macports.org/
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: need help in compiling xboard for the Mac gtk version

Post by hgm »

MikeB wrote:Went to the pre complied version for the mac - now my problem is that if try to run xboard from the command line so I can run with the -nogui , it brings up the old xboard. If you double click the app. it does not start another instance - so how can I run multiple instances new xboard 4.8d for tournament play using the command line ?
Just to make sure I understand what you are doing:

with "brings up the old XBoard" you mean that you already have an instance of XBoard running, and that it raises that to the foreground, rather than staring a new one? And the "pre-compiled version" is the XBoard OSX App distributed by Joshua Pettus?

This was one of the main problems with using XBoard in OS X, and we did make some patches to prevent that. OS X has the nasty habit that when you start a new instance of an executable that is already running, it refuses to do it, but sends an "Open File" signal to the already-running instance instead. That holds for attempts to start the new instance from the command line, as well as by clicking the executable or associated documents, as for forking off a new instance from the existing one.

We made XBoard catch this Open File signal, so that the already running instance that gets it could then start up the desired new instance. This could not be done by simple forking, however, as OS X again would replace that by sending an Open File signal to the process that attempted it. But we discovered there was an "open" command that could (with certain flag arguments, -n -a) be used to force starting a new instance even when another instance is already running. So on receiving the "Open File" command, XBoard now forks of this "open -n -a xboard" command. It was a bit tricky to pass the arguments of the original command (that OS X changed into an Open File signal) to this "open -n" command, but eventually we succeeded in doing that. At least, that is what we thought.

This does not seem to work in your case, though. If you give us the exact commands you are using, perhaps Joshua can debug it.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: need help in compiling xboard for the Mac gtk version

Post by MikeB »

hgm wrote:
MikeB wrote:Went to the pre complied version for the mac - now my problem is that if try to run xboard from the command line so I can run with the -nogui , it brings up the old xboard. If you double click the app. it does not start another instance - so how can I run multiple instances new xboard 4.8d for tournament play using the command line ?
Just to make sure I understand what you are doing:

with "brings up the old XBoard" you mean that you already have an instance of XBoard running, and that it raises that to the foreground, rather than staring a new one? And the "pre-compiled version" is the XBoard OSX App distributed by Joshua Pettus?

This was one of the main problems with using XBoard in OS X, and we did make some patches to prevent that. OS X has the nasty habit that when you start a new instance of an executable that is already running, it refuses to do it, but sends an "Open File" signal to the already-running instance instead. That holds for attempts to start the new instance from the command line, as well as by clicking the executable or associated documents, as for forking off a new instance from the existing one.

We made XBoard catch this Open File signal, so that the already running instance that gets it could then start up the desired new instance. This could not be done by simple forking, however, as OS X again would replace that by sending an Open File signal to the process that attempted it. But we discovered there was an "open" command that could (with certain flag arguments, -n -a) be used to force starting a new instance even when another instance is already running. So on receiving the "Open File" command, XBoard now forks of this "open -n -a xboard" command. It was a bit tricky to pass the arguments of the original command (that OS X changed into an Open File signal) to this "open -n" command, but eventually we succeeded in doing that. At least, that is what we thought.

This does not seem to work in your case, though. If you give us the exact commands you are using, perhaps Joshua can debug it.
Yes - I have the version made by Joshua

http://www.open-aurec.com/wbforum/viewt ... 19&t=53274

and this the command I'm sending through terminal:

open XBoard.app -mm -tf /applications/xboard/tour/Tourney_150607_2214.trn -noGUI

If I start with no instance of xboard running , it will start an instance of the new xbaord - but not the tourney file selected but an match between two fairymax instances.

It will all kick-off the old x11 version of xboard ( need to know the proper way to delete the old xboard.).

if I run the command the second time, it will raise the gtk xboard to the foreground and kick off an instance of the x11 version of xboard ( I had exit out of the previous x11 of board running.)

Thanks for your help. Headed to work , will not be able to check back for about 12 hours.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: need help in compiling xboard for the Mac gtk version

Post by hgm »

OK, I see. The "open" command issued by the XBoard in the app will start the X11 XBoard. I am not very familiar with the App (I have no Mac or any Apple hardware), but is XBoard.app the original name of XBoard in the App, or did you rename it that way? The code I added to XBoard to fork off a new instance in response to the OpenFile OS X signal uses the plain name "xboard".

It could be that Joshua did some renaming tricks, though, making "xboard" in the App just a shell script that would perform some initialization necessary in OS X (like changing to some directory), and then calls the true XBoard binary which is then called XBoard.app. But if the X11 XBoard binary is in a directory that is searched before the App, under the name "xboard", it would be logical that this one is started in response to the forked-off "open" command.

I guess this problem should go away when you delete the X11 version. Normally it would be in a directory like /usr/bin/, /usr/games/, or /usr/local/bin, on Linux systems.

Note that the command that XBoard forks off is:

open -n -a "xboard" --args "COMMAND-LINE"

where COMMAND-LINE is the original command line that OS X sends together with the OpenFile signal (including the initial "xboard", I believe). The -n seems to force a new instance, even if the mentioned application is already running. But the arguments to XBoard are taken from the COMMAND-LINE part after --args. So it could be that the arguments in the command you give are all interpreted as (invalid) arguments to "open" rather than to XBoard.app, and that this is why XBoard doesn't see the tourney file etc..

Note that you could edit the -noGUI argument into the tourney file (which is just a special case of a settings file), as long as you don't put it at the end (which must always be the -result option). Then the XBoard that is launched in reponse to double-clicking that tourney file should automatically start in -noGUI mode, and you would not have to start from the command line.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: need help in compiling xboard for the Mac gtk version

Post by MikeB »

hgm wrote:OK, I see. The "open" command issued by the XBoard in the app will start the X11 XBoard. I am not very familiar with the App (I have no Mac or any Apple hardware), but is XBoard.app the original name of XBoard in the App, or did you rename it that way? The code I added to XBoard to fork off a new instance in response to the OpenFile OS X signal uses the plain name "xboard".

It could be that Joshua did some renaming tricks, though, making "xboard" in the App just a shell script that would perform some initialization necessary in OS X (like changing to some directory), and then calls the true XBoard binary which is then called XBoard.app. But if the X11 XBoard binary is in a directory that is searched before the App, under the name "xboard", it would be logical that this one is started in response to the forked-off "open" command.

I guess this problem should go away when you delete the X11 version. Normally it would be in a directory like /usr/bin/, /usr/games/, or /usr/local/bin, on Linux systems.

Note that the command that XBoard forks off is:

open -n -a "xboard" --args "COMMAND-LINE"

where COMMAND-LINE is the original command line that OS X sends together with the OpenFile signal (including the initial "xboard", I believe). The -n seems to force a new instance, even if the mentioned application is already running. But the arguments to XBoard are taken from the COMMAND-LINE part after --args. So it could be that the arguments in the command you give are all interpreted as (invalid) arguments to "open" rather than to XBoard.app, and that this is why XBoard doesn't see the tourney file etc..

Note that you could edit the -noGUI argument into the tourney file (which is just a special case of a settings file), as long as you don't put it at the end (which must always be the -result option). Then the XBoard that is launched in reponse to double-clicking that tourney file should automatically start in -noGUI mode, and you would not have to start from the command line.
All very helpful information. Deleted the last vintages of the old xboard and that stopped that from happening. Got the command line working with nogui ( using the option in the tourney file as you suggested.

I can start one tournament instance by doubleclicking the tourney file - but after that I suppose I have to a command line start any additional instances?

One odd thing, and it really may be more of a feature than a bug - but when using the command line start for the the tourney , it starts two instances of the tourney - which is fine , the second one starts on game 2 as appropriate.

Code: Select all

open -n -a XBoard --args -mm -tf /applications/xboard/tour/Tourney_150607_0200.trn
On uci engines, I can get them running the "old" method - which is also fine, but whenever I tried to use the fUCI engine , engine refuses to load

this works:

Code: Select all

"Fairymax" -fd "~~/../../bin/fairymax" -fcp "./fairymax"
"Arasanx" -fd /applications/arasanx -fcp "./polyglot arasanx.ini"
"Critter"-fd /applications/critter -fcp './polyglot critter.ini'
"Fruit"-fd /applications/fruit -fcp './polyglot fruit.ini'
"Glaurung" -fd /applications/glaurung -fcp './polyglot glaurung.ini'
"HIARCS" -fd /applications/HIARCS -fcp './polyglot Hiarcs14WCSC.ini'
"Junior" -fd /applications/junior -fcp './polyglot junior.ini'
"Komodo" -fd /applications/komodo -fcp './polyglot komodo.ini'
"Scorpio" -fd /applications/scorpio -fcp ./scorpio
"Senpai" -fd /applications/senpai -fcp './polyglot senpai.ini'
"Stockfish" -fd /applications/stockfish -fcp './polyglot stockfish.ini'
"Texel" -fd /applications/texel -fcp './polyglot texel.ini'
"Crafty1" -fd "~~/../../bin/engines/crafty/crafty1" -fcp ./crafty
"Crafty2" -fd  "~~/../../bin/engines/crafty/crafty2" -fcp ./crafty
"Crafty3" -fd  "~~/../../bin/engines/crafty/crafty3"-fcp ./crafty
"Crafty4" -fd  "~~/../../bin/engines/crafty/crafty4" -fcp ./crafty   
for the uci engines above , each directory has it own uci file

Both of these do not work:

Code: Select all

"Fruit"-fd /applications/fruit -fcp "./fruit" -fUCI
 "~~/../../bin/fruit" -fcp "./fruit" -fUCI 
The polyglot file is in the bin directory where it was installed in the Xboard.app,

I suppose I am missing some type of setting in the xboardApp.conf file? I had deleted some polyglot settings to get the uci engines working the old fashion way. I figure something was better than nothing.

Thanks again for all your help - your last post was very helpfull.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: need help in compiling xboard for the Mac gtk version

Post by MikeB »

these two command line started two instances of xboard each - not really complaining - to me this is a feature, but I thought it was odd.

Code: Select all

Mac-ac87a31e96d4:~ michaelbyrne$ open -n -a XBoard --args -mm -tf /applications/xboard/tour/Tourney_150607_0100.trn

Mac-ac87a31e96d4:~ michaelbyrne$ open -n -a XBoard --args -mm -tf /applications/xboard/tour/Tourney_150607_0200.trn
Mac-ac87a31e96d4:~ michaelbyrne$ 
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: need help in compiling xboard for the Mac gtk version

Post by hgm »

Indeed, this is odd, and unintended. Probably it should be considered an XBoard bug.

The problem is that OS X sends this OpenFile signal sometimes (but not always) to the first and only instance of an application, when it starts up. This seems to depend on the way it is launched. The application is then simply started with initially just a plain "xboard" as the command line, without any arguments. An OpenFile signal is then sent to this instance after it started, together with the full command line.

The problem is that this situation is difficult to distinguish from one where the user would first start an XBoard instance that indeed did not have any arguments, and some time later tries to start another instance with arguments, which then is replaced by OS X to sending the OpenFile signal to the already-running instance. In this latter case the already-running instance should fork off a second XBoard, as that is what the user asked, but in the former case it was all due to a single invocation of XBoard with arguments, and the reception of the OpenFile signal should be used only to redefine the arguments of the existing instance. I assume XBoard simehow confuses the two cases here.

Perhaps we have been approaching this the wrong way from the start, and should have always started the XBoard binary from an "open -n" command in a script, so that it never needs to fork off a new instance in response to an OpenFile signal, but can always assume this signal is just supplying its own arguments.
I can start one tournament instance by doubleclicking the tourney file - but after that I suppose I have to a command line start any additional instances?
In principle you can double-click a tourney file as often as you want. Each double-click should start a new XBoard running on that tournament. The .trn mime type is associated with XBoard in the desktop manager through the command "xboard -mm -tf XXX.trn". (In fact this does the same as "xboard XXX.trn", as mentioning just a filename without a flag argument to specify what it was for makes XBoard automatically add the flag arguments useful for a file of that type, "-mm -tf" for .trn files, "-lpf" for .fen files, etc.) Clicking the file is just a method to generate that particular command, and it should not matter how you generated it.
MikeB wrote:Both of these do not work:

Code: Select all

"Fruit"-fd /applications/fruit -fcp "./fruit" -fUCI
 "~~/../../bin/fruit" -fcp "./fruit" -fUCI 
I don't know if this is just a typo in the forum post, but note that both of these lines seem defective. In the first there should be a space before -fd. (Not sure if this can be fatal, though.) And it would try to run a version of Fruit not in XBoard App bundle, at /applications/fruit/fruit. (You could check if there indeed exists a file of that name.)

The second line should have an initial -fd, and would then try to run the fruit binary that is included in the App bundle. ("~~" stands for the installation path of the bundle.)

Proper operation of the -fUCI option is dependent on the value of the option -adapterCommand. Which in this case should refer to the Polyglot inside the XBoard App bundle, like polyglot -noini -ec "%fcp" -ed "%fd", containing the instruction to pass the XBoard -fcp and -fd argument to it. If this option is not set, or would not specify a working command to invoke Polyglot, it would break the -fUCI option, which is pretty agnostic in itself, and just substitutes the -fcp value for what the -adapterCommand says, after replacing all %xxx in the latter by the value of -xxx.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: need help in compiling xboard for the Mac gtk version

Post by MikeB »

Indeed, this is odd, and unintended. Probably it should be considered an XBoard bug
Worked normally this evening. Not sure why.
I don't know if this is just a typo in the forum post, but note that both of these lines seem defective. In the first there should be a space before -fd. (Not sure if this can be fatal, though.) And it would try to run a version of Fruit not in XBoard App bundle, at /applications/fruit/fruit. (You could check if there indeed exists a file of that name.)

The second line should have an initial -fd, and would then try to run the fruit binary that is included in the App bundle. ("~~" stands for the installation path of the bundle.)

Proper operation of the -fUCI option is dependent on the value of the option -adapterCommand. Which in this case should refer to the Polyglot inside the XBoard App bundle, like polyglot -noini -ec "%fcp" -ed "%fd", containing the instruction to pass the XBoard -fcp and -fd argument to it. If this option is not set, or would not specify a working command to invoke Polyglot, it would break the -fUCI option, which is pretty agnostic in itself, and just substitutes the -fcp value for what the -adapterCommand says, after replacing all %xxx in the latter by the value of -xxx.
Very helpful - this was enough to guide me. Also thanks for catching a few typos. For the Mac, this is the actual adapter command that works:

Code: Select all

-adapterCommand "polyglot -noini -ec %fcp -ed %fd"  
(no quotes around %fcp and %fd)

It's almost perfect - the only missing UCI setting is that the Engines Settings dialog box is missing the number of threads for multi-threaded engines - this is true with every multi core engine

Image
capture screen