adidvar / Chess-app

My pet chess engine
Other
0 stars 0 forks source link

can't compile on Linux #2

Open tissatussa opened 5 months ago

tissatussa commented 5 months ago

i just found your pet chess engine app .. i'm trying to compile it on Linux (Xubuntu 22.04) but it fails .. however, i found some info to fix it.

first i had to adjust some Cmake file, because the command cmake . ends with the error Unknown CMake command "qt_standard_project_setup" .. i found a solution at https://stackoverflow.com/questions/75624351/unknown-cmake-command-qt-standard-project-setup-on-raspberry-pi : about 1 year ago some user had the same problem and the fix also seems to work for me : in the file /lib/chessui/CMakeLists.txt i had to change the line qt_standard_project_setup() and its 2 set commands into these 3 lines :

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

this way cmake runs properly : a makefile is created.

but the compiling fails with many (same) errors .. i guess you're using some typical Windows code construction, here are the crucial parts of my error messages :

~/Compiled/Chess-app-1.0$ make
[  3%] Building CXX object chesscore/CMakeFiles/chesscore.dir/src/bitboard.cpp.o
In file included from /home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitboard.hpp:10,
                 from /home/roelof/Compiled/Chess-app-1.0/lib/chesscore/src/bitboard.cpp:1:
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:8:22: error: ‘constexpr bitboard_t operator""_b(bitboard_t)’ has invalid argument list
    8 | constexpr bitboard_t operator"" _b(bitboard_t num) {
      |                      ^~~~~~~~
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:6: error: unable to find numeric literal operator ‘operator""_b’
   24 |     {56_b + 58_b + 59_b + 60_b, 60_b + 61_b + 62_b + 63_b},
      |      ^~~~
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:6: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:13: error: unable to find numeric literal operator ‘operator""_b’
   24 |     {56_b + 58_b + 59_b + 60_b, 60_b + 61_b + 62_b + 63_b},
      |             ^~~~
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:13: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:20: error: unable to find numeric literal operator ‘operator""_b’
   24 |     {56_b + 58_b + 59_b + 60_b, 60_b + 61_b + 62_b + 63_b},
      |                    ^~~~
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:20: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/include/bitconsts.hpp:24:27: error: unable to find numeric literal operator ‘operator""_b’
   24 |     {56_b + 58_b + 59_b + 60_b, 60_b + 61_b + 62_b + 63_b},

..and it ends with :

/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/src/bitboard.cpp:235:23: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/src/bitboard.cpp: In member function ‘bool BitBoard::ExecuteTurn(Turn)’:
/home/roelof/Compiled/Chess-app-1.0/lib/chesscore/src/bitboard.cpp:734:41: error: ‘operator""_b’ was not declared in this scope; did you mean ‘operator==’?
  734 |       GenerateSubBoards(CurrentColor(), operator""_b(turn.from().Value()),
      |                                         ^~~~~~~~~~~~
      |                                         operator==
make[2]: *** [chesscore/CMakeFiles/chesscore.dir/build.make:76: chesscore/CMakeFiles/chesscore.dir/src/bitboard.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:233: chesscore/CMakeFiles/chesscore.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

i guess this should be easy to fix. i don't do Windows.

tissatussa commented 5 months ago

btw. regarding the operator"" error i found https://stackoverflow.com/questions/16596864/c11-operator-with-double-parameter .. maybe it can help you.

adidvar commented 5 months ago

Hi looks like in a48a50572 the problem is fixed. In any case, on my wsl it compiles successfully.

tissatussa commented 5 months ago

i did a new git clone of your updated source code, but i still have an error :

$ cmake -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_C_COMPILER=gcc-13 .
-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-13 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-13 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found WrapOpenGL: TRUE  
-- Found XKB: /usr/lib/x86_64-linux-gnu/libxkbcommon.so (found suitable version "1.4.0", minimum required is "0.5.0") 
-- Found WrapVulkanHeaders: /usr/include  
CMake Error at src/chess/CMakeLists.txt:22 (qt_generate_deploy_app_script):
  Unknown CMake command "qt_generate_deploy_app_script".

-- Configuring incomplete, errors occurred!

Note: i used extra parameters to compile with g++-13 / gcc-13 but normal g++ / gcc (v11) give same error ..

can you test on Linux ? (and what is 'wsl' ?)

btw. i see the folder chessui does no longer exist !?

adidvar commented 5 months ago

I removed the line that caused the error. it is surprising that on Windows it does not cause an error.

Now I can test only on wsl, maybe later I will be able to on linux, but I'm not sure.

WSL

i moved the code from chessui to another place