microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.3k stars 1.14k forks source link

C++20 breaks #7748

Closed asklar closed 5 months ago

asklar commented 3 years ago
  1. Error info:

    ReactInstanceWin.i
    F:\gitP\microsoft\react-native-windows\vnext\codegen\NativeDeviceInfoSpec.g.h(23): error C3615: constexpr function 'winrt::Microsoft::ReactNative::TurboModuleSpec::CheckMethodsHelper' cannot result in a constant expression
    F:\gitP\microsoft\react-native-windows\vnext\codegen\NativeDeviceInfoSpec.g.h(23): note: failure was caused by call of undefined function or one not declared 'constexpr'
    F:\gitP\microsoft\react-native-windows\vnext\codegen\NativeDeviceInfoSpec.g.h(23): note: see usage of '__builtin_array_init_helper'
    F:\gitP\microsoft\react-native-windows\vnext\Microsoft.ReactNative.Cxx\NativeModules.h(1186): note: see reference to function template instantiation 'void Microsoft::ReactNativeSpecs::DeviceInfoSpec::ValidateModule<TModule>(void) noexcept' being compiled
        with
        [
            TModule=Microsoft::ReactNative::DeviceInfo
        ]
    F:\gitP\microsoft\react-native-windows\vnext\Microsoft.ReactNative\ReactHost\ReactInstanceWin.cpp(297): note: see reference to function template instantiation 'winrt::Microsoft::ReactNative::ReactModuleProvider winrt::Microsoft::ReactNative::MakeTurboModuleProvider<Microsoft::ReactNative::DeviceInfo,Microsoft::ReactNativeSpecs::DeviceInfoSpec>(void) noexcept' being compiled
  2. Error info: Seems to be related to https://github.com/microsoft/STL/blob/main/stl/inc/coroutine#L21 and https://github.com/microsoft/STL/blob/main/stl/inc/experimental/coroutine#L49.

Folly.lib(json.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(dynamic.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(SpookyHashV2.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(Conv.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(SafeAssert.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(pch.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(Unicode.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(Assume.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(Format.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(json_pointer.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(ToAscii.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
Folly.lib(MallocImpl.obj) : error LNK2038: mismatch detected for '_COROUTINE_ABI': value '2' doesn't match value '1' in ChakraHelpers.obj
F:\gitP\microsoft\react-native-windows\\vnext\\target\x86\Release\Microsoft.ReactNative\Microsoft.ReactNative.dll : fatal error LNK1319: 12 mismatches detected

3.

12>C:\rnw\node_modules\react-native\ReactCommon\jsi\jsi\test\testlib.cpp(511,1): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'std::string'
12>C:\rnw\node_modules\react-native\ReactCommon\jsi\jsi\test\testlib.cpp(528,1): message : No constructor could take the source type, or constructor overload resolution was ambiguous
  EXPECT_TRUE(f.call(
                   rt,
                   nullptr,
                   true,
                   3.14,
                   2.71f,
                   17,
                   "s1",
                   String::createFromAscii(rt, "s2"),
                   std::string{"s3"},
                   std::string{u8"s\u2600"},
                   // invalid UTF8 sequence due to unexpected continuation byte
                   std::string{"s\x80"},
                   Object(rt),
                   Array(rt, 1),
                   function("function(){}"),
                   Value(42))
                  .getBool());
asklar commented 3 years ago

For issue 3), see facebook/react-native#31496

chrisglein commented 3 years ago

For issue 1) that's under our control as that's from our codegen. We could split this issue up but it sounds like 2) and 3) are external and 1) is ours. So let's track fixing 1) here. Possible 2) is an overlap with RNW code. Impact for us is getting automated validation of future C++/tool updates. Not impacting us today, but will. Could add some pipeline validation that C++20 builds.

beached commented 3 years ago

For issue 1) that's under our control as that's from our codegen. We could split this issue up but it sounds like 2) and 3) are external and 1) is ours. So let's track fixing 1) here. Possible 2) is an overlap with RNW code. Impact for us is getting automated validation of future C++/tool updates. Not impacting us today, but will. Could add some pipeline validation that C++20 builds.

Sorry to interject into the thread here. Is there a link for this on developer community, the __builtin_array_init_helper issue is affecting another codebase and it would be nice to track

chrisglein commented 2 years ago

@asklar Older issue - are we past all this? Can close?

QuellaZhang commented 2 years ago

Verified that issue 1) still exists.

TatianaKapos commented 5 months ago

I'm hitting the first error in the CI for upgrading gallery to 0.74 https://dev.azure.com/ms/react-native-gallery/_build/results?buildId=568596&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9