pytorch / cpuinfo

CPU INFOrmation library (x86/x86-64/ARM/ARM64, Linux/Windows/Android/macOS/iOS)
BSD 2-Clause "Simplified" License
962 stars 306 forks source link

missing `libcpuinfo.pc` from distro package install #241

Open frpunzalan opened 2 months ago

frpunzalan commented 2 months ago

Hi guys,

Thanks for all the work in this library.

I was trying to use the library by installing it from Ubuntu's package installer. I use the following command and successfully installed the libcpuinfo-dev package.

$ apt install libcpuinfo-dev

# the installed files are in the following directories
$ dpkg-query -L libcpuinfo-dev
/.
/usr
/usr/include
/usr/include/cpuinfo.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/share
/usr/share/doc
/usr/share/doc/libcpuinfo-dev
/usr/share/doc/libcpuinfo-dev/README.md.gz
/usr/share/doc/libcpuinfo-dev/copyright
/usr/lib/x86_64-linux-gnu/libcpuinfo.so
/usr/share/doc/libcpuinfo-dev/changelog.Debian.gz

However, when I try to add the library to my cmake file, it was not able to find it. I tried using the command to check the package as shown in the README but I get the following error:

$ pkg-config --cflags --libs libcpuinfo
Package libcpuinfo was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcpuinfo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcpuinfo' found

I tried looking for the libcpuinfo.pc file but it does not exist anywhere in the system. Am I missing a step for the package installation?

System Info:

$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:    20.04
Codename:   focal
prashanthswami commented 2 months ago

Can't quite explain this, but maybe a helpful data point. I'm not using Ubuntu, but a similar base-image Debian version, and dpkg-query does indeed return the .pc file on installation:

/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libcpuinfo.pc

In terms of how to fix this, assuming it's a hiccup with the distro package . . . to be honest, I'm not sure what the maintainer relationship is between this repository and the repository that produces the distro. At a glance, the source seems to be from the Debian Machine Learning Team: https://salsa.debian.org/deeplearning-team/cpuinfo . They appear to just be supporting packaging software like this and others, so they might be the right folks to ask if a particular distro isn't doing the right thing?