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

NativeModuleSample cppwinrt fails to build: Cannot open include file: 'winrt/impl/Windows.Devices.Bluetooth.GenericAttributeProfile.1.h' #832

Open
chrisglein opened this issue May 1, 2023 · 7 comments
Labels
bug Something isn't working samples
Milestone

Comments

@chrisglein
Copy link
Member

chrisglein commented May 1, 2023

Sample

NativeModuleSample

Problem Description

NativeModuleSample cppwinrt fails to build:

Cannot open include file: 'winrt/impl/Windows.Devices.Bluetooth.GenericAttributeProfile.1.h'

Time Elapsed 00:00:00.55
√ Restoring NuGet packages
 i Autolink step is skipped
 √ Found Solution: C:\Users\redacted\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\windows\NativeModuleSample.sln
 i Build configuration: Debug
 i Build platform: x64
 × Building Solution: C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.X...
 × Build failed with message 7:7>C:\Users\redacted\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Microsoft.ReactNative\build\x64\Debug\Microsoft.ReactNative\Generated Files\winrt\impl\Windows.ApplicationModel.Background.2.h(8,10): fatal  error C1083: Cannot open include file: 'winrt/impl/Windows.Devices.Bluetooth.GenericAttributeProfile.1.h': No such file or directory (compiling source file C:\Users\redacted\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Shared\Executors\WebSocketJSExecutor.cpp) [C:\Users\redacted\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj]. Check your build configuration.
Command failed. Re-run the command with --logging for more information.

Steps To Reproduce

(See readme)

  1. Clone repo
  2. cd samples\NativeModuleSample\cppwinrt
  3. yarn
  4. npx react-native run-windows
    --no-deploy --no-launch --no-packager --no-autolink --proj "NativeModuleSample\NativeModuleSample.vsproj"

Expected Results

follow instructions in readme, get build

CLI version

10.0.0

Environment

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.23447
    CPU: (24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores
    Memory: 40.40 GB / 63.86 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 9.4.1 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0, 10.0.22000.0, 10.0.22621.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 17.5.33530.505 (Visual Studio Community 2022), 16.11.33529.622 (Visual Studio Community 2019)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0 => 0.71.0
    react-native-windows: 0.71.0 => 0.71.0
  npmGlobalPackages:
    *react-native*: Not Found

Target Platform Version

None

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

@chrisglein chrisglein added bug Something isn't working samples labels May 1, 2023
@chrisglein chrisglein changed the title Describe the problem NativeModuleSample cppwinrt fails to build: Cannot open include file: 'winrt/impl/Windows.Devices.Bluetooth.GenericAttributeProfile.1.h' May 1, 2023
@jonthysell
Copy link
Contributor

jonthysell commented May 1, 2023

Does this repro without passing --proj? Where do we specify to do that? What happens if you just run npx react-native run-windows --logging --no-packager --no-launch --no-autolink --no-deploy --arch x64 which we do in CI?

@jonthysell
Copy link
Contributor

If I run npx react-native run-windows --logging --no-packager --no-launch --no-autolink --no-deploy --arch x64 locally everything builds fine except I get an (ignorable) error: No app project file found, please specify in react-native.config. Optionally, use --proj {projFile}..

If I add --proj, i.e. npx react-native run-windows --logging --no-packager --no-launch --no-autolink --no-deploy --arch x64 --proj windows\NativeModuleSample\NativeModuleSample.vcxproj it builds perfectly.

npx react-native info:

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.25352
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 7.84 GB / 15.84 GB
  Binaries:
    Node: 16.18.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.16299.0, 10.0.18362.0, 10.0.19041.0, 10.0.22000.0, 10.0.22621.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.11.33529.622 (Visual Studio Enterprise 2019), 17.5.33530.505 (Visual Studio Enterprise 2022)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0 => 0.71.0
    react-native-windows: 0.71.0 => 0.71.0
  npmGlobalPackages:
    *react-native*: Not Found

@chrisglein
Copy link
Member Author

What happens if you just run npx react-native run-windows --logging --no-packager --no-launch --no-autolink --no-deploy --arch x64 which we do in CI?

C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt> npx react-native run-windows --logging --no-packager --no-launch --no-autolink --no-deploy --arch x64

× Building Solution
× Build failed with message 7:7>C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Microsoft.ReactNative\build\x64\Debug\Microsoft.ReactNative\Generated Files\winrt\impl\Windows.ApplicationModel.Background.2.h(8,10): fatal error C1083: Cannot open include file: 'winrt/impl/Windows.Devices.Bluetooth.GenericAttributeProfile.1.h': No such file or directory (compiling source file C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Shared\PackagerConnection.cpp) [C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj]. Check your build configuration.
× No app project file found, please specify in react-native.config. Optionally, use --proj {projFile}.
Command failed with error MSBuildError: 7:7>C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Microsoft.ReactNative\build\x64\Debug\Microsoft.ReactNative\Generated Files\winrt\impl\Windows.ApplicationModel.Background.2.h(8,10): fatal error C1083: Cannot open include file: 'winrt/impl/Windows.Devices.Bluetooth.GenericAttributeProfile.1.h': No such file or directory (compiling source file C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Shared\PackagerConnection.cpp) [C:\Users\REDACTED\Source\react-native-windows-samples\samples\NativeModuleSample\cppwinrt\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj]

@TatianaKapos
Copy link
Contributor

TatianaKapos commented May 4, 2023

Not sure if this is helpful but it also runs fine on my machine so possibly a missing dependency? This issue #686 had a similar error message but had a workaround

@chrisglein
Copy link
Member Author

chrisglein commented May 4, 2023

At a bare minimum we need to update the readme.
I'm going to take another pass with cleaned build output and see if this repros.

UPDATE: Does still repro. And isn't for some other folks. Is there some unspoken dependency here?

@Hakunata
Copy link

Meet this problem too ... So,how to resolve it?

@treadways
Copy link

Has this issue been resolved?

@chrisglein chrisglein removed their assignment Oct 24, 2023
@chrisglein chrisglein added this to the Backlog milestone Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working samples
Projects
None yet
Development

No branches or pull requests

5 participants