Skip to content

[vcpkg] Warning (as error) when building vcpgk/toolsrc with clang++ 10 or g++ 9.3 #15148

@klalumiere

Description

@klalumiere

Describe the bug
There are 3 warnings that prevent the compilation since -Werror is enabled. I'll paste the log below.

Environment

  • OS: Ubuntu 20.04
  • Compiler: I tried both clang version 10.0.0-4ubuntu1 and g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

To Reproduce

  1. cd toolsrc
  2. mkdir debug
  3. cd debug
  4. cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja ..
  5. cmake --build .

Expected behavior
I expected the compilation to succeed.

Failure logs

First warning:

[13/114] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/dependencies.cpp.o
FAILED: CMakeFiles/vcpkg-test.dir/src/vcpkg-test/dependencies.cpp.o 
/usr/bin/g++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -g   -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-redundant-move -Wmissing-declarations -Werror -std=c++17 -MD -MT CMakeFiles/vcpkg-test.dir/src/vcpkg-test/dependencies.cpp.o -MF CMakeFiles/vcpkg-test.dir/src/vcpkg-test/dependencies.cpp.o.d -o CMakeFiles/vcpkg-test.dir/src/vcpkg-test/dependencies.cpp.o -c ../src/vcpkg-test/dependencies.cpp
../src/vcpkg-test/dependencies.cpp:606:96: error: integer constant is so large that it is unsigned [-Werror]
  606 |     check_relaxed_version(version_long, {1, 20, 300, 4000, 50000, 6000000, 70000000, 80000000, 18446744073709551610});
      |                                                                                                ^~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Second warning:

[80/102] Building CXX object CMakeFiles/vcpkglib.dir/src/vcpkg/portfileprovider.cpp.o
FAILED: CMakeFiles/vcpkglib.dir/src/vcpkg/portfileprovider.cpp.o 
/usr/bin/clang++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -g   -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-redundant-move -Wmissing-prototypes -Werror -include /home/klalumiere/Projects/vcpkg-klalumiere/toolsrc/include/pch.h -pthread -std=c++17 -MD -MT CMakeFiles/vcpkglib.dir/src/vcpkg/portfileprovider.cpp.o -MF CMakeFiles/vcpkglib.dir/src/vcpkg/portfileprovider.cpp.o.d -o CMakeFiles/vcpkglib.dir/src/vcpkg/portfileprovider.cpp.o -c ../src/vcpkg/portfileprovider.cpp
In file included from <built-in>:1:
In file included from /home/klalumiere/Projects/vcpkg-klalumiere/toolsrc/include/pch.h:5:
In file included from ../include/vcpkg/base/files.h:14:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/filesystem:37:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/fs_path.h:37:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/locale:43:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/locale_conv.h:41:
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:81:2: error: delete called on non-final 'vcpkg::PortFileProvider::PathsPortFileProvider' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
        delete __ptr;
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:292:4: note: in instantiation of member function 'std::default_delete<vcpkg::PortFileProvider::PathsPortFileProvider>::operator()' requested here
          get_deleter()(std::move(__ptr));
          ^
../src/vcpkg/portfileprovider.cpp:299:13: note: in instantiation of member function 'std::unique_ptr<vcpkg::PortFileProvider::PathsPortFileProvider, std::default_delete<vcpkg::PortFileProvider::PathsPortFileProvider> >::~unique_ptr' requested here
            BaselineProviderImpl(const VcpkgPaths& paths) : paths(paths) { }
            ^
1 error generated.

Third warning :

[3/9] Building CXX object CMakeFiles/vcpkglib.dir/src/vcpkg/versiondeserializers.cpp.o
FAILED: CMakeFiles/vcpkglib.dir/src/vcpkg/versiondeserializers.cpp.o 
/usr/bin/clang++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -g   -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-redundant-move -Wmissing-prototypes -Werror -include /home/klalumiere/Projects/vcpkg-klalumiere/toolsrc/include/pch.h -pthread -std=c++17 -MD -MT CMakeFiles/vcpkglib.dir/src/vcpkg/versiondeserializers.cpp.o -MF CMakeFiles/vcpkglib.dir/src/vcpkg/versiondeserializers.cpp.o.d -o CMakeFiles/vcpkglib.dir/src/vcpkg/versiondeserializers.cpp.o -c ../src/vcpkg/versiondeserializers.cpp
../src/vcpkg/versiondeserializers.cpp:15:29: error: unused variable 'GIT_TREE' [-Werror,-Wunused-const-variable]
    constexpr StringLiteral GIT_TREE = "git-tree";
                            ^
1 error generated.

Additional context
I fixed the issues and I'll make a PR in a few seconds.

Metadata

Metadata

Assignees

Labels

category:vcpkg-bugThe issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions