MatsuriDayo / nekoray

Qt based cross-platform GUI proxy configuration manager (backend: sing-box)
https://matsuridayo.github.io/
GNU General Public License v3.0
13.31k stars 1.24k forks source link

BUG: nekoray/3rdparty/ZxingQtReader.hpp:118:67: error: cannot convert ‘std::wstring’ {aka ‘std::__cxx11::basic_string<wchar_t>’} to ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} #1056

Closed slkbnt closed 4 months ago

slkbnt commented 11 months ago

Describe the problem

Expected behavior:

It will compile the whole software

Actual behavior:

[65/83] Building CXX object CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o
FAILED: CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o 
/usr/bin/c++ -DNKR_VERSION=\"3.24-2023-10-28\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_WIDGETS_LIB -I/home/money/Testing/nekoray/build -I/home/money/Testing/nekoray -I/home/money/Testing/nekoray/build/nekoray_autogen/include -I/home/money/Testing/nekoray/3rdparty/QHotkey/QHotkey -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -fPIC -std=gnu++17 -MD -MT CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o -MF CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o.d -o CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o -c /home/money/Testing/nekoray/ui/mainwindow.cpp
In file included from /usr/include/ZXing/ReadBarcode.h:10,
                 from /home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp:8,
                 from /home/money/Testing/nekoray/ui/mainwindow.cpp:27:
/usr/include/ZXing/Result.h:73:153: note: ‘#pragma message: Warning: the return type of text() and ecLevel() will change to std::string. Please #define ZX_USE_UTF8 to transition before the next release.’
   73 |         "Warning: the return type of text() and ecLevel() will change to std::string. Please #define ZX_USE_UTF8 to transition before the next release.")
      |                                                                                                                                                         ^
/home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp: In constructor ‘ZXingQt::Result::Result(ZXing::Result&&)’:
/home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp:118:67: error: cannot convert ‘std::wstring’ {aka ‘std::__cxx11::basic_string<wchar_t>’} to ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
  118 |                 _text = QString::fromStdString(ZXing::Result::text());
      |                                                ~~~~~~~~~~~~~~~~~~~^~
      |                                                                   |
      |                                                                   std::wstring {aka std::__cxx11::basic_string<wchar_t>}
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qhashfunctions.h:44,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:47,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:45,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QVariant:1,
                 from /home/money/Testing/nekoray/build/nekoray_autogen/include/./ui_mainwindow.h:12,
                 from /home/money/Testing/nekoray/ui/mainwindow.cpp:1:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1555:58: note:   initializing argument 1 of ‘static QString QString::fromStdString(const std::string&)’
 1555 | inline QString QString::fromStdString(const std::string &s)
      |                                       ~~~~~~~~~~~~~~~~~~~^
[72/83] Building CXX object CMakeFiles...ray.dir/ui/dialog_basic_settings.cpp.o
ninja: build stopped: subcommand failed.

How to reproduce

$ cmake -GNinja ..
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
[CMAKE_PREFIX_PATH] /home/money/Testing/nekoray/libs/deps/built
[CMAKE_FIND_ROOT_PATH] /home/money/Testing/nekoray/libs/deps/built
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- The C compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so (found version "3.21.12") 
CMake Warning (dev) at 3rdparty/QHotkey/CMakeLists.txt:6 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'QHOTKEY_INSTALL'.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/money/Testing/nekoray/build
$ ninja
[19/83] Generating /home/money/Testing/nekoray/translations/zh_CN.ts
Updating '../translations/zh_CN.ts'...
    Found 407 source text(s) (0 new and 407 already existing)
[20/83] Generating /home/money/Testing/nekoray/translations/fa_IR.ts
Updating '../translations/fa_IR.ts'...
    Found 407 source text(s) (0 new and 407 already existing)
[21/83] Generating /home/money/Testing/nekoray/translations/ru_RU.ts
Updating '../translations/ru_RU.ts'...
    Found 407 source text(s) (0 new and 407 already existing)
[23/83] Generating zh_CN.qm
Updating '/home/money/Testing/nekoray/build/zh_CN.qm'...
    Generated 407 translation(s) (407 finished and 0 unfinished)
[24/83] Generating fa_IR.qm
Updating '/home/money/Testing/nekoray/build/fa_IR.qm'...
    Generated 315 translation(s) (216 finished and 99 unfinished)
    Ignored 92 untranslated source text(s)
[25/83] Generating ru_RU.qm
Updating '/home/money/Testing/nekoray/build/ru_RU.qm'...
    Generated 401 translation(s) (401 finished and 0 unfinished)
    Ignored 6 untranslated source text(s)
[65/83] Building CXX object CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o
FAILED: CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o 
/usr/bin/c++ -DNKR_VERSION=\"3.24-2023-10-28\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_WIDGETS_LIB -I/home/money/Testing/nekoray/build -I/home/money/Testing/nekoray -I/home/money/Testing/nekoray/build/nekoray_autogen/include -I/home/money/Testing/nekoray/3rdparty/QHotkey/QHotkey -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -fPIC -std=gnu++17 -MD -MT CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o -MF CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o.d -o CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o -c /home/money/Testing/nekoray/ui/mainwindow.cpp
In file included from /usr/include/ZXing/ReadBarcode.h:10,
                 from /home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp:8,
                 from /home/money/Testing/nekoray/ui/mainwindow.cpp:27:
/usr/include/ZXing/Result.h:73:153: note: ‘#pragma message: Warning: the return type of text() and ecLevel() will change to std::string. Please #define ZX_USE_UTF8 to transition before the next release.’
   73 |         "Warning: the return type of text() and ecLevel() will change to std::string. Please #define ZX_USE_UTF8 to transition before the next release.")
      |                                                                                                                                                         ^
/home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp: In constructor ‘ZXingQt::Result::Result(ZXing::Result&&)’:
/home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp:118:67: error: cannot convert ‘std::wstring’ {aka ‘std::__cxx11::basic_string<wchar_t>’} to ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
  118 |                 _text = QString::fromStdString(ZXing::Result::text());
      |                                                ~~~~~~~~~~~~~~~~~~~^~
      |                                                                   |
      |                                                                   std::wstring {aka std::__cxx11::basic_string<wchar_t>}
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qhashfunctions.h:44,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:47,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:45,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QVariant:1,
                 from /home/money/Testing/nekoray/build/nekoray_autogen/include/./ui_mainwindow.h:12,
                 from /home/money/Testing/nekoray/ui/mainwindow.cpp:1:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1555:58: note:   initializing argument 1 of ‘static QString QString::fromStdString(const std::string&)’
 1555 | inline QString QString::fromStdString(const std::string &s)
      |                                       ~~~~~~~~~~~~~~~~~~~^
[72/83] Building CXX object CMakeFiles...ray.dir/ui/dialog_basic_settings.cpp.o
ninja: build stopped: subcommand failed.

Information:

$ uname -a
Linux debian12 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux
purofle commented 11 months ago

Try to install zxing-cpp first, because it is needed by nekoray

slkbnt commented 11 months ago

Try to install zxing-cpp first, because it is needed by nekoray

nothing change and still facing the same issue:

$ ninja
[18/80] Generating fa_IR.qm
Updating '/home/money/Testing/nekoray/build/fa_IR.qm'...
    Generated 315 translation(s) (216 finished and 99 unfinished)
    Ignored 92 untranslated source text(s)
[19/80] Generating ru_RU.qm
Updating '/home/money/Testing/nekoray/build/ru_RU.qm'...
    Generated 401 translation(s) (401 finished and 0 unfinished)
    Ignored 6 untranslated source text(s)
[20/80] Generating zh_CN.qm
Updating '/home/money/Testing/nekoray/build/zh_CN.qm'...
    Generated 407 translation(s) (407 finished and 0 unfinished)
[62/80] Building CXX object CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o
FAILED: CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o 
/usr/bin/c++ -DNKR_VERSION=\"3.24-2023-10-28\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_WIDGETS_LIB -I/home/money/Testing/nekoray/build -I/home/money/Testing/nekoray -I/home/money/Testing/nekoray/build/nekoray_autogen/include -I/home/money/Testing/nekoray/3rdparty/QHotkey/QHotkey -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -fPIC -std=gnu++17 -MD -MT CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o -MF CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o.d -o CMakeFiles/nekoray.dir/ui/mainwindow.cpp.o -c /home/money/Testing/nekoray/ui/mainwindow.cpp
In file included from /usr/include/ZXing/ReadBarcode.h:10,
                 from /home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp:8,
                 from /home/money/Testing/nekoray/ui/mainwindow.cpp:27:
/usr/include/ZXing/Result.h:73:153: note: ‘#pragma message: Warning: the return type of text() and ecLevel() will change to std::string. Please #define ZX_USE_UTF8 to transition before the next release.’
   73 |         "Warning: the return type of text() and ecLevel() will change to std::string. Please #define ZX_USE_UTF8 to transition before the next release.")
      |                                                                                                                                                         ^
/home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp: In constructor ‘ZXingQt::Result::Result(ZXing::Result&&)’:
/home/money/Testing/nekoray/3rdparty/ZxingQtReader.hpp:118:67: error: cannot convert ‘std::wstring’ {aka ‘std::__cxx11::basic_string<wchar_t>’} to ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
  118 |                 _text = QString::fromStdString(ZXing::Result::text());
      |                                                ~~~~~~~~~~~~~~~~~~~^~
      |                                                                   |
      |                                                                   std::wstring {aka std::__cxx11::basic_string<wchar_t>}
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qhashfunctions.h:44,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:47,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:45,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QVariant:1,
                 from /home/money/Testing/nekoray/build/nekoray_autogen/include/./ui_mainwindow.h:12,
                 from /home/money/Testing/nekoray/ui/mainwindow.cpp:1:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1555:58: note:   initializing argument 1 of ‘static QString QString::fromStdString(const std::string&)’
 1555 | inline QString QString::fromStdString(const std::string &s)
      |                                       ~~~~~~~~~~~~~~~~~~~^
[69/80] Building CXX object CMakeFiles...ray.dir/ui/dialog_basic_settings.cpp.o