I am trying to setup vcpkg but apparently there is an issue with clang: it detects the correct compiler version > 9 (version 9.1.0.9020039 is > 9), but fails to recognize it as valid: "Apple clang versions 9 and below do not have support for it".
This is the log:
% git clone https://github.com/Microsoft/vcpkg
Cloning into 'vcpkg'...
remote: Counting objects: 39971, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 39971 (delta 19), reused 32 (delta 11), pack-reused 39924
Receiving objects: 100% (39971/39971), 8.52 MiB | 4.07 MiB/s, done.
Resolving deltas: 100% (26162/26162), done.
% cd vcpkg
% ./bootstrap-vcpkg.sh
Downloading cmake...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 25.8M 100 25.8M 0 0 1752k 0 0:00:15 0:00:15 --:--:-- 726k
Downloading cmake... done.
Extracting cmake...
Extracting cmake... done.
Downloading ninja...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 602 0 602 0 0 1036 0 --:--:-- --:--:-- --:--:-- 1036
100 77284 100 77284 0 0 52008 0 0:00:01 0:00:01 --:--:-- 352k
Downloading ninja... done.
Extracting ninja...
Extracting ninja... done.
/Users/sensei/Documents/Projects/libraries/vcpkg/scripts/bootstrap.sh: line 171: [: Configured with: --prefix=/Applications/Xcode: integer expression expected
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (message):
Building the vcpkg tool requires support for the C++ Filesystem TS.
Apple clang versions 9 and below do not have support for it.
Please install gcc6 or newer from homebrew (brew install gcc6).
If you would like to try anyway, set VCPKG_ALLOW_APPLE_CLANG.
-- Configuring incomplete, errors occurred!
See also "/Users/sensei/Documents/Projects/libraries/vcpkg/toolsrc/build.rel/CMakeFiles/CMakeOutput.log".
ninja: error: loading 'build.ninja': No such file or directory
cp: /Users/sensei/Documents/Projects/libraries/vcpkg/toolsrc/build.rel/vcpkg: No such file or directory
Any possible fix to this issue?
@fmilicchio Fix this is simple: brew install gcc, and then run bootstrap script
Let the bootstrap script use the gcc compiler to build.
I've been using vcpkg with clang on macOS for a while and now I can't.
It used to work fine! I was very satisfied with this tool and I even adopted this solution for my projects.
Everything was fine until you decided to limit vcpkg to work with gcc only, my question is why?
Maybe I don't want to be limited to gcc toolchain and use clang. I really don't understand...
@xcodeassociated There's no such limitation of only gcc, It's just that you have to use gcc to compile the vcpkg source code to get a vcpkg binary in macOS. After that, you're free to install packages with clang. It's just the bootstrap process that have to use gcc, since vcpkg source is not portable in clang.
@ryancheung Interesting. Do you happen to know what functionalities vcpkg does need from the <filesystem>? I would very much like to avoid installing another compiler, as I use also Intel's icpc and it also does not support the TS.
@fmilicchio Is the problem solved?How
@baby2nana @fmilicchio @ryancheung
Seems like oclint was the problem. I uninstalled oclint like this. Referenced https://github.com/travis-ci/docs-travis-ci-com/issues/1283
brew update > /dev/null 2>&1;
brew cask uninstall oclint; # <---
brew install gcc;
gcc-8 --version;
But I encountered another issue with #include <_stdio.h>... :(
$ ./bootstrap-vcpkg.sh;
Downloading cmake...
Downloading cmake... done.
Extracting cmake...
Extracting cmake... done.
Downloading ninja...
Downloading ninja... done.
Extracting ninja...
Extracting ninja... done.
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/gcc-8
-- Check for working CXX compiler: /usr/local/bin/gcc-8 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/travis/build/AlcheraInc/AlImage/vcpkg/toolsrc/build.rel
[0/63] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o[K
[0/63] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/archives.cpp.o[K
[0/63] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/base/checks.cpp.o[K
[1/63] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o[K
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o
/usr/local/bin/gcc-8 -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o -c ../src/vcpkg.cpp
In file included from /usr/include/wchar.h:90,
from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/cwchar:44,
from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/bits/postypes.h:40,
from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/bits/char_traits.h:40,
from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/string:40,
from ../include/vcpkg/base/chrono.h:4,
from ../src/vcpkg.cpp:13:
/usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
#include <_stdio.h>
^~~~~~~~~~
compilation terminated.
Duplicate with https://github.com/Microsoft/vcpkg/issues/4475 ?
@fmilicchio Did you resolved problem after merged #5915 ?
@soroshsabz No, I've moved to Mojave in the meantime, but a clean clone/bootstrap fails, as Apple's clang does not provide yet the <filesystem> headers:
% ./bootstrap-vcpkg.sh --help
Usage: ./bootstrap-vcpkg.sh [options]
Options:
-help Display usage help
-disableMetrics Do not build metrics reporting into the executable
-useSystemBinaries Force use of the system utilities for building vcpkg
-allowAppleClang Set VCPKG_ALLOW_APPLE_CLANG to build vcpkg in apple with clang anyway
% ./bootstrap-vcpkg.sh -allowAppleClang
Downloading cmake...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 621 0 621 0 0 1904 0 --:--:-- --:--:-- --:--:-- 1910
100 31.9M 100 31.9M 0 0 7135k 0 0:00:04 0:00:04 --:--:-- 8530k
Downloading cmake... done.
Extracting cmake...
Extracting cmake... done.
Downloading ninja...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 602 0 602 0 0 1967 0 --:--:-- --:--:-- --:--:-- 1960
100 77284 100 77284 0 0 65550 0 0:00:01 0:00:01 --:--:-- 65550
Downloading ninja... done.
Extracting ninja...
Extracting ninja... done.
/Users/sensei/Downloads/vcpkg/scripts/bootstrap.sh: line 208: [: Configured with: --prefix=/Applications/Xcode: integer expression expected
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test USES_LIBSTDCXX
-- Performing Test USES_LIBSTDCXX - Failed
-- Performing Test USES_LIBCXX
-- Performing Test USES_LIBCXX - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sensei/Downloads/vcpkg/toolsrc/build.rel
[1/64] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o -c ../src/vcpkg.cpp
In file included from ../src/vcpkg.cpp:24:
../include/vcpkg/base/files.h:8:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[2/64] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/base/cofffilereader.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg/base/cofffilereader.cpp.o
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg/base/cofffilereader.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg/base/cofffilereader.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg/base/cofffilereader.cpp.o -c ../src/vcpkg/base/cofffilereader.cpp
In file included from ../src/vcpkg/base/cofffilereader.cpp:1:
../include/pch.h:43:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[3/64] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/base/checks.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg/base/checks.cpp.o
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg/base/checks.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg/base/checks.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg/base/checks.cpp.o -c ../src/vcpkg/base/checks.cpp
In file included from ../src/vcpkg/base/checks.cpp:1:
../include/pch.h:43:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[4/64] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o -c ../src/vcpkg/base/downloads.cpp
In file included from ../src/vcpkg/base/downloads.cpp:1:
../include/pch.h:43:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[5/64] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/base/chrono.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg/base/chrono.cpp.o
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg/base/chrono.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg/base/chrono.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg/base/chrono.cpp.o -c ../src/vcpkg/base/chrono.cpp
In file included from ../src/vcpkg/base/chrono.cpp:1:
../include/pch.h:43:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[6/64] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg/archives.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg/archives.cpp.o
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DDISABLE_METRICS=0 -I../include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg/archives.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg/archives.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg/archives.cpp.o -c ../src/vcpkg/archives.cpp
In file included from ../src/vcpkg/archives.cpp:1:
../include/pch.h:43:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
@fmilicchio your problem have a solution that describe in https://github.com/Microsoft/vcpkg/issues/6068#issuecomment-482707688
@luncliff I have exactly the same problem as you. On travis, on macOS, I am always stuck with
In file included from /usr/include/wchar.h:90:0,
from /usr/local/Cellar/gcc@7/7.4.0_2/include/c++/7.4.0/cwchar:44,
from /usr/local/Cellar/gcc@7/7.4.0_2/include/c++/7.4.0/bits/postypes.h:40,
from /usr/local/Cellar/gcc@7/7.4.0_2/include/c++/7.4.0/bits/char_traits.h:40,
from /usr/local/Cellar/gcc@7/7.4.0_2/include/c++/7.4.0/string:40,
from ../include/vcpkg/base/cstringview.h:4,
from ../include/vcpkg/base/chrono.h:3,
from ../src/vcpkg.cpp:23:
/usr/local/Cellar/gcc@7/7.4.0_2/lib/gcc/7/gcc/x86_64-apple-darwin17.7.0/7.4.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
#include <_stdio.h>
^~~~~~~~~~
compilation terminated.
I tried with gcc@8 and gcc@7, without any luck. Did you manage to solve your problem? if yes, how??
edit: forgot to mention that locally on my mac I cannot reproduce any problem and vcpkg works fine!
fixed changing base image.
Now using osx_image: xcode10.1and vcpkg builds fine
@cenit I couldn't solve the issue at the moment, so I've moved to Azure Pipelines and maintaining my own fork. Sounds good that it's fixed. I'm gonna try that.
@luncliff I want to try Azure Pipelines, but for now I have to deal with the classic travis & appveyor config.
Yes just changing base image fixed, apparently it's a known issue that Homebrew's gcc does not work on travis on default image (Xcode 9.4) due to some missing command line tools (impossible to fix because Apple does not distribute them anymore for that version). Luckily, newer images look fixed :)
We don't support compiling the vcpkg binary with apple-clang, though that may change in the future.
sudo ./bootstrap-vcpkg.sh --allowAppleClang
but, i get this error: ld: library not found for -lc++fs
Most helpful comment
fixed changing base image.
Now using
osx_image: xcode10.1andvcpkgbuilds fine