SemaiCZE / inicpp

C++ parser of INI files with schema validation.
MIT License
63 stars 13 forks source link

Fails to build on linux #22

Closed ctag closed 1 year ago

ctag commented 1 year ago

Hi,

When building on linux, the process fails with an error message that does not appear to have many hits on a search.

[berocs@bns-kharselim git]$ git clone https://github.com/SemaiCZE/inicpp
Cloning into 'inicpp'...
remote: Enumerating objects: 1940, done.
remote: Counting objects: 100% (194/194), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 1940 (delta 91), reused 160 (delta 88), pack-reused 1746
Receiving objects: 100% (1940/1940), 773.53 KiB | 5.90 MiB/s, done.
Resolving deltas: 100% (1362/1362), done.
[berocs@bns-kharselim git]$ cd inicpp/
[berocs@bns-kharselim inicpp]$ ls
CMakeLists.txt  examples  inicpp.pc.in  README.md  src    vendor
Doxyfile        include   LICENSE       rpm        tests
[berocs@bns-kharselim inicpp]$ mkdir build
[berocs@bns-kharselim inicpp]$ cd build/
[berocs@bns-kharselim build]$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- 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
-- 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
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/berocs/git/inicpp/build
[berocs@bns-kharselim build]$ make
[ 11%] Building CXX object CMakeFiles/inicpp.dir/src/config.cpp.o
[ 22%] Building CXX object CMakeFiles/inicpp.dir/src/option.cpp.o
[ 33%] Building CXX object CMakeFiles/inicpp.dir/src/option_schema.cpp.o
[ 44%] Building CXX object CMakeFiles/inicpp.dir/src/parser.cpp.o
[ 55%] Building CXX object CMakeFiles/inicpp.dir/src/schema.cpp.o
[ 66%] Building CXX object CMakeFiles/inicpp.dir/src/section.cpp.o
[ 77%] Building CXX object CMakeFiles/inicpp.dir/src/section_schema.cpp.o
[ 88%] Building CXX object CMakeFiles/inicpp.dir/src/string_utils.cpp.o
In file included from /home/berocs/git/inicpp/include/inicpp/string_utils.h:6,
                 from /home/berocs/git/inicpp/src/string_utils.cpp:1:
/home/berocs/git/inicpp/include/inicpp/types.h:46:57: warning: unnecessary parentheses in declaration of ‘uint64_t’ [-Wparentheses]
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                                                         ^~~~~~~~~~
/home/berocs/git/inicpp/include/inicpp/types.h:46:57: note: remove parentheses
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                                                         ^~~~~~~~~~
      |                                                         -        -
/home/berocs/git/inicpp/include/inicpp/types.h:46:30: error: only declarations of constructors and conversion operators can be ‘explicit’
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                              ^~~~~~~~
/home/berocs/git/inicpp/include/inicpp/types.h:46:58: error: field ‘uint64_t’ has incomplete type ‘inicpp::internal_enum_type’
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                                                          ^~~~~~~~
/home/berocs/git/inicpp/include/inicpp/types.h:15:15: note: definition of ‘class inicpp::internal_enum_type’ is not complete until the closing brace
   15 |         class internal_enum_type
      |               ^~~~~~~~~~~~~~~~~~
/home/berocs/git/inicpp/include/inicpp/types.h:101:32: error: ‘uint64_t’ does not name a type
  101 |         using unsigned_ini_t = uint64_t;
      |                                ^~~~~~~~
/home/berocs/git/inicpp/include/inicpp/types.h:8:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
    7 | #include <variant>
  +++ |+#include <cstdint>
    8 | 
/home/berocs/git/inicpp/include/inicpp/types.h:107:59: error: ‘unsigned_ini_t’ was not declared in this scope; did you mean ‘signed_ini_t’?
  107 |                 std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>;
      |                                                           ^~~~~~~~~~~~~~
      |                                                           signed_ini_t
/home/berocs/git/inicpp/include/inicpp/types.h:107:112: error: template argument 3 is invalid
  107 | n_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>;
      |                                                                             ^

/home/berocs/git/inicpp/include/inicpp/string_utils.h:125:40: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’?
  125 |                 template <> INICPP_API unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name);
      |                                        ^~~~~~~~~~~~~~
      |                                        signed_ini_t
/home/berocs/git/inicpp/src/string_utils.cpp:124:17: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’?
  124 |                 unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name)
      |                 ^~~~~~~~~~~~~~
      |                 signed_ini_t
make[2]: *** [CMakeFiles/inicpp.dir/build.make:174: CMakeFiles/inicpp.dir/src/string_utils.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/inicpp.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
ctag commented 1 year ago

Builds when I add #include <stdint.h> to the types.h file.

[berocs@bns-kharselim inicpp]$ head -n 10 include/inicpp/types.h 
#ifndef INICPP_TYPES_H
#define INICPP_TYPES_H

#include <stdexcept>
#include <string>
#include <type_traits>
#include <variant>
#include <stdint.h>
[berocs@bns-kharselim build]$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/berocs/git/inicpp/build
[berocs@bns-kharselim build]$ make
[ 11%] Building CXX object CMakeFiles/inicpp.dir/src/config.cpp.o
[ 22%] Building CXX object CMakeFiles/inicpp.dir/src/option.cpp.o
[ 33%] Building CXX object CMakeFiles/inicpp.dir/src/option_schema.cpp.o
[ 44%] Building CXX object CMakeFiles/inicpp.dir/src/parser.cpp.o
[ 55%] Building CXX object CMakeFiles/inicpp.dir/src/schema.cpp.o
[ 66%] Building CXX object CMakeFiles/inicpp.dir/src/section.cpp.o
[ 77%] Building CXX object CMakeFiles/inicpp.dir/src/section_schema.cpp.o
[ 88%] Building CXX object CMakeFiles/inicpp.dir/src/string_utils.cpp.o
[100%] Linking CXX static library libinicpp.a
[100%] Built target inicpp

Reference: https://github.com/AirenSoft/OvenMediaEngine/issues/1271

SemaiCZE commented 1 year ago

Thanks, fixed