Categories: Ubuntu

[Solved]: “ERROR! hwloc library not found”

In this article, we will see how to solve hwloc library not found error. Many of the applications requires portable locality hardware (hwloc) software package to be installed in the system for its functioning so it would look for hwloc library at the configuration step during application installation. If it does not find or locate the library then it will show "ERROR! hwloc library not found" on the output.

Something similar happened to me as well when I tried installing snort 3 on my Ubuntu 22.04 LTS system. While running ./configure_cmake.sh script, it showed "ERROR! hwloc library not found"

Sponsored
on the output. If you are also facing this error then I would recommend you to go through this article to fix the error.

 

[Solved]: “ERROR! hwloc library not found”

Also Read: [Solved]: “autoreconf: not found” error 

Sponsored

As explained, when i tried running ./configure_cmake.sh script to configure snort 3 source code for installation on my Ubuntu 22.04 LTS system then i noticed ERROR! hwloc library not found on the output as shown below.

cyberithub@ubuntu:~/snort3-3.1.71.0$ ./configure_cmake.sh
./configure_cmake.sh: 486: [: Illegal number:
Build Directory : build
Source Directory: /home/cyberithub/snort3-3.1.71.0
-- The CXX compiler identification is Clang 14.0.0
-- The C compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libdaq>=3.0.12'
-- Found libdaq, version 3.0.12
-- Found DAQ: /usr/local/lib/libdaq.so
-- Checking for module 'libdaq_static_afpacket'
-- Found libdaq_static_afpacket, version 3.0.12
-- Checking for module 'libdaq_static_fst'
-- Found libdaq_static_fst, version 3.0.12
-- Checking for module 'libdaq_static_gwlb'
-- Found libdaq_static_gwlb, version 3.0.12
-- Checking for module 'libdaq_static_savefile'
-- Found libdaq_static_savefile, version 3.0.12
-- Checking for module 'libdaq_static_trace'
-- Found libdaq_static_trace, version 3.0.12
-- Found DNET: /usr/include
-- Found FLEX: /usr/bin/flex (found suitable version "2.6.4", minimum required is "2.6.0")
-- Checking for module 'hwloc'
-- No package 'hwloc' found
CMake Error at cmake/FindHWLOC.cmake:6 (message):


ERROR! hwloc library not found.

Get it from https://www.open-mpi.org/projects/hwloc/

Call Stack (most recent call first):
cmake/include_libraries.cmake:7 (find_package)
CMakeLists.txt:27 (include)


CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find HWLOC (missing: HWLOC_LIBRARIES HWLOC_INCLUDE_DIRS)
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/FindHWLOC.cmake:18 (find_package_handle_standard_args)
cmake/include_libraries.cmake:7 (find_package)
CMakeLists.txt:27 (include)


-- Configuring incomplete, errors occurred!
See also "/home/cyberithub/snort3-3.1.71.0/build/CMakeFiles/CMakeOutput.log".

While above error could throw due to multiple reasons but most of the time it occurs because hwloc library package is missing in the system. So to fix the error you just have to install this package by running sudo apt-get install -y libhwloc-dev command as shown below. This will download and install the package along with all its dependencies from default Ubuntu repo.

cyberithub@ubuntu:~/snort3-3.1.71.0$ sudo apt-get install -y libhwloc-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libhwloc-plugins libhwloc15 libnuma-dev libxnvctrl0 ocl-icd-libopencl1
Suggested packages:
libhwloc-contrib-plugins opencl-icd
The following NEW packages will be installed:
libhwloc-dev libhwloc-plugins libhwloc15 libnuma-dev libxnvctrl0 ocl-icd-libopencl1
0 upgraded, 6 newly installed, 0 to remove and 3 not upgraded.
Need to get 517 kB of archives.
After this operation, 2,021 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libhwloc15 amd64 2.7.0-2ubuntu1 [159 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 libxnvctrl0 amd64 510.47.03-0ubuntu1 [11.5 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 libnuma-dev amd64 2.0.14-3ubuntu2 [35.9 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libhwloc-dev amd64 2.7.0-2ubuntu1 [256 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 ocl-icd-libopencl1 amd64 2.2.14-3 [39.1 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libhwloc-plugins amd64 2.7.0-2ubuntu1 [15.6 kB]
Fetched 517 kB in 2s (276 kB/s)
Selecting previously unselected package libhwloc15:amd64.
(Reading database ... 235145 files and directories currently installed.)
Preparing to unpack .../0-libhwloc15_2.7.0-2ubuntu1_amd64.deb ...
Unpacking libhwloc15:amd64 (2.7.0-2ubuntu1) ...
Selecting previously unselected package libxnvctrl0:amd64.
Preparing to unpack .../1-libxnvctrl0_510.47.03-0ubuntu1_amd64.deb ...
Unpacking libxnvctrl0:amd64 (510.47.03-0ubuntu1) ...
Selecting previously unselected package libnuma-dev:amd64.
Preparing to unpack .../2-libnuma-dev_2.0.14-3ubuntu2_amd64.deb ...
Unpacking libnuma-dev:amd64 (2.0.14-3ubuntu2) ...
Selecting previously unselected package libhwloc-dev:amd64.
Preparing to unpack .../3-libhwloc-dev_2.7.0-2ubuntu1_amd64.deb ...
Unpacking libhwloc-dev:amd64 (2.7.0-2ubuntu1) ...
Selecting previously unselected package ocl-icd-libopencl1:amd64.
Preparing to unpack .../4-ocl-icd-libopencl1_2.2.14-3_amd64.deb ...
Unpacking ocl-icd-libopencl1:amd64 (2.2.14-3) ...
Selecting previously unselected package libhwloc-plugins:amd64.
Preparing to unpack .../5-libhwloc-plugins_2.7.0-2ubuntu1_amd64.deb ...
Unpacking libhwloc-plugins:amd64 (2.7.0-2ubuntu1) ...
Setting up libnuma-dev:amd64 (2.0.14-3ubuntu2) ...
Setting up libxnvctrl0:amd64 (510.47.03-0ubuntu1) ...
Setting up libhwloc15:amd64 (2.7.0-2ubuntu1) ...
Setting up ocl-icd-libopencl1:amd64 (2.2.14-3) ...
Setting up libhwloc-dev:amd64 (2.7.0-2ubuntu1) ...
Setting up libhwloc-plugins:amd64 (2.7.0-2ubuntu1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.3) ...
Processing triggers for man-db (2.10.2-1) ...

Now if you try to run ./configure_cmake.sh script again then it should work as expected as it worked on my system. This should solve your error as well.

cyberithub@ubuntu:~/snort3-3.1.71.0$ ./configure_cmake.sh
./configure_cmake.sh: 486: [: Illegal number:
Build Directory : build
Source Directory: /home/cyberithub/snort3-3.1.71.0
-- The CXX compiler identification is Clang 14.0.0
-- The C compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libdaq>=3.0.12'
-- Found libdaq, version 3.0.12
-- Found DAQ: /usr/local/lib/libdaq.so
-- Checking for module 'libdaq_static_afpacket'
-- Found libdaq_static_afpacket, version 3.0.12
-- Checking for module 'libdaq_static_fst'
-- Found libdaq_static_fst, version 3.0.12
-- Checking for module 'libdaq_static_gwlb'
-- Found libdaq_static_gwlb, version 3.0.12
-- Checking for module 'libdaq_static_savefile'
-- Found libdaq_static_savefile, version 3.0.12
-- Checking for module 'libdaq_static_trace'
-- Found libdaq_static_trace, version 3.0.12
-- Found DNET: /usr/include
-- Found FLEX: /usr/bin/flex (found suitable version "2.6.4", minimum required is "2.6.0")
-- Checking for module 'hwloc'
-- Found hwloc, version 2.7.0
-- Found HWLOC: /usr/lib/x86_64-linux-gnu/libhwloc.so
...........................................
Ubuntu Server Admin

Recent Posts

How is Livepatch safeguarded against bad actors?

Canonical Livepatch is a security patching automation tool which supports reboot-less security updates for the…

11 hours ago

Accelerating data science with Apache Spark and GPUs

Apache Spark has always been very well known for distributing computation among multiple nodes using…

11 hours ago

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

1 day ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

1 day ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

1 day ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago