vcpkg icon indicating copy to clipboard operation
vcpkg copied to clipboard

Apple clang versions 9 and below do not have support for it.

Open lauer3912 opened this issue 8 years ago • 12 comments

Apple clang versions 9 and below do not have support for it.

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/ian/GitHub/vcpkg/toolsrc/build.rel/CMakeFiles/CMakeOutput.log". ninja: error: loading 'build.ninja': No such file or directory cp: /Users/ian/GitHub/vcpkg/toolsrc/build.rel/vcpkg: No such file or directory

lauer3912 avatar Oct 15 '18 06:10 lauer3912

Hi @lauer3912,

You need to install XCode 10 or a recent clang LLVM in order to build vcpkg on OSX. Or are you requesting for it to support older versions of clang?

Cheers

Marco

mcraveiro avatar Oct 15 '18 13:10 mcraveiro

@mcraveiro

I had installed XCode 10, But problems still exist.

lauer3912 avatar Oct 16 '18 00:10 lauer3912

I think your environment is not picking up XCode 10. Try to figure out the location of clang, it must be picking some other compiler somehow.

mcraveiro avatar Oct 16 '18 10:10 mcraveiro

@mcraveiro

ians-MacBook-Pro:~ ian$ clang -v Apple LLVM version 10.0.0 (clang-1000.11.45.2) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ians-MacBook-Pro:~ ian$ which clang /usr/bin/clang ians-MacBook-Pro:~ ian$ /usr/bin/clang -v Apple LLVM version 10.0.0 (clang-1000.11.45.2) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ians-MacBook-Pro:~ ian$

lauer3912 avatar Oct 17 '18 01:10 lauer3912

Ah, most interesting! Well, before we proceed, may I just warn you that @ras0219-msft told me that the recommended way to build vcpkg itself on OSX is using homebrew's GCC rather than Clang [1] (XCode or otherwise):

Generally, we just recommend users to install a gcc-6 from homebrew to build the vcpkg tool (note that the libraries will still be built with $CXX by default, which is AppleClang). [...]

If you do want to use Clang, once you go past this problem you will likely hit a linking problem, as documented on that ticket.

With all of that said, I am very intrigued now :-) can you send us the complete CMake "configure" from boostrap.sh please?

[1] https://github.com/Microsoft/vcpkg/issues/4476#issuecomment-430231267 [2] https://github.com/Microsoft/vcpkg/issues/4476#issue-370181121

mcraveiro avatar Oct 17 '18 05:10 mcraveiro

@mcraveiro Thanks, again.

Uploading CMakeOutput.log… Uploading CMakeLists.txt… Uploading CMakeCache.txt…

lauer3912 avatar Oct 18 '18 00:10 lauer3912

Sorry @lauer3912 I think something went wrong with your upload - when I click on the links it takes me back to this ticket for some reason...

mcraveiro avatar Oct 18 '18 08:10 mcraveiro

OK I think I get it, finally! :-) I think the error message is not entirely enlightening; it seems to imply its checking the version of Clang. However, if you look at the actual code, it says:

elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
    if(NOT VCPKG_ALLOW_APPLE_CLANG)
        message(FATAL_ERROR
"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.")
    else()
        set(CLANG 1)
    endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
    set(CLANG 1)

Basically, by default it blocks you regardless of which version of Apple Clang you are using; if you have version 9 and higher and you really want to use it - instead of the recommended Homebrew GCC - then you need to set VCPKG_ALLOW_APPLE_CLANG. I presume its a define job, e.g. -DVCPKG_ALLOW_APPLE_CLANG.

This also explains why I managed to get my vcpkg compiled using LLVM's Clang without setting VCPKG_ALLOW_APPLE_CLANG (see the Clang else which is the path taken by LLVM Clang).

May I just say I strongly suggest you use Homebrew GCC as I suspect you will hit the filesystem TS problem next :-D

mcraveiro avatar Oct 21 '18 06:10 mcraveiro

@mcraveiro Thanks.

lauer3912 avatar Oct 26 '18 13:10 lauer3912

So sounds like vcpkg doesn't support clang well on macOS? cc @mcraveiro @lauer3912

liangqi avatar Jan 14 '19 15:01 liangqi

OK, found some related info whether clang on macOS support C++17: the File System TS.

https://libcxx.llvm.org/cxx1z_status.html https://en.wikipedia.org/wiki/Xcode#Latest_versions

Latest Xcode 10.1, Apple LLVM version 10.0.0 (clang-1000.11.45.5) is LLVM 6.0.1 and clang 10.0.0, so I was hit by the filesystem TS?

liangqi avatar Jan 14 '19 15:01 liangqi