Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15298

[C++] Linking error for debug build on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++
    • Windows 10

    Description

      I experienced a linking error while building the debug flavor of the project I am working on, that links dynamically the arrow libraries, on Windows. Specifically the error is described in Linker Tools Warning LNK4098.
      The issue stems from the following CMake line, arrow/cpp/cmake_modules/SetupCxxFlags.cmake.

      The solution that worked in my case was to explicitly mention which libraries to exclude when building the release and debug flavor, following the table at Linker Tools Warning LNK4098. Specifically the aforementioned link to the Microsoft page describes in detail which libraries to exclude when linking dynamically with C run-time, i.e.,

      NOT ARROW_USE_STATIC_CRT

      .

      Additionally, for debug flavor builds, the /MDd or /MTd options might need to be set explicitly. I pass that from my project's configuration but I think it is not done explicitly within Arrow CMake files. Relevant link Linker Tools Error LNK2001, read segment "If you link to the release mode libraries when building a debug version [...]"

      Apache Arrow ticket that introduced the aforementioned CMake line change and dealt with the same issue: ARROW-4014

      Attachments

        Activity

          People

            Unassigned Unassigned
            zoistas Zois Tasoulas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: