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]: Win64 for ARM64 cpu build fails (fix included) #23

Open
boreno opened this issue Mar 20, 2023 · 0 comments
Open

[Bug]: Win64 for ARM64 cpu build fails (fix included) #23

boreno opened this issue Mar 20, 2023 · 0 comments
Labels

Comments

@boreno
Copy link

boreno commented Mar 20, 2023

Context

We are using a commercial license to embed Linphone in our cross-platform Standard ERP system. The BCToolbox project doesn't build on Windows ARM64, a fix is provided below.

General information

  • Device: MacBook Pro M2 Max
  • OS: Windows 11 Pro ARM64
  • Version of the App: N/A
  • Version of the SDK: 5.2

Expected behaviour

The bctoolbox::getStackTrace() function should use the ARM64 registers in the _CONTEXT structure on Win64 ARM64.

To Reproduce

  1. Build BCTOOLBOX using the Visual Studio 2022 ARM64 native command prompt using the ARM64 architecture

Additional context

To fix this build issue, edit the file bctoolbox\src\utils\win_utils.cc, function getStackTrace() on line 107, changing the following:

#if _WIN64
	STACKFRAME frame = {};
	frame.AddrPC.Offset = context.Rip;
	frame.AddrPC.Mode = AddrModeFlat;
	frame.AddrFrame.Offset = context.Rbp;
	frame.AddrFrame.Mode = AddrModeFlat;
	frame.AddrStack.Offset = context.Rsp;
	frame.AddrStack.Mode = AddrModeFlat;

into this

#if _WIN64 && !defined(_ARM64_)
	STACKFRAME frame = {};
	frame.AddrPC.Offset = context.Rip;
	frame.AddrPC.Mode = AddrModeFlat;
	frame.AddrFrame.Offset = context.Rbp;
	frame.AddrFrame.Mode = AddrModeFlat;
	frame.AddrStack.Offset = context.Rsp;
	frame.AddrStack.Mode = AddrModeFlat;
#elif defined(_ARM64_)
	STACKFRAME frame = {};
	frame.AddrPC.Offset = context.Pc;
	frame.AddrPC.Mode = AddrModeFlat;
	frame.AddrFrame.Offset = context.Fp;
	frame.AddrFrame.Mode = AddrModeFlat;
	frame.AddrStack.Offset = context.Sp;
	frame.AddrStack.Mode = AddrModeFlat;

SDK logs URL

No response

@boreno boreno added the bug label Mar 20, 2023
@boreno boreno changed the title [Bug]: Win64 for ARM64 cpu build fails [Bug]: Win64 for ARM64 cpu build fails (fix included) Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant