Skip to content

Failure to assemble ARM64 code with MSVC's ARMASM64 #254

Open
@hmartinez82

Description

@hmartinez82

Boost 1.84
CMake 3.28.3
Visual Studio 2022 17.9.2
Ninja 1.11.1

This is building Boost Context on a ARM64 machine. Not x-compiling.

Description

Failure to assemble ARM64 code:

[0/2] Re-checking globbed directories...
[1/2] Building ASM_ARMASM object libs\context\CMakeFiles\boost_context.dir\src\asm\ontop_arm64_aapcs_pe_armasm.asm.obj
FAILED: libs/context/CMakeFiles/boost_context.dir/src/asm/ontop_arm64_aapcs_pe_armasm.asm.obj
C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1439~1.335\bin\HOSTAR~1\arm64\armasm64.exe -DBOOST_CONTEXT_EXPORT="" -DBOOST_CONTEXT_NO_LIB="" -DBOOST_CONTEXT_SOURCE="" -DBOOST_CONTEXT_STATIC_LINK="" -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\context\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\assert\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\config\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\core\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\static_assert\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\throw_exception\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\mp11\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\pool\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\integer\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\type_traits\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\winapi\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\predef\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\smart_ptr\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\move\include  -o libs\context\CMakeFiles\boost_context.dir\src\asm\ontop_arm64_aapcs_pe_armasm.asm.obj C:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\context\src\asm\ontop_arm64_aapcs_pe_armasm.asm
Microsoft (R) ARM Macro Assembler Version 14.39.33521.0 for 64 bits
Copyright (C) Microsoft Corporation.  All rights reserved.

error A2029: unknown command-line argument or argument value -DBOOST_CONTEXT_EXPORT=

 Usage:      armasm [<options>] sourcefile objectfile
             armasm [<options>] -o objectfile sourcefile
             armasm -h              for help

ninja: build stopped: subcommand failed.

Possible explanation

It seems that the Microsoft ARM Assembler is very poor of command line options:

Microsoft (R) ARM Macro Assembler Version 14.39.33521.0 for 64 bits
Copyright (C) Microsoft Corporation.  All rights reserved.

 Usage:      armasm [<options>] sourcefile objectfile
             armasm [<options>] -o objectfile sourcefile
             armasm -h              for help

<options>:            (Upper case shows allowable abbreviation)
  -Errors     errorsfile       redirect stderr diagnostics to errorsfile
  -I          dir[;dir]        add dirs to include search path
  -PreDefine  directive        pre-execute a SET{L,A,S} directive
  -NOWarn                      turn off warning messages
  -ignore <warning-num>        don't report warning-num
  -help                        help (this information)
  -via <file>                  read further arguments from <file>
  -machine <machine>           set the PE machine type field
  -g                           generate debugging info
  -gh:SHA1                     use SHA1 for file checksum in debug info
  -gh:SHA_256                  use SHA256 for file checksum in debug info (default)
  -funcOverride:<func>         emit function overriding support for <func>
  -errorReport:<option>        deprecated. Report internal assembler errors to Microsoft
      none - do not send report
      prompt - prompt to immediately send report
      queue - at next admin logon, prompt to send report (default)
      send - send report automatically

<machine>:  ARM64 | ARM64EC

I manually edited the build.ninja file to remove all the DEFINES section for the three targets that run ARMASM64 and that got me to the finish line.

I unfortunately don't know CMake enough to be able to tell the build to not emit any DEFINE for the assembler calls :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions