Cannot compile xboard (GCC 10.4.0)

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Cannot compile xboard (GCC 10.4.0)

Postby Roland Chastain » 04 Feb 2023, 19:26

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.
Roland Chastain
 
Posts: 65
Joined: 24 Feb 2019, 12:45
Location: France

Re: Cannot compile xboard (GCC 10.4.0)

Postby Roland Chastain » 05 Feb 2023, 13:56

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-)
Roland Chastain
 
Posts: 65
Joined: 24 Feb 2019, 12:45
Location: France

Re: Cannot compile xboard (GCC 10.4.0)

Postby Roland Chastain » 05 Feb 2023, 14:05

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.
Roland Chastain
 
Posts: 65
Joined: 24 Feb 2019, 12:45
Location: France

Re: Cannot compile xboard (GCC 10.4.0)

Postby Josh Pettus » 09 Feb 2023, 04:40

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
Josh Pettus
 
Posts: 317
Joined: 11 Mar 2009, 01:11

Re: Cannot compile xboard (GCC 10.4.0)

Postby Roland Chastain » 25 Feb 2023, 10:59

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.
Roland Chastain
 
Posts: 65
Joined: 24 Feb 2019, 12:45
Location: France

Re: Cannot compile xboard (GCC 10.4.0)

Postby Roland Chastain » 25 Feb 2023, 11:27

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"
Roland Chastain
 
Posts: 65
Joined: 24 Feb 2019, 12:45
Location: France

Re: Cannot compile xboard (GCC 10.4.0)

Postby H.G.Muller » 26 Feb 2023, 13:47

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.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Cannot compile xboard (GCC 10.4.0)

Postby Roland Chastain » 26 Feb 2023, 20:38

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.
Roland Chastain
 
Posts: 65
Joined: 24 Feb 2019, 12:45
Location: France


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 1 guest