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

[bug] Different behavior with cppstd=20 and compiler.cppstd=20 #12531

Closed
Inujel opened this issue Nov 14, 2022 · 3 comments
Closed

[bug] Different behavior with cppstd=20 and compiler.cppstd=20 #12531

Inujel opened this issue Nov 14, 2022 · 3 comments
Assignees

Comments

@Inujel
Copy link

Inujel commented Nov 14, 2022

On Visual Studio 2022, with C++20, compilation of fruit/3.6.0 fails with compiler.cppstd=20 and succeeds with cppstd=20.
Conan recommends to use compiler.cppstd=20.

What's the difference between the two?

Environment Details (include every applicable attribute)

  • Operating System+version: Windows 10
  • Compiler+version: Visual Studio 2022 (17.3.1)
  • Conan version: 1.53.0
  • Python version: 3.9.6

Steps to reproduce (Include if Applicable)

profile file:

[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.runtime=MDd
compiler.version=17
compiler.cppstd=20
os=Windows
os_build=Windows
[options]
fruit:use_boost=False

Then

conan install fruit/3.6.0@ -pr ./profile -b missing

Logs (Executed commands with output) (Include/Attach if Applicable)

The command fails with

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.cppstd=20
compiler.runtime=MDd
compiler.version=17
os=Windows
os_build=Windows
[options]
fruit:use_boost=False
[build_requires]
[env]

Installing package: fruit/3.6.0
Requirements
    fruit/3.6.0 from local cache - Cache
Packages
    fruit/3.6.0:255fef913b09852b9ac19f13fe91677114965382 - Build

Installing (downloading, building) binaries...
fruit/3.6.0: WARN: Build folder is dirty, removing it: C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382
fruit/3.6.0: Copying sources to build folder
fruit/3.6.0: Building your package in C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382
fruit/3.6.0: Generator cmake created conanbuildinfo.cmake
fruit/3.6.0: Aggregating env generators
fruit/3.6.0: Calling build()
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.33.31630.0
-- The CXX compiler identification is MSVC 19.33.31630.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan setting CPP STANDARD: 20 WITH EXTENSIONS OFF
-- Performing Test FRUIT_TRIVIAL_SOURCE_COMPILES
-- Performing Test FRUIT_TRIVIAL_SOURCE_COMPILES - Success
-- Performing Test FRUIT_HAS_CLANG_ARBITRARY_OVERLOAD_RESOLUTION_BUG
-- Performing Test FRUIT_HAS_CLANG_ARBITRARY_OVERLOAD_RESOLUTION_BUG - Success
-- Performing Test FRUIT_HAS_HAS_TRIVIAL_COPY
-- Performing Test FRUIT_HAS_HAS_TRIVIAL_COPY - Success
-- Performing Test FRUIT_HAS_IS_TRIVIALLY_COPYABLE
-- Performing Test FRUIT_HAS_IS_TRIVIALLY_COPYABLE - Success
-- Performing Test FRUIT_HAS_MAX_ALIGN_T
-- Performing Test FRUIT_HAS_MAX_ALIGN_T - Success
-- Performing Test FRUIT_HAS_STD_IS_TRIVIALLY_COPYABLE
-- Performing Test FRUIT_HAS_STD_IS_TRIVIALLY_COPYABLE - Success
-- Performing Test FRUIT_HAS_STD_IS_TRIVIALLY_COPY_CONSTRUCTIBLE
-- Performing Test FRUIT_HAS_STD_IS_TRIVIALLY_COPY_CONSTRUCTIBLE - Success
-- Performing Test FRUIT_HAS_STD_MAX_ALIGN_T
-- Performing Test FRUIT_HAS_STD_MAX_ALIGN_T - Success
-- Performing Test FRUIT_HAS_TYPEID
-- Performing Test FRUIT_HAS_TYPEID - Success
-- Performing Test FRUIT_HAS_CONSTEXPR_TYPEID
-- Performing Test FRUIT_HAS_CONSTEXPR_TYPEID - Success
-- Performing Test FRUIT_HAS_CXA_DEMANGLE
-- Performing Test FRUIT_HAS_CXA_DEMANGLE - Failed
-- Performing Test FRUIT_HAS_ALWAYS_INLINE_ATTRIBUTE
-- Performing Test FRUIT_HAS_ALWAYS_INLINE_ATTRIBUTE - Failed
-- Performing Test FRUIT_HAS_FORCEINLINE
-- Performing Test FRUIT_HAS_FORCEINLINE - Success
-- Performing Test FRUIT_HAS_ATTRIBUTE_DEPRECATED
-- Performing Test FRUIT_HAS_ATTRIBUTE_DEPRECATED - Success
-- Performing Test FRUIT_HAS_GCC_ATTRIBUTE_DEPRECATED
-- Performing Test FRUIT_HAS_GCC_ATTRIBUTE_DEPRECATED - Failed
-- Performing Test FRUIT_HAS_DECLSPEC_DEPRECATED
-- Performing Test FRUIT_HAS_DECLSPEC_DEPRECATED - Success
-- Performing Test FRUIT_HAS_MSVC_ASSUME
-- Performing Test FRUIT_HAS_MSVC_ASSUME - Success
-- Performing Test FRUIT_HAS_BUILTIN_UNREACHABLE
-- Performing Test FRUIT_HAS_BUILTIN_UNREACHABLE - Failed
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY


-- Build files have been written to: C:/Users/jj/.conan/data/fruit/3.6.0/_/_/build/255fef913b09852b9ac19f13fe91677114965382/build_subfolder
MSBuild version 17.3.1+2badb37d1 for .NET Framework
  Checking Build System
  Building Custom Rule C:/Users/jj/.conan/data/fruit/3.6.0/_/_/build/255fef913b09852b9ac19f13fe91677114965382/source_subfolder/src/CMakeLists.txt
  memory_pool.cpp
  binding_normalization.cpp
  demangle_type_name.cpp
  component.cpp
  fixed_size_allocator.cpp
  injector_storage.cpp
  normalized_component_storage.cpp
  normalized_component_storage_holder.cpp
  semistatic_map.cpp
  semistatic_graph.cpp
C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382\source_subfolder\include\fruit/impl/normalized_component_storage/binding_normalization.templates.h(679,1): f
atal  error C1001: Internal compiler error. [C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382\build_subfolder\source_subfolder\src\fruit.vcxproj]
  (compiler file 'D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\lambdas.cpp', line 8745)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  If possible please provide a repro here: https://developercommunity.visualstudio.com
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information (compiling source file C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382\source_sub 
  folder\src\binding_normalization.cpp)
C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382\source_subfolder\src\binding_normalization.cpp(308): message : see reference to function template instantiat 
ion 'void fruit::impl::BindingNormalization::normalizeBindingsWithBindingCompression<fruit::impl::BindingNormalization::normalizeBindingsWithUndoableBindingCompression::<lambda_1>,fruit::impl::Bi 
ndingNormalization::normalizeBindingsWithUndoableBindingCompression::<lambda_2>,fruit::impl::BindingNormalization::normalizeBindingsWithUndoableBindingCompression::<lambda_3>,fruit::impl::Binding 
Normalization::normalizeBindingsWithUndoableBindingCompression::<lambda_4>,fruit::impl::BindingNormalization::normalizeBindingsWithUndoableBindingCompression::<lambda_5>>(fruit::impl::FixedSizeVe 
ctor<fruit::impl::ComponentStorageEntry,std::allocator<T>> &&,fruit::impl::FixedSizeAllocator::FixedSizeAllocatorData &,fruit::impl::MemoryPool &,fruit::impl::MemoryPool &,fruit::impl::MemoryPool 
 &,const std::vector<fruit::impl::TypeId,fruit::impl::ArenaAllocator<fruit::impl::TypeId>> &,std::vector<fruit::impl::ComponentStorageEntry,fruit::impl::ArenaAllocator<T>> &,std::unordered_map<fr 
uit::impl::TypeId,fruit::impl::NormalizedMultibindingSet,std::hash<fruit::impl::TypeId>,std::equal_to<fruit::impl::TypeId>,std::allocator<std::pair<const fruit::impl::TypeId,fruit::impl::Normaliz 
edMultibindingSet>>> &,SaveCompressedBindingUndoInfo,SaveFullyExpandedComponentsWithNoArgs,SaveFullyExpandedComponentsWithArgs,SaveComponentReplacementsWithNoArgs,SaveComponentReplacementsWithArg
s)' being compiled [C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382\build_subfolder\source_subfolder\src\fruit.vcxproj]
          with
          [
              T=fruit::impl::ComponentStorageEntry,
              SaveCompressedBindingUndoInfo=fruit::impl::BindingNormalization::normalizeBindingsWithUndoableBindingCompression::<lambda_1>,
              SaveFullyExpandedComponentsWithNoArgs=fruit::impl::BindingNormalization::normalizeBindingsWithUndoableBindingCompression::<lambda_2>,
              SaveFullyExpandedComponentsWithArgs=fruit::impl::BindingNormalization::normalizeBindingsWithUndoabl...
fruit/3.6.0: 
fruit/3.6.0: ERROR: Package '255fef913b09852b9ac19f13fe91677114965382' build failed
fruit/3.6.0: WARN: Build folder C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382
ERROR: fruit/3.6.0: Error in build() method, line 111
        cmake.build()
        ConanException: Error 1 while executing cmake --build C:\Users\jj\.conan\data\fruit\3.6.0\_\_\build\255fef913b09852b9ac19f13fe91677114965382\build_subfolder --config Debug -- /m:12 /verbosity:minimal
@memsharded
Copy link
Member

Hi @Inujel

The cppstd has been declared legacy long time ago. It shouldn't be used anymore, and Conan 2.0 finally removed it completely. All of the modern integrations in from conan.tools.cmake, from conan.tools.gnu etc (the ones that are 2.0-ready, the rest are being dropped too), do not listen at all to cppstd and only compiler.cppstd. Please use only the later.

The issue that you are reporting is probably most likely related to fruit/3.6.0@ recipe. Is that the one from conan-center-index? In that case, we should transfer this issue to that repo, let me know.

@Inujel
Copy link
Author

Inujel commented Nov 14, 2022

Hi @memsharded

Oh I see. So with cppstd=20, Visual Studio doesn't even compile in C++20.

The recipe works fine with C++14 or C++17, so it's nothing new. It's a C++20-specific bug.

Here is where I come from: google/fruit#145

I think we can close this. Thanks for your help.

@memsharded
Copy link
Member

Thanks for the feedback @Inujel !

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

No branches or pull requests

2 participants