Adamcake / Bolt

An alternative launcher for your favourite MMO
GNU Affero General Public License v3.0
162 stars 23 forks source link

Build Error #23

Closed thepure12 closed 7 months ago

thepure12 commented 7 months ago

Here is what I am running, and here is the error I get.

$ cmake --version
cmake version 3.21.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug
$ cmake --build build
/home/user/workspace/Bolt/src/browser/app.cxx: In member function ‘virtual void Browser::App::OnUncaughtException(CefRefPtr<CefBrowser>, CefRefPtr<CefFrame>, CefRefPtr<CefV8Context>, CefRefPtr<CefV8Exception>, CefRefPtr<CefV8StackTrace>)’:
/home/user/workspace/Bolt/src/browser/app.cxx:62:134: error: no matching function for call to ‘std::basic_string_view<char>::basic_string_view(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >)’
   62 |  const std::string_view source_view_trimmed(source_line.begin() + first_non_whitespace, source_line.begin() + last_non_whitespace + 1);
      |                                                                                                                                      ^
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/bits/unique_ptr.h:37,
                 from /usr/include/c++/9/memory:80,
                 from /home/user/workspace/Bolt/cef/dist/include/internal/cef_ptr.h:34,
                 from /home/user/workspace/Bolt/cef/dist/include/cef_base.h:39,
                 from /home/user/workspace/Bolt/cef/dist/include/cef_app.h:41,
                 from /home/user/workspace/Bolt/src/browser/app.hxx:4,
                 from /home/user/workspace/Bolt/src/browser/app.cxx:1:
/usr/include/c++/9/string_view:129:7: note: candidate: ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view(const _CharT*, std::basic_string_view<_CharT, _Traits>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]’
  129 |       basic_string_view(const _CharT* __str, size_type __len) noexcept
      |       ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/string_view:129:39: note:   no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >’ to ‘const char*’
  129 |       basic_string_view(const _CharT* __str, size_type __len) noexcept
      |                         ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/9/string_view:123:7: note: candidate: ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>]’
  123 |       basic_string_view(const _CharT* __str) noexcept
      |       ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/string_view:123:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/9/string_view:120:17: note: candidate: ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’
  120 |       constexpr basic_string_view(const basic_string_view&) noexcept = default;
      |                 ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/string_view:120:17: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/9/string_view:116:7: note: candidate: ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view() [with _CharT = char; _Traits = std::char_traits<char>]’
  116 |       basic_string_view() noexcept
      |       ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/string_view:116:7: note:   candidate expects 0 arguments, 2 provided
/home/user/workspace/Bolt/src/browser/app.cxx:69:30: error: invalid conversion from ‘std::basic_string_view<char>::const_pointer’ {aka ‘const char*’} to ‘std::basic_string_view<char>::size_type’ {aka ‘long unsigned int’} [-fpermissive]
   69 |   source_view_trimmed.data() + (do_trim_end ? exc_end_column + max_dist : source_view_trimmed.size())
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              std::basic_string_view<char>::const_pointer {aka const char*}
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/bits/unique_ptr.h:37,
                 from /usr/include/c++/9/memory:80,
                 from /home/user/workspace/Bolt/cef/dist/include/internal/cef_ptr.h:34,
                 from /home/user/workspace/Bolt/cef/dist/include/cef_base.h:39,
                 from /home/user/workspace/Bolt/cef/dist/include/cef_app.h:41,
                 from /home/user/workspace/Bolt/src/browser/app.hxx:4,
                 from /home/user/workspace/Bolt/src/browser/app.cxx:1:
/usr/include/c++/9/string_view:129:56: note:   initializing argument 2 of ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view(const _CharT*, std::basic_string_view<_CharT, _Traits>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]’
  129 |       basic_string_view(const _CharT* __str, size_type __len) noexcept
      |                                              ~~~~~~~~~~^~~~~
make[2]: *** [CMakeFiles/bolt.dir/build.make:137: CMakeFiles/bolt.dir/src/browser/app.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:188: CMakeFiles/bolt.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Adamcake commented 7 months ago

This would suggest your compiler isn't using C++20 or doesn't support it, even though my cmake setup explicitly requires CXX_STANDARD 20.

https://en.cppreference.com/w/cpp/string/basic_string_view/basic_string_view

It's claiming that number 5 on this list doesn't exist.

What compiler are you using?

Adamcake commented 7 months ago

Also FYI I have never known CMAKE_BUILD_TYPE=Debug to work correctly because it causes CEF to crash on launch, even with the latest official version. Let me know if you get it working though.

thepure12 commented 7 months ago

This is my CMakeCXXCompiler.cmake file.

set(CMAKE_CXX_COMPILER "/usr/bin/c++")
set(CMAKE_CXX_COMPILER_ARG1 "")
set(CMAKE_CXX_COMPILER_ID "GNU")
set(CMAKE_CXX_COMPILER_VERSION "9.4.0")
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
set(CMAKE_CXX_COMPILER_WRAPPER "")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14")
Adamcake commented 7 months ago

Can you post the contents of /home/user/workspace/Bolt/build/CMakeFiles/bolt.dir/flags.make?

thepure12 commented 7 months ago

flags.make

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.21

# compile CXX with /usr/bin/c++
CXX_DEFINES = -DBOLT_FLATHUB_BUILD=0 -DBOLT_LIB_NAME=\"bolt-plugin\"

CXX_INCLUDES = -I/home/user/workspace/Bolt/cef/dist -I/home/user/workspace/Bolt/modules/fmt/include -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include

CXX_FLAGS = -g -std=c++2a
Adamcake commented 7 months ago

Ahh okay. Your compiler is very old (probably GCC 9?) and has only partial c++20 support. You need to install a more recent compiler like GCC 13 by updating your package manager.

Running the command c++ version will tell you your compiler and version, so that you can check you've upgraded correctly.

After updating, you'll need to delete the build directory and run the first command again.

Adamcake commented 7 months ago

Closing as old, let me know if you need anything else