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

Support C++ extension to run on Mac M1 x64 emulator #6713

Closed
Satvik-B opened this issue Dec 27, 2020 · 7 comments
Closed

Support C++ extension to run on Mac M1 x64 emulator #6713

Satvik-B opened this issue Dec 27, 2020 · 7 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@Satvik-B
Copy link

Type: General

Describe the bug

  • OS and Version: macOS BigSur 11.1
  • VS Code Version: 1.53 Insider
  • C/C++ Extension Version: 1.1.3
  • Other extensions you installed (and if the issue persists after disabling them):
  • Architecture arm64 is not supported.
    Check the bottom right corner for the error
    Screenshot 2020-12-27 at 10 27 59 PM
@sean-mcmanus sean-mcmanus added this to the 1.2.0 milestone Dec 29, 2020
@sean-mcmanus sean-mcmanus added bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service labels Dec 29, 2020
@sean-mcmanus
Copy link
Collaborator

The fix was made available a week ago at https://github.com/microsoft/vscode-cpptools/releases/tag/1.2.0-preview .

@benphelps
Copy link

While this fix does let the extension install, it's still running under Rosetta 2 which causes functionality to not align with what would be expected.

This can be seen here with a simple test,
Screen Shot 2021-01-14 at 1 30 28 AM

VS Code Insiders is running natively, and you can prove this by checking the target clang reports, which is arm64-apple-darwin20.2.0.

However, the extensions binaries are still running under Rosetta 2, which causes anything spawned by them to also run under Rosetta 2. You can see this behavior in the current stable build of VS Code when checking the clang target, where it reports x86_64-apple-darwin20.2.0, even while running on an M1 processor.

The cpptools binary needs to be compiled natively for arm64 for everything to function correctly.

OS and Version: macOS Big Sur 11.1 (20C69)
VS Code Version: 1.53.0-insider
C/C++ Extension Version: v1.2.0-preview

@bobbrow
Copy link
Member

bobbrow commented Jan 14, 2021

The cpptools binary needs to be compiled natively for arm64 for everything to function correctly.

Yep, we have a feature tracking that. #6595. The current solution is just a workaround to unblock folks until we get set up to compile the binaries in our CI system.

@bobbrow
Copy link
Member

bobbrow commented Jan 14, 2021

@michelleangela will the cross compile feature work address the preprocessor stuff mentioned above? I was thinking this should already work if intelliSenseMode is set to an arm64 variant, so I was expecting it would even work today with the preview build @sean-mcmanus shared. Unless there is another preprocessor define we need to add to the .json files...

@sean-mcmanus
Copy link
Collaborator

How do were check? Where are those TARGET_CPU macros defined? With 1.2.0-preview I believe there was a bug where it could choose a non-ARM intelliSenseMode by default, but if the intelliSenseMode is se to *-arm64 then it would be expected to work.

@michelleangela
Copy link
Contributor

michelleangela commented Jan 14, 2021

The IntelliSenseMode value will default to the host architecture and if the extension can detect the default target architecture of the default installed compiler, it will change the IntelliSenseMode to that default target architecture.

Configuring the IntelliSense in c_cpp_properties.json to use a specific IntelliSenseMode "macos-clang-arm64" and adding --target arguments for arm64 to the compilerArgs are needed for the extension to get the marcos for arm64.

@michelleangela michelleangela changed the title Architecture arm64 is not supported, error when installing on M1 Mac Support C++ extension to run on M1 x64 emulator Jan 14, 2021
@michelleangela michelleangela changed the title Support C++ extension to run on M1 x64 emulator Support C++ extension to run on Mac M1 x64 emulator Jan 14, 2021
@michelleangela
Copy link
Contributor

michelleangela commented Jan 14, 2021

I changed the title of this issue to better reflect that the current way to support Mac M1 is to only enable installing the extension but not to enable the extension to run natively on arm64, which is a separate feature #6595.

@bobbrow bobbrow added fixed Check the Milestone for the release in which the fix is or will be available. and removed fixed Check the Milestone for the release in which the fix is or will be available. labels Jan 26, 2021
@Colengms Colengms closed this as completed Feb 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

6 participants