[odb-users] Re: Cross-compiling from x86 to ARM on Windows

Sunny Sun sunny.sun at ringcentral.com
Sat Oct 12 03:46:42 EDT 2024


You should be able to build for ARM64 with MSVC. You don't need
to specify /MACHINE:ARM64 and the bpkg-create command line could
be just:

bpkg create -d libodb-msvc-release cc^
  config.cxx=cl^
  "config.cc.coptions=/std:c++20 /O2 /MD /Zi /arch:armv8.0"^
  "config.bin.lib=static"^
  config.install.root="%CurrentFolder%output\Release"


I tried, but I got
cl: command line warning D9002: ignoring unknown option "/arch:armv8.0"


If I remove the /arch:armv8.0 option, it seems it dose not specify arm arch anywhere.

Thank you in advance.

________________________________
From: Boris Kolpackov <boris at codesynthesis.com>
Sent: Tuesday, October 1, 2024 4:35 PM
To: Sunny Sun <sunny.sun at ringcentral.com>
Cc: odb-users at codesynthesis.com <odb-users at codesynthesis.com>
Subject: Re: [odb-users] Re: Cross-compiling from x86 to ARM on Windows


[EXTERNAL]


Sunny Sun <sunny.sun at ringcentral.com> writes:

> It got error: unable to translate target triplet CPU aarch64 to /MACHINE

Ok, there were some missing pieces in build2 for MSVC ARM64 support
which I have now added.

If you get the latest staged version of the build2 toolchain:

https://urldefense.com/v3/__https://build2.org/community.xhtml*stage__;Iw!!J-1DKIBqn-Pi!E1oLGaK7HPZhx-W1QPIXwAoLWxUcnnkEy0h0U0Wip2R7mmG0qC7eMErE_8r5UOYB_LAHRXLSMCwVX4u2320iwA$

You should be able to build for ARM64 with MSVC. You don't need
to specify /MACHINE:ARM64 and the bpkg-create command line could
be just:

bpkg create -d libodb-msvc-release cc^
  config.cxx=cl^
  "config.cc.coptions=/std:c++20 /O2 /MD /Zi /arch:armv8.0"^
  "config.bin.lib=static"^
  config.install.root="%CurrentFolder%output\Release"

And, for completeness, if you need to build for ARM64EC instead:

bpkg create -d libodb-msvc-release cc^
  "config.cxx=cl /arm64EC"^
  "config.cc.coptions=/std:c++20 /O2 /MD /Zi /arch:armv8.0"^
  "config.cc.loptions=/MACHINE:ARM64EC"^
  "config.bin.lib=static"^
  config.install.root="%CurrentFolder%output\Release"


More information about the odb-users mailing list