You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "David Li (Jira)" <ji...@apache.org> on 2022/02/11 19:03:00 UTC

[jira] [Updated] (ARROW-15298) Linking error for debug build on Windows

     [ https://issues.apache.org/jira/browse/ARROW-15298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Li updated ARROW-15298:
-----------------------------
    Component/s: C++

> Linking error for debug build on Windows
> ----------------------------------------
>
>                 Key: ARROW-15298
>                 URL: https://issues.apache.org/jira/browse/ARROW-15298
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>         Environment: Windows 10
>            Reporter: Zois Tasoulas
>            Priority: Major
>              Labels: Windows, build, cmake, cpp, debug, linking, msvc
>
> 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|https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-warning-lnk4098?view=msvc-170].
> The issue stems from the following CMake line, [arrow/cpp/cmake_modules/SetupCxxFlags.cmake|https://github.com/apache/arrow/blob/8b440d1b5df4a0e58bcaa422b83e6d6ff1213b5f/cpp/cmake_modules/SetupCxxFlags.cmake#L643].
> 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|https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-warning-lnk4098?view=msvc-170]. Specifically the aforementioned link to the Microsoft page describes in detail which libraries to exclude when linking dynamically with C run-time, i.e.,
> {code:bash}
> NOT ARROW_USE_STATIC_CRT{code}
> .
> 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|https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=msvc-160], 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



--
This message was sent by Atlassian Jira
(v8.20.1#820001)