Ajatt-Tools / gd-tools

🍣 A set of tools to enhance GoldenDict.
https://tatsumoto.neocities.org/blog/setting-up-goldendict#gd-tools
GNU General Public License v3.0
31 stars 5 forks source link

[Ubuntu 22.04.4] error: attempt to compare table with string #24

Closed DorianK29 closed 5 months ago

DorianK29 commented 5 months ago

OS: Ubuntu 22.04.4 Steps:

git clone https://github.com/Ajatt-Tools/gd-tools
cd ./gd-tools
./quickinstall.sh

then I get this error.

I tried building older commits, but they also gave the same error, but on different header files.

+ readonly target=gd-tools
+ target=gd-tools
+ xmake config --tests=n
checking for platform ... linux
checking for architecture ... x86_64
+ xmake config -m release
checking for platform ... linux
checking for architecture ... x86_64
+ xmake build -vwy gd-tools
checking for clang-format ... no
Skipped clang-format run for target: gd-tools
checking for gcc ... /usr/bin/gcc
checking for the c++ compiler (cxx) ... gcc
checking for flags (-fPIC) ... ok
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-O2) ... ok
checking for flags (-std=c++23) ... ok
checking for flags (-Wno-error=maybe-uninitialized) ... ok
checking for flags (-fstack-protector-strong) ... ok
checking for flags (-fstack-clash-protection) ... ok
checking for flags (-Wall) ... ok
checking for flags (-Wextra) ... ok
checking for flags (-Wpedantic) ... ok
checking for flags (-Wconversion) ... ok
checking for flags (-Wshadow) ... ok
checking for flags (-Werror) ... ok
checking for flags (-D_GLIBCXX_ASSERTIONS) ... ok
checking for flags (-DNDEBUG) ... ok
[  8%]: cache compiling.release src/precompiled.h
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O2 -std=c++23 -I build/.objs/gd-tools/linux/x86_64/release/src/cxx -isystem /home/user/.xmake/packages/c/cpr/1.10.5/a843d29c3c92427ea845ec3d1f857233/include -isystem /home/user/.xmake/packages/l/libcurl/8.6.0/89fe72f249d24b2dabfbea19efe58bfd/include -isystem /home/user/.xmake/packages/n/nlohmann_json/v3.11.3/e149edbbe9eb49578665e1f621062ffd/include -isystem /home/user/.xmake/packages/m/marisa/v0.2.6/5a0e09c409624b3f9697d07471b0f3d1/include -isystem /home/user/.xmake/packages/r/rdricpp/v0.3/ca84005cd58b4997990298dc5f4c17bc/include -isystem /home/user/.xmake/packages/m/mecab/0.996/8b975ce961c243cc921defddf452f954/include -Wno-error=maybe-uninitialized -fstack-protector-strong -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wshadow -Werror -D_GLIBCXX_ASSERTIONS -DNDEBUG -x c++-header -o build/.objs/gd-tools/linux/x86_64/release/src/cxx/precompiled.h.gch src/precompiled.h
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
error: attempt to compare table with string
tatsumoto-ren commented 5 months ago

@xieamoe any thoughts?

xieamoe commented 5 months ago

It's the same error I got trying to compile on Windows, I believe. Xmake lua error. @DorianK29 Please post the full log by running xmake -vD

DorianK29 commented 5 months ago
Skipped clang-format run for target: gd-tools
[  8%]: cache compiling.release src/precompiled.h
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O2 -std=c++23 -I build/.objs/gd-tools/linux/x86_64/release/src/cxx -isystem /home/user/.xmake/packages/c/cpr/1.10.5/a843d29c3c92427ea845ec3d1f857233/include -isystem /home/user/.xmake/packages/l/libcurl/8.6.0/89fe72f249d24b2dabfbea19efe58bfd/include -isystem /home/user/.xmake/packages/n/nlohmann_json/v3.11.3/e149edbbe9eb49578665e1f621062ffd/include -isystem /home/user/.xmake/packages/m/marisa/v0.2.6/5a0e09c409624b3f9697d07471b0f3d1/include -isystem /home/user/.xmake/packages/r/rdricpp/v0.3/ca84005cd58b4997990298dc5f4c17bc/include -isystem /home/user/.xmake/packages/m/mecab/0.996/8b975ce961c243cc921defddf452f954/include -Wno-error=maybe-uninitialized -fstack-protector-strong -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wshadow -Werror -D_GLIBCXX_ASSERTIONS -DNDEBUG -x c++-header -o build/.objs/gd-tools/linux/x86_64/release/src/cxx/precompiled.h.gch src/precompiled.h
error: @programdir/core/main.lua:329: attempt to compare table with string
stack traceback:
    [C]: in function 'sort'
    [@programdir/rules/plugin/compile_commands/xmake.lua:61]: in function 'buildscript'
    [@programdir/actions/build/main.lua:97]: in function '_do_project_rules'
    [@programdir/actions/build/main.lua:144]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [@programdir/actions/build/main.lua:118]: in function 'build_targets'
    [@programdir/actions/build/main.lua:201]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:275]:
    [@programdir/core/base/task.lua:491]: in function 'run'
    [@programdir/core/main.lua:327]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:406]:

stack traceback:
    [C]: in function 'error'
    @programdir/core/base/os.lua:957: in function 'os.raiselevel'
    (...tail calls...)
    @programdir/core/main.lua:329: in upvalue 'cotask'
    @programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
tatsumoto-ren commented 5 months ago

It builds successfully in CI now. Does it build on your computer too?

DorianK29 commented 5 months ago
[  8%]: cache compiling.release src/precompiled.h
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O2 -std=c++23 -I build/.objs/gd-tools/linux/x86_64/release/src/cxx -isystem /home/user/.xmake/packages/c/cpr/1.10.5/a843d29c3c92427ea845ec3d1f857233/include -isystem /home/user/.xmake/packages/l/libcurl/8.6.0/89fe72f249d24b2dabfbea19efe58bfd/include -isystem /home/user/.xmake/packages/n/nlohmann_json/v3.11.3/e149edbbe9eb49578665e1f621062ffd/include -isystem /home/user/.xmake/packages/m/marisa/v0.2.6/5a0e09c409624b3f9697d07471b0f3d1/include -isystem /home/user/.xmake/packages/r/rdricpp/v0.3/ca84005cd58b4997990298dc5f4c17bc/include -isystem /home/user/.xmake/packages/m/mecab/0.996/8b975ce961c243cc921defddf452f954/include -Wno-error=maybe-uninitialized -fstack-protector-strong -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wshadow -Werror -D_GLIBCXX_ASSERTIONS -DNDEBUG -x c++-header -o build/.objs/gd-tools/linux/x86_64/release/src/cxx/precompiled.h.gch src/precompiled.h
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
create ok!
compile_commands.json updated!
error: src/precompiled.h:8:10: fatal error: format: No such file or directory
    8 | #include <format>
      |          ^~~~~~~~
compilation terminated.
tatsumoto-ren commented 5 months ago

fatal error: format: No such file or directory

That's a different issue. if <format> is not found, it is most likely an outdated gcc version. I think you need at least 13.2.

DorianK29 commented 5 months ago

Built successfuly after I changed the gcc version.

rm /usr/bin/gcc
rm /usr/bin/g++

ln -s /usr/bin/gcc-13 /usr/bin/gcc
ln -s /usr/bin/g++-13 /usr/bin/g++