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

Boris Kolpackov boris at codesynthesis.com
Tue Oct 1 04:35:22 EDT 2024


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://build2.org/community.xhtml#stage

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