conda-forge / libhwloc-feedstock

A conda-smithy repository for libhwloc.
BSD 3-Clause "New" or "Revised" License
0 stars 9 forks source link

libhwloc doesn't work with pkg-config on Windows #38

Closed isaevil closed 1 year ago

isaevil commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Hi! I try to integrate libhwloc into build https://github.com/conda-forge/tbb-feedstock but seems like the process is broken if I try to use pkg-config in CMake.

Please consider this CMakeLists.txt:

cmake_minimum_required(VERSION 3.6)

project(dummy)

find_package(PkgConfig REQUIRED)
pkg_search_module(HWLOC hwloc IMPORTED_TARGET)

add_executable(bin main.cpp)
target_include_directories(bin PUBLIC ${HWLOC_INCLUDE_DIRS})
target_link_libraries(bin PkgConfig::HWLOC)

And the source code:

#include <hwloc.h>
int main() {}

I get the following error message:

LINK : fatal error LNK1104: cannot open file 'hwloc.lib'

Looks like it is due to naming of hwloc.lib when it is installed via conda-forge. The name is hwloc.dll.lib but inserted link option is hwloc.lib.

Installed packages

# Name                    Version                   Build  Channel
cmake                     3.24.2               h1537add_0    conda-forge
gettext                   0.19.8.1          ha2e2712_1008    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libglib                   2.72.1               h3be07f2_0    conda-forge
libhwloc                  2.8.0                ha292e6e_0    conda-forge
libiconv                  1.16                 he774522_0    conda-forge
libxml2                   2.9.14               hf5bbc77_4    conda-forge
libzlib                   1.2.12               hcfcfb64_3    conda-forge
pcre                      8.45                 h0e60522_0    conda-forge
pkg-config                0.29.2            h2bf4dc2_1008    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
ucrt                      10.0.20348.0         h57928b3_0    conda-forge
vc                        14.2                 hb210afc_7    conda-forge
vs2015_runtime            14.29.30139          h890b9b1_7    conda-forge
vs2019_win-64             19.29.30139          hb9aee9d_7    conda-forge
vswhere                   3.0.3                h57928b3_0    conda-forge

Environment info

active environment : hwloc-reproduce
    active env location : C:\Users\iisaev\Miniconda3\envs\hwloc-reproduce
            shell level : 2
       user config file : C:\Users\iisaev\.condarc
 populated config files :
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\iisaev\Miniconda3  (writable)
      conda av data dir : C:\Users\iisaev\Miniconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\iisaev\Miniconda3\pkgs
                          C:\Users\iisaev\.conda\pkgs
                          C:\Users\iisaev\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\iisaev\Miniconda3\envs
                          C:\Users\iisaev\.conda\envs
                          C:\Users\iisaev\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.19044
          administrator : False
             netrc file : None
           offline mode : False
isuruf commented 1 year ago

Fixed in #39