Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No libc++ Support On Windows 11 #105

Closed
SmushyTaco opened this issue Mar 23, 2024 · 1 comment
Closed

No libc++ Support On Windows 11 #105

SmushyTaco opened this issue Mar 23, 2024 · 1 comment

Comments

@SmushyTaco
Copy link

This code:

#include <print>
#include <scn/scan.h>
using namespace std;
using namespace scn;
int main() {
    if (auto result {prompt<int>("Enter your favorite number: ", "{}")}) {
        println("Your favorite number is \"{}\"!", result->value());
    } else {
        println(stderr, "Error: {}", result.error().msg());
    }
}

With this CMake file:

cmake_minimum_required(VERSION 3.29)
include(FetchContent)
project(untitled1)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU")
    add_link_options(-fuse-ld=lld)
    add_compile_options(-stdlib=libc++)
endif()
if(MSVC)
    add_compile_options(/Wall)
else()
    add_compile_options(-Wall -Wextra -Wpedantic)
endif()
FetchContent_Declare(
        scn
        GIT_REPOSITORY  https://github.com/eliaskosunen/scnlib
        GIT_TAG         v2.0.2
        GIT_SHALLOW     TRUE
)
FetchContent_MakeAvailable(scn)
add_executable(untitled1 main.cpp)
target_link_libraries(untitled1 PRIVATE scn::scn)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU")
    target_link_libraries(untitled1 PRIVATE c++)
endif()

Using Clang 18 and libc++ from MSYS2 as my default toolchain as seen here:

default toolchain

Fails to build with this as the console output:

====================[ Build | untitled1 | Debug ]===============================
C:\msys64\ucrt64\bin\cmake.exe --build C:\Users\organ\CLionProjects\untitled1\cmake-build-debug --target untitled1 -j 30
[1/16] Scanning C:/Users/organ/CLionProjects/untitled1/main.cpp for CXX dependencies
FAILED: CMakeFiles/untitled1.dir/main.cpp.obj.ddi 
C:\Windows\system32\cmd.exe /C ""C:/msys64/ucrt64/bin/clang-scan-deps.exe" -format=p1689 -- C:\msys64\ucrt64\bin\clang++.exe  -IC:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include -g -std=c++23 -fansi-escape-codes -fcolor-diagnostics -stdlib=libc++ -Wall -Wextra -Wpedantic -DSCN_REGEX_BACKEND=0 -x c++ C:/Users/organ/CLionProjects/untitled1/main.cpp -c -o CMakeFiles\untitled1.dir\main.cpp.obj -resource-dir "C:/msys64/ucrt64/lib/clang/18" -MT CMakeFiles\untitled1.dir\main.cpp.obj.ddi -MD -MF CMakeFiles\untitled1.dir\main.cpp.obj.ddi.d > CMakeFiles\untitled1.dir\main.cpp.obj.ddi.tmp && "C:/msys64/ucrt64/bin/cmake.exe" -E rename CMakeFiles\untitled1.dir\main.cpp.obj.ddi.tmp CMakeFiles\untitled1.dir\main.cpp.obj.ddi"
Error while scanning dependencies for C:/Users/organ/CLionProjects/untitled1/main.cpp:
In file included from C:/Users/organ/CLionProjects/untitled1/main.cpp:2:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/args.h:26:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/error.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/fwd.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/config.h:20:
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:97:5: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:65:5: note: expanded from macro 'SCN_CLANG'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:252:16: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:254:7: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:65:5: note: expanded from macro 'SCN_CLANG'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:256:19: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:258:20: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:283:17: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:310:16: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:374:19: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:640:22: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:119:5: note: expanded from macro 'SCN_GCC_COMPAT'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
In file included from C:/Users/organ/CLionProjects/untitled1/main.cpp:2:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/args.h:26:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/error.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/fwd.h:20:
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp.h:41:5: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:65:5: note: expanded from macro 'SCN_CLANG'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
In file included from C:/Users/organ/CLionProjects/untitled1/main.cpp:2:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/args.h:26:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/error.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/fwd.h:20:
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp.h:77:5: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:119:5: note: expanded from macro 'SCN_GCC_COMPAT'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
In file included from C:/Users/organ/CLionProjects/untitled1/main.cpp:2:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/args.h:26:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/error.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/fwd.h:20:
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp.h:214:5: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:65:5: note: expanded from macro 'SCN_CLANG'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
In file included from C:/Users/organ/CLionProjects/untitled1/main.cpp:2:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/scan.h:20:
In file included from C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/scan.h:21:
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/format_string.h:636:5: error: token is not a valid binary operator in a preprocessor subexpression
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:65:5: note: expanded from macro 'SCN_CLANG'
C:/Users/organ/CLionProjects/untitled1/cmake-build-debug/_deps/scn-src/include/scn/detail/pp_detect.h:54:16: note: expanded from macro 'SCN_COMPILER'
...

If I switch over to GCC (and switch the println statements to cout since GCC doesn't have println support yet), everything works properly because it'll default over to libstdc++, so the issue at hand is using libc++ on Windows 11 with this project.

@eliaskosunen
Copy link
Owner

Couldn't repro this on latest master. The error looks similar to #110, which has been fixed in master since 7da4041.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants