ConnorQi01 opened a new issue, #55279:
URL: https://github.com/apache/arrow/issues/55279

   ### Describe the bug
   
   On Windows, `arrow_compute_testing` exports `ARROW_STATIC` and
   `ARROW_COMPUTE_STATIC` when `ARROW_BUILD_STATIC` is enabled. That option
   means a static library variant is available; it does not mean tests selected
   static linkage.
   
   With both library variants enabled and `ARROW_TEST_LINKAGE=shared`, the
   PUBLIC definitions propagate static declarations into a test linking Arrow
   DLL import libraries. The real `arrow-dlpack-test` target fails with 
duplicate
   `arrow::Status` constructor/destructor definitions (LNK2005 followed by
   LNK1169).
   
   ### How to reproduce
   
   On Windows with Visual Studio and MSVC, configure from the repository root:
   
   ```bat
   cmake -S cpp -B build -G "Visual Studio 18 2026" -A x64 
-DARROW_BUILD_TESTS=ON -DARROW_BUILD_SHARED=ON -DARROW_BUILD_STATIC=ON 
-DARROW_TEST_LINKAGE=shared -DARROW_ACERO=ON -DARROW_FILESYSTEM=ON 
-DARROW_PARQUET=OFF -DARROW_SUBSTRAIT=ON -DARROW_DATASET=ON 
-DRE2_BUILD_TESTING=OFF
   cmake --build build --config Release --target arrow-dlpack-test --parallel 4
   ```
   
   Inspect `arrow_compute_testing`'s PUBLIC compile definitions and those
   inherited by `dlpack_test.cc`. Static API definitions are present despite
   shared test linkage.
   
   Expected: export those definitions only when `ARROW_TEST_LINKAGE` is
   `static`.
   
   ### Version and proposed fix
   
   The real-target failure was reproduced at
   `d228ba5a9def26e67e12b2e475be0b00edb77aea`. The same conditional is present
   at current main `4a6ebc06dc2bb967263fdf83449ac104e54cbaba`.
   
   Change the Windows conditional from `ARROW_BUILD_STATIC` to
   `ARROW_TEST_LINKAGE STREQUAL "static"`.
   
   ### Validation
   
   With the same compiler, configuration and build directory, the original
   target fails to link. After the one-condition change it builds successfully,
   and `arrow-dlpack-test` passes all 39 tests from 10 suites.
   
   An extracted exact CMake target-section check also passes the three linkage
   controls: shared tests with both library variants, static tests, and
   shared-only libraries. The whole Arrow suite was not run.
   
   ### Tool assistance
   
   Copilot assisted with diagnosis, the conditional change, and this report.
   The results above came from actual target builds and test execution; no
   private compiler inputs or internal build logs are attached.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to