compile error with master HEAD

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
Fleance
Posts: 2
Joined: September 24th, 2020, 5:35 pm

compile error with master HEAD

Post by Fleance »

Hello everone, I just wanted to build a debug version from master:
git clone "https://github.com/wesnoth/wesnoth.git" wesnoth
cd wesnoth
mkdir build && cd build
cmake .. -DCMAKE_BUILD=Debug -DCMAKE_INSTALL_PREFIX=/home/chris/project/usr
make
And got this error:
In file included from <command-line>:
/usr/include/stdc-predef.h: In substitution of 'template<class _Functor, class, class> std::function<std::__cxx11::basic_string<char>(gui2::slider&)>::function(_Functor) [with _Functor = <missing>; <template-parameter-1-2> = <missing>; <template-parameter-1-3> = <missing>]':
/home/chris/project/wesnoth/src/gui/dialogs/editor/generator_settings.cpp:60:52: required from here
/usr/include/stdc-predef.h:32:72: internal compiler error: Segmentation fault
32 | whether the overall intent is to support these features; otherwise,
| ^
0x7f97a9c06d5f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7f97a9bf1d09 __libc_start_main
../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
make[2]: *** [src/CMakeFiles/wesnoth-client.dir/build.make:2487: src/CMakeFiles/wesnoth-client.dir/gui/dialogs/editor/generator_settings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:496: src/CMakeFiles/wesnoth-client.dir/all] Error 2
make: *** [Makefile:171: all] Error 2
I build it on Debian testing/sid with the following libraries:
libboost-*-dev 1.74.0.3
libsdl2-dev 2.0.14+dfsg2-3
libsdl2-image-dev 2.0.5+dfsg1-2
libsdl2-mixer-dev 2.0.4+dfsg1-3
libsdl2-ttf-dev 2.0.15+dfsg1-1
libfontconfig-dev 2.13.1-4.2
libcairomm-1.0-dev 1.12.2-4
libpango1.0-dev 1.46.2-3
libvorbis-dev 1.3.7-1
libz3-dev 4.8.10-1
libssl-dev 1.1.1i-3

tools:
g++ 10.2.1-1
cmake 3.18.4
GNU Make 4.3

Did I missed something? Probably not a usual compiler error, but the compiler crashed for some segmentation fault reason?

Thank you in advance

/Fleance
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: compile error with master HEAD

Post by octalot »

It's a bug in GCC, for which the fix has been added to Debian's Experimental distro but not yet to their Testing or Unstable distros. Personally, I've downgraded to the 10.2.1-3 versions of the compiler packages.

https://bugs.debian.org/cgi-bin/bugrepo ... bug=980429
gnombat
Posts: 682
Joined: June 10th, 2010, 8:49 pm

Re: compile error with master HEAD

Post by gnombat »

You could try compiling with -DCMAKE_CXX_COMPILER=clang and see if that works.

On an unrelated note, shouldn't -DCMAKE_BUILD=Debug be -DCMAKE_BUILD_TYPE=Debug?
User avatar
egallager
Posts: 576
Joined: November 19th, 2020, 7:27 pm
Location: Concord, New Hampshire
Contact:

Re: compile error with master HEAD

Post by egallager »

octalot wrote: February 20th, 2021, 11:47 pm It's a bug in GCC, for which the fix has been added to Debian's Experimental distro but not yet to their Testing or Unstable distros. Personally, I've downgraded to the 10.2.1-3 versions of the compiler packages.

https://bugs.debian.org/cgi-bin/bugrepo ... bug=980429
Has the bug been reported to upstream GCC's bugzilla as well?
gnombat
Posts: 682
Joined: June 10th, 2010, 8:49 pm

Re: compile error with master HEAD

Post by gnombat »

egallager wrote: February 22nd, 2021, 12:17 am Has the bug been reported to upstream GCC's bugzilla as well?
It appears to be fixed already upstream.
Fleance
Posts: 2
Joined: September 24th, 2020, 5:35 pm

Re: compile error with master HEAD

Post by Fleance »

gnombat wrote: February 21st, 2021, 5:27 am You could try compiling with -DCMAKE_CXX_COMPILER=clang and see if that works.

Indeed, this works for me now, using llvm instead gcc.

On an unrelated note, shouldn't -DCMAKE_BUILD=Debug be -DCMAKE_BUILD_TYPE=Debug?
Opps, didn't saw that. But it was accepted anyway. And g++ build the whole project without crashing one time with this option. I guess this is just coincidental.
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: compile error with master HEAD

Post by Iris »

Fleance wrote: February 22nd, 2021, 11:54 am Opps, didn't saw that. But it was accepted anyway. And g++ build the whole project without crashing one time with this option. I guess this is just coincidental.
It is, very much so. I normally need to run scons about 4 times before the problematic files will be compiled successfully, but sometimes it's more, less, or far more rarely gcc decides not to crash on the first attempt. It's really confusing to see the fix in an upload to experimental instead of sid but I guess the Debian devs know what they are doing.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
tr0ll
Posts: 551
Joined: June 11th, 2006, 8:13 pm
Location: canada

Re: compile error with master HEAD

Post by tr0ll »

More than a year later i get the same compile error with latest source tarball 1.16.5 and g++ 10.2.1-6 (on Debian 5.10 x64) so i guess it hasnt really been fixed upstream. :|
The fellow who filed the bug report mentioned above also sent a test source file so you can check your compiler, and sure enough mine fails every second or 3rd attempt. I have attached it herewith so you can find it easily; the command to test for the bug is

Code: Select all

g++ -std=c++17 -Wno-return-type -c gcc-10-segfault.C
Thanks to this thread however, i realized i can just type make again and it will continue from where it left off and eventually succeed. :)
Not really pleased about the soundness of this approach though - how do we know a faulty compiler is generating good, safe code?
Attachments
gcc-10-segfault.C
(14.99 KiB) Downloaded 60 times
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: compile error with master HEAD

Post by Pentarctagon »

Another option of course would be to build with clang instead of gcc until it's fixed.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Post Reply