How to compile discocheck?

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
mohzus
Posts: 106
Joined: Tue Sep 24, 2013 12:54 am

How to compile discocheck?

Post by mohzus » Tue Jan 07, 2014 3:41 am

I've just downloaded discocheck and tried to compile it. The readme states to run the command "./make.sh", which produced tons of errors.
However in a thread in another forum, the following was suggested:

Code: Select all

./make.sh ./discocheck
. The output in my terminal is

Code: Select all

cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
cc1plus: error: unrecognized command line option ‘-std=c++11’
My OS is Ubuntu 12.04, my compiler is gcc 4.8.1. Any help is appreciated. Thank you.

Aaron Becker
Posts: 292
Joined: Tue Jul 07, 2009 2:56 am

Re: How to compile discocheck?

Post by Aaron Becker » Tue Jan 07, 2014 9:18 am

The error message suggests that the build is actually using an older compiler that doesn't understand c++11. You might need to edit make.sh to explicitly use g++-4.8 or something along those lines.

zullil
Posts: 5850
Joined: Mon Jan 08, 2007 11:31 pm
Location: PA USA
Full name: Louis Zulli

Re: How to compile discocheck?

Post by zullil » Tue Jan 07, 2014 9:47 am

What's the output from

Code: Select all

g++ -v
on a command line?

User avatar
lucasart
Posts: 3075
Joined: Mon May 31, 2010 11:29 am
Full name: lucasart
Contact:

Re: How to compile discocheck?

Post by lucasart » Tue Jan 07, 2014 11:27 am

Seems people have already answered. You need a C++11 capable version of GCC. Version 4.8.1 is fine, and it's the one I'm using. Ubuntu comes with GCC (C compiler only) but you have to install the package g++ separately for the C++ compiler (and C++ standard libraries).

If you have a slightly old version of GCC, it should work by replacing 'c++11' bu 'c++0x' in the 'make.sh' file. If it's really old, then it will not work.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.

Tom Likens
Posts: 303
Joined: Sat Apr 28, 2012 4:18 pm
Location: Austin, TX
Contact:

Re: How to compile discocheck?

Post by Tom Likens » Tue Jan 07, 2014 12:58 pm

lucasart wrote:Seems people have already answered. You need a C++11 capable version of GCC. Version 4.8.1 is fine, and it's the one I'm using. Ubuntu comes with GCC (C compiler only) but you have to install the package g++ separately for the C++ compiler (and C++ standard libraries).

If you have a slightly old version of GCC, it should work by replacing 'c++11' bu 'c++0x' in the 'make.sh' file. If it's really old, then it will not work.
Hey Lucas,

I'm thinking of switching to C++11 and I'm wondering about your experiences with it. Has it been worth the switch? How painful was the transition?

regards,
--tom

User avatar
lucasart
Posts: 3075
Joined: Mon May 31, 2010 11:29 am
Full name: lucasart
Contact:

Re: How to compile discocheck?

Post by lucasart » Tue Jan 07, 2014 1:42 pm

Tom Likens wrote:
lucasart wrote:Seems people have already answered. You need a C++11 capable version of GCC. Version 4.8.1 is fine, and it's the one I'm using. Ubuntu comes with GCC (C compiler only) but you have to install the package g++ separately for the C++ compiler (and C++ standard libraries).

If you have a slightly old version of GCC, it should work by replacing 'c++11' bu 'c++0x' in the 'make.sh' file. If it's really old, then it will not work.
Hey Lucas,

I'm thinking of switching to C++11 and I'm wondering about your experiences with it. Has it been worth the switch? How painful was the transition?

regards,
--tom
DiscoCheck was written in plain C up to version 3.7.1. Version 4.0 is a complete C++ rewrite:
* the transition was a lot of (useless) work.
* it is not worth the switch at all. C++ adds nothing useful to the table, except being and endless waste of time to read encyclopedic books to be able to use it properly...

Besides the syntactic sugar, the only things in C++ that I did find useful are:
* string/stringstream
* namespaces (technically they are syntactic sugar, but I really do like them)
* std::chrono (portable high resolution clock avoiding lots of ugly ifdef's)

Don't listen to the C++ Mermaids... I speak from experience.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.

User avatar
mohzus
Posts: 106
Joined: Tue Sep 24, 2013 12:54 am

Re: How to compile discocheck?

Post by mohzus » Tue Jan 07, 2014 2:06 pm

Aaron Becker wrote:The error message suggests that the build is actually using an older compiler that doesn't understand c++11. You might need to edit make.sh to explicitly use g++-4.8 or something along those lines.
I see. How would I do that?
Zulil wrote:What's the output from

Code: Select all

g++ -v
on a command line?
I get

Code: Select all

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.4-1ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.4 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 
I do not know why it shows gcc version 4.6.4 because I have the 4.8.1.
Lucas wrote:Seems people have already answered. You need a C++11 capable version of GCC. Version 4.8.1 is fine, and it's the one I'm using. Ubuntu comes with GCC (C compiler only) but you have to install the package g++ separately for the C++ compiler (and C++ standard libraries).

If you have a slightly old version of GCC, it should work by replacing 'c++11' bu 'c++0x' in the 'make.sh' file. If it's really old, then it will not work.
Well I have gcc 4.8.1 as shown by the command "gcc -v" which returns

Code: Select all

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04) 
I have also installed the g++4.8 separately and its multilib files, via the Ubuntu Software Center.
So I don't see any reason why I would get such errors.

Nonetheless I have tried your suggestion of replacing 'c++11' by 'c++0x' in the 'make.sh' file. I could create the executable. When executing it, I'd get a core dump error, I suspect it has to do with the sse4 so I removed that part in the make.sh file. Now I can execute discocheck. I can even set the UCI_Analyse mode and a fen position. However when I type "go" or "go infinite", I get the "Segmentation fault (core dumped)" error...
My cpu is a core 2 duo E6300 at 1.86 Ghz (from 2006). Is there any hope I can run discocheck?

Henk
Posts: 5883
Joined: Mon May 27, 2013 8:31 am

Re: How to compile discocheck?

Post by Henk » Tue Jan 07, 2014 3:01 pm

You cannot use design patterns like singleton, iterator, visitor, builder, strategy, prototype, bridge in the C language. In C you also have more global variables than in object oriented languages. Both C++ and C# support generics and abstraction. Although it seems like the more patterns you use the slower the chess program gets.

User avatar
mohzus
Posts: 106
Joined: Tue Sep 24, 2013 12:54 am

Re: How to compile discocheck?

Post by mohzus » Tue Jan 07, 2014 3:16 pm

I just figured out how to use the g++4.8 stuff. I had to type the command

Code: Select all

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
. So now I can compile and excute discocheck by modifying only the msse4.2 part in the make.sh file.
But I still get the error of dumped core when typing "go" or "go infinite" in the command-line.

tmokonen
Posts: 1075
Joined: Sun Mar 12, 2006 5:46 pm
Location: Vancouver

Re: How to compile discocheck?

Post by tmokonen » Tue Jan 07, 2014 6:50 pm

You would have to issue isready and position commands, at a minimum, before issuing a go command.

Post Reply