Skip to content

Compiling with CMake & Clang on Windows with MSVC ABI (not using clang-cl or the MSVC toolchain) causes QuickJS to try to link to m.lib #728

Closed

Description

@Oliver-makes-code

Title is descriptive enough.

Activity

  1. saghul commented on Dec 1, 2024

    @saghul
    Contributor

    What CMake incantation do you use to compile that way?

    I guess it's not surprising since we do link to libm on Unix for the math functions.

  2. Oliver-makes-code commented on Dec 1, 2024

    @Oliver-makes-code
    ContributorAuthor

    The problem is here: https://github.com/quickjs-ng/quickjs/blob/master/CMakeLists.txt#L215-L217

    It's checking for MSVC, which is only set when CMake uses cl or clang-cl (we're using normal clang)
    But since Clang is using MSVC's ABI (Target x86_64-pc-windows-msvc) it needs to link to MSVC's libraries

  3. saghul commented on Dec 2, 2024

    @saghul
    Contributor

    You don't answer my question though. How do you target that?

  4. Oliver-makes-code commented on Dec 2, 2024

    @Oliver-makes-code
    ContributorAuthor

    The llvm package on Chocolatey, by default, uses MSVC ABI. Otherwise you can use -target x86_64-pc-windows-msvc in the command line arguments. See https://clang.llvm.org/docs/CrossCompilation.html

  5. saghul commented on Dec 2, 2024

    @saghul
    Contributor

    Thanks for explaining, let's continue in the PR.

  6. reopened this on Dec 2, 2024
  7. added a commit that references this issue on Dec 4, 2024
  8. added a commit that references this issue on Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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