Page 1 of 1

Cannot compile xboard (GCC 10.4.0)

PostPosted: 04 Feb 2023, 19:26
by Roland Chastain
I try to compile xboard and I get an error.

My OS is Linux Mageia 64. My GCC version is 10.4.0.

I downloaded xboard source code here. I clicked on tree and then on snapshot.

Here is the output of make command:

Code: Select all
make  all-recursive
make[1]: Entering directory '/home/roland/Documents/echecs/sources/xboard/HEAD-efc70b6'
Making all in po
make[2]: Entering directory '/home/roland/Documents/echecs/sources/xboard/HEAD-efc70b6/po'
make[2]: Leaving directory '/home/roland/Documents/echecs/sources/xboard/HEAD-efc70b6/po'
make[2]: Entering directory '/home/roland/Documents/echecs/sources/xboard/HEAD-efc70b6'
  CCLD     xboard
/usr/bin/ld: book.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: childio.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: gamelist.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: ngamelist.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: moves.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: parser.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: pgntags.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: uci.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: board.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: draw.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: draw.o:(.bss+0x8): multiple definition of `currPvInfo'; backend.o:(.bss+0x8): first defined here
/usr/bin/ld: dialogs.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: engineoutput.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: nengineoutput.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: evalgraph.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: evalgraph.o:(.bss+0x8): multiple definition of `currPvInfo'; backend.o:(.bss+0x8): first defined here
/usr/bin/ld: nevalgraph.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: nevalgraph.o:(.bss+0x8): multiple definition of `currPvInfo'; backend.o:(.bss+0x8): first defined here
/usr/bin/ld: history.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: nhistory.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: menus.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: usystem.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: gtk/xboard.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: gtk/xoptions.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: gtk/xtimer.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
/usr/bin/ld: gtk/xengineoutput.o:(.bss+0x0): multiple definition of `ics_type'; backend.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:846: xboard] Error 1
make[2]: Leaving directory '/home/roland/Documents/echecs/sources/xboard/HEAD-efc70b6'
make[1]: *** [Makefile:1372: all-recursive] Error 1
make[1]: Leaving directory '/home/roland/Documents/echecs/sources/xboard/HEAD-efc70b6'
make: *** [Makefile:715: all] Error 2


I have encountered that error in many C programs. It seems that latest GCC version is stricter than previous versions. Usually you just have to add extern keyword to fix it.

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 05 Feb 2023, 13:56
by Roland Chastain
Indeed, I only had to add the extern keyword in two places:

Code: Select all
// backend.h line 245
extern enum ICS_TYPE ics_type;

// evalgraph.h line 37
extern ChessProgramStats_Move * currPvInfo;


After that, compilation successful. 8-)

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 05 Feb 2023, 14:05
by Roland Chastain
I see in About XBoard window this version number: 4.9.0 2016-04-02. So I have a doubt if the source code that I downloaded is really the latest state of the project.

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 09 Feb 2023, 04:40
by Josh Pettus
Roland Chastain wrote:I see in About XBoard window this version number: 4.9.0 2016-04-02. So I have a doubt if the source code that I downloaded is really the latest state of the project.


Awesome! Thank you! It had been a while since I got this to compile. HGM's repo has the absolute latest code over at http://hgm.nubati.net

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 25 Feb 2023, 10:59
by Roland Chastain
Josh Pettus wrote:Awesome! Thank you!

You are welcome. :wink:

Josh Pettus wrote:HGM's repo has the absolute latest code over at http://hgm.nubati.net

This is where I downloaded the code. But I have had a doubt whether it really was the latest version, because I saw that the latest modification is from 2016.

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 25 Feb 2023, 11:27
by Roland Chastain
I removed XBoard 4.9.1 that I had installed from Mageia packages, and installed instead the version that I compiled, with sudo make install.

It works fine, excepted that I have a warning about a sound file not found ('/usr/share/games/xboard/sounds/woodthunk.wav').

I see in my installation log file that sound files have been installed in another directory (/usr/local/share/games/xboard/sounds).

Code: Select all
/usr/bin/install -c -m 644 sounds/cymbal.wav sounds/pop2.wav sounds/slap.wav sounds/ding1.wav sounds/laser.wav sounds/woodthunk.wav sounds/gong.wav sounds/penalty.wav sounds/honkhonk.wav sounds/phone.wav sounds/roar.wav '/usr/local/share/games/xboard/sounds'


Problem solved:

Code: Select all
sudo mkdir -p /usr/share/games/xboard/sounds/
sudo cp /usr/local/share/games/xboard/sounds/*.wav /usr/share/games/xboard/sounds/


P.-S. I could have edited this line in .xboardrc:

Code: Select all
-soundDirectory "/usr/share/games/xboard/sounds"

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 26 Feb 2023, 13:47
by H.G.Muller
When installing from a source package the files end up in /usr/local/bin (binaries) and /usr/local/share/games (data files), where from a binary package (or the official repositories) they would go into /usr/bin (or /usr games) and /usr/share/games. Since /usr/local/bin would normally be searched before /usr/bin and /usr/games, the install from source would eclipse the official version, without any need to de-install it.

Beware that to get the latest version from my on-line git repository, you should download from the v4.9.x branch, not from master. I now also committed the patch there that adds the 'extern' keywords.

Re: Cannot compile xboard (GCC 10.4.0)

PostPosted: 26 Feb 2023, 20:38
by Roland Chastain
H.G.Muller wrote:Beware that to get the latest version from my on-line git repository, you should download from the v4.9.x branch, not from master.


Thanks, I hadn't noticed that there were several branches. I downloaded a snapshot of 4.9.x branch and could compile it without any issue.

Thanks also for the other informations.