Skip to content

[icu] ICU port adds -lm in pkgconfig files for debug MSVC builds #22311

@equeim

Description

@equeim

Describe the bug
When ICU is built for Windows (MSVC) target with debug variant, its configure script adds -lm library to Libs.private property of pkgconfig files. As as I know, this library does not exist in MSVC toolchain. It is not used with dynamic linking, but static linking with pkgconfig results in linking error.

Environment

  • OS: Windows
  • Compiler: MSVC 19.29.30138

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install icu:x64-windows-static pkgconf:x64-windows-static
  2. Try to link to static ICU library by using pkgconfig
  3. Try to build CMake project with following CMakeLists.txt: https://gist.github.com/equeim/851df8e69165e509d9a511d1071e5631,
    dummy main.cpp and following CMake configuration command:
cmake -S \path\to\source -B \path\to\build -GNinja -DCMAKE_TOOLCHAIN_FILE=\path\to\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DPKG_CONFIG_EXECUTABLE=\path\to\vcpkg\installed\x64-windows-static\tools\pkgconf\pkgconf.exe -DCMAKE_BUILD_TYPE=Debug
  1. Observe linking error LINK : fatal error LNK1104: cannot open file 'm.lib'

Expected behavior
Statically linking ICU using pkgconfig should work.

Failure logs
build.log

Additional context
I believe that passing ac_cv_lib_m_floor=no to configure script in icu/portfile.cmake for MSVC toolchain fixes the issue but I don't know whether it is the correct solution.

Metadata

Metadata

Assignees

Labels

category:port-bugThe issue is with a library, which is something the port should already support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions