Unable to compile vcpkg in linux (archlinux) using provided instructions
Describe the bug Unable to compile vcpkg in linux (archlinux) using provided instructions
Environment
- OS: Linux shark 5.9.8-arch1-1 #1 SMP PREEMPT Tue, 10 Nov 2020 22:44:11 +0000 x86_64 GNU/Linux
- Compiler:
-- The CXX compiler identification is GNU 6.5.0
gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To Reproduce Steps to reproduce the behavior:
- Checkout source code
- ./vcpkg/bootstrap-vcpkg.sh
Expected behavior functional vcpkg binary
Failure logs
$ ./vcpkg/bootstrap-vcpkg.sh
-- The CXX compiler identification is GNU 6.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-6 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting the C++ compiler in use
-- Detecting the C++ compiler in use - gcc
-- Detecting the C++ standard library
-- Detecting the C++ standard library - libstdc++
-- Detecting how to use the C++ filesystem library
-- Detecting how to use the C++ filesystem library - <experimental/filesystem> with -lstdc++fs
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tomasz/dev/vcpkg/toolsrc/build.rel
[0/2] Re-checking globbed directories...
[72/83] Building CXX object CMakeFiles/vcpkglib.dir/src/vcpkg/vcpkgcmdarguments.cpp.o
FAILED: CMakeFiles/vcpkglib.dir/src/vcpkg/vcpkgcmdarguments.cpp.o
/usr/bin/g++-6 -DVCPKG_USE_STD_FILESYSTEM=0 -I../include -O3 -DNDEBUG -include /home/tomasz/dev/vcpkg/toolsrc/include/pch.h -pthread -std=c++1z -MD -MT CMakeFiles/vcpkglib.dir/src/vcpkg/vcpkgcmdarguments.cpp.o -MF CMakeFiles/vcpkglib.dir/src/vcpkg/vcpkgcmdarguments.cpp.o.d -o CMakeFiles/vcpkglib.dir/src/vcpkg/vcpkgcmdarguments.cpp.o -c ../src/vcpkg/vcpkgcmdarguments.cpp
../src/vcpkg/vcpkgcmdarguments.cpp:925:48: error: redefinition of 'constexpr const vcpkg::StringLiteral vcpkg::VcpkgCmdArguments::OVERLAY_TRIPLETS_ENV'
constexpr StringLiteral VcpkgCmdArguments::OVERLAY_TRIPLETS_ENV;
^~~~~~~~~~~~~~~~~~~~
In file included from ../src/vcpkg/vcpkgcmdarguments.cpp:9:0:
../include/vcpkg/vcpkgcmdarguments.h:145:40: note: 'constexpr const vcpkg::StringLiteral vcpkg::VcpkgCmdArguments::OVERLAY_TRIPLETS_ENV' previously defined here
constexpr static StringLiteral OVERLAY_TRIPLETS_ENV = "VCPKG_OVERLAY_TRIPLETS";
^~~~~~~~~~~~~~~~~~~~
[81/83] Building CXX object CMakeFiles/vcpkglib.dir/src/vcpkg/vcpkglib.cpp.o
ninja: build stopped: subcommand failed.
Additional context Add any other context about the problem here.
Could you run g++ --version? It may be different from gcc --version.
Could you run
g++ --version? It may be different fromgcc --version.
g++ --version
g++ (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
How do you install g++-6?
I'm using the official archlinux package manager.
https://wiki.archlinux.org/index.php/GNU_Compiler_Collection
So the command is
pacman -S gcc
I also encountered this problem on mac 10.14
@NancyLi1013 fix it on #14744 , OVERLAY_TRIPLETS_ENV is defined twice in vcpkgcmdarguments.cpp:923 and vcpkgcmdarguments.cpp:925
Hi @akayami and @davidxiaozhi
Thanks for posting this issue.
Could you please try to rebuild this after removing constexpr StringLiteral VcpkgCmdArguments::OVERLAY_TRIPLETS_ENV in vcpkgcmdarguments.cpp:925?
Problem fixed. Thanks for quick and efficient support !
Thanks for your update @akayami. I'm reopening this issue until this issue is fixed via PR #14744 merged.
Closing since it has been fixed now.