Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,196
    • Issues 3,196
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 15
    • Merge Requests 15
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • CMake
  • CMakeCMake
  • Issues
  • #18889

Closed
Open
Opened Feb 07, 2019 by Sam Freed@sfreed141Contributor

Error creating static library from asm on Windows with Ninja generator

When building a project that creates a static library from asm on Windows with the Ninja generator I get this error:

cmd.exe /C "cd . && "" cr third_party\boost_context\boost_context.lib /machine:x64 third_party\boost_context\CMakeFiles\boost_context.dir\asm\jump_x86_64_ms_pe_masm.asm.obj third_party\boost_context\CMakeFiles\boost_context.dir\asm\make_x86_64_ms_pe_masm.asm.obj && cd ."
'""' is not recognized as an internal or external command,
operable program or batch file.

This happens from VS 2017 and VS 2019 (from the IDE itself and the developer command prompt) when using the Ninja generator. It works fine with the VS generators.

The issue seems to be the archiver is not set properly. I was able to work around the issue by manually specifying CMAKE_AR (to lib.exe) and CMAKE_MASM_CREATE_STATIC_LIBRARY (since CMake seems to assume ar syntax and passes "cr" as a flag, which lib.exe doesn't understand). Is this the correct way to fix this?

The original issue is on Developer Community. The project used to repro can be found at https://github.com/RichieSams/FiberTaskingLib (the particular add_library call is located under third_party/boost_context/CMakeLists.txt).

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#18889