Bug 286625 - devel/onetbb: Fails to build, fatal error: 'hwloc.h' file not found
Summary: devel/onetbb: Fails to build, fatal error: 'hwloc.h' file not found
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ganael LAPLANCHE
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-06 11:56 UTC by Alastair Hogge
Modified: 2025-05-12 19:59 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (martymac)


Attachments
14.2 build log (80.21 KB, text/plain)
2025-05-06 11:56 UTC, Alastair Hogge
no flags Details
Diff between two jails, after running make configure (44.99 KB, patch)
2025-05-07 09:38 UTC, Alastair Hogge
no flags Details | Diff
devel/onetbb: Switch to pkgconfig (2.88 KB, patch)
2025-05-10 02:36 UTC, Alastair Hogge
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alastair Hogge 2025-05-06 11:56:20 UTC
Created attachment 260202 [details]
14.2 build log

Hello,

On a 15-CURRENT host, building onetbb with poudriere, within any of the current releases, results the build failing:

> =======================<phase: configure      >============================
> [...]
> -- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
> -- HWLOC target HWLOC::hwloc_2_5 doesn't exist. The tbbbind_2_5 target cannot be created
> [...]
> FAILED: src/tbbbind/CMakeFiles/tbbbind_2_0.dir/tbb_bind.cpp.o 
/ccache/libexec/ccache/c++ -D__TBBBIND_BUILD -I/wrkdirs/usr/ports/devel/onetbb/work/oneTBB-2022.1.0/src/tbbbind/../../include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing    -DNDEBUG -std=c++11 -flto=thin -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=/wrkdirs/usr/ports/devel/onetbb/work/oneTBB-2022.1.0/= -ffile-prefix-map=../oneTBB-2022.1.0/= -MD -MT src/tbbbind/CMakeFiles/tbbbind_2_0.dir/tbb_bind.cpp.o -MF src/tbbbind/CMakeFiles/tbbbind_2_0.dir/tbb_bind.cpp.o.d -o src/tbbbind/CMakeFiles/tbbbind_2_0.dir/tbb_bind.cpp.o -c /wrkdirs/usr/ports/devel/onetbb/work/oneTBB-2022.1.0/src/tbbbind/tbb_bind.cpp
/wrkdirs/usr/ports/devel/onetbb/work/oneTBB-2022.1.0/src/tbbbind/tbb_bind.cpp:31:10: fatal error: 'hwloc.h' file not found
>   31 | #include <hwloc.h>
>      |          ^~~~~~~~~
> 1 error generated.
Comment 1 Alastair Hogge 2025-05-06 19:47:13 UTC
This might be a problem with 15-CURRENT. I reverted the onetbb update (2022.1.0) to version 2022.0.0, and the build still fails.
Comment 2 Alastair Hogge 2025-05-07 07:00:42 UTC
OK, altho poudriere-testport is not passing on the current amd64/i386 releases, it passed when building for my custom 15-CURRENT host.
Comment 3 Alastair Hogge 2025-05-07 08:45:54 UTC
According to upstream[1], should the Port be using the 2_5 identifier for CMake?

> The TBBbind library has three versions: `tbbbind`, `tbbbind_2_0`, and `tbbbind_2_5`. Each of these versions is linked with the corresponding HWLOC* library version: 
> - `tbbbind` links with `HWLOC 1.11.x`
> - `tbbbind_2_0` links with `HWLOC 2.1–2.4`
> - `tbbbind_2_5` links with `HWLOC 2.5` and later

The Makefile would become:

> CMAKE_ARGS+= -DTBB_STRICT:BOOL=FALSE \
>              -DCMAKE_INSTALL_DOCDIR:PATH="${DOCSDIR}" \
>              -DCMAKE_HWLOC_2_5_LIBRARY_PATH:PATH="${LOCALBASE}/lib/libhwloc.so" \
>              -DCMAKE_HWLOC_2_5_INCLUDE_PATH:PATH="${LOCALBASE}/include"

Or, if pkgconfig is added to ${USES}, and if the -DCMAKE_HWLOC* variables are removed from ${CMAKE_ARGS}, the following,

> -- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
> -- HWLOC target HWLOC::hwloc_2_5 doesn't exist. The tbbbind_2_5 target cannot be created
> -- Performing Test LINKER_HAS_NO_AS_NEEDED
> -- Performing Test LINKER_HAS_NO_AS_NEEDED - Success
> -- HWLOC 2 dependent tests were enabled.

becomes,

> -- Checking for one of the modules 'hwloc'
> -- The tbbbind_2_5 target will be configured using the HWLOC 2.12.0

However, the build is still unable to find hwloc.h.

1: https://github.com/uxlfoundation/oneTBB/blob/v2022.1.0/cmake/README.md?plain=1#L57
Comment 4 Alastair Hogge 2025-05-07 09:36:55 UTC
I compared a default 15-CURRENT jail, to my custom 15-CURRENT jail, specifically, the contents of ${POUDRIERE_JAIL}/wrkdirs/usr/ports/devel/onetbb/work/.build. The .build directory was created from "make configure". Some files of interest,

> build/CMakeFiles/3.31.7/CMakeCCompiler.cmake
> build/CMakeFiles/3.31.7/CMakeCXXCompiler.cmake

The custom jail contains:
> set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/clang/19/include;/usr/include")
> set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/v1;/usr/lib/clang/19/include;/usr/include")

The default jails contains:
> set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/local/include;/usr/lib/clang/19/include;/usr/include")
> set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/local/include;/usr/include/c++/v1;/usr/lib/clang/19/include;/usr/include")

I do not know how, that the custom jail can complete the build successfully, when the correct include director is not set, and the default jail, fails, even tho CMake is configured with the correct directories.

I also noticed that, the default, does not have any pkg-config strings, like the custom jail does.

In,
> build/CMakeFiles/*

Some interesting configuration is found. The default jail is full of 
> -isystem /usr/local/include
> ignoring duplicate directory "/usr/local/include"
> ignore line: [ignoring duplicate directory "/usr/local/include"]
> ignore line: [ /usr/local/include]


> #include <...> search starts here:
>         /usr/local/include

>          found start of implicit include info
>          add: [/usr/local/include]

> collapse include dir [/usr/local/include] ==> [/usr/local/include]
while the custom jail has none of that.

The default jail will contain:
> implicit include dirs: [/usr/local/include;/usr/include/c++/v1;/usr/lib/clang/19/include;/usr/include]
while the custom jail will contain:
> implicit include dirs: [/usr/include/c++/v1;/usr/lib/clang/19/include;/usr/include]

build/build.ninja custom:
> INCLUDES = -I/wrkdirs/usr/ports/devel/onetbb/work/oneTBB-2022.1.0/src/tbbbind/../../include -isystem /usr/local/include -isystem /usr/local/include/libxml2 -isystem /usr/local/libdata/pkgconfig/../../include

build/build.ninja default:
> INCLUDES = -I/wrkdirs/usr/ports/devel/onetbb/work/oneTBB-2022.1.0/src/tbbbind/../../include -isystem /usr/local/include/libxml2

I do not know why Ninja is producing this incorrect INCLUDES, it also does not contain the pkg-config strings.
Comment 5 Alastair Hogge 2025-05-07 09:38:59 UTC
Created attachment 260234 [details]
Diff between two jails, after running make configure

This is the diff between the two build directories, created from make configure. Each jail is of 15-CURRENT, one, is meant to be sanatised default, the other is a custom jail for a desktop.
Comment 6 Alastair Hogge 2025-05-07 10:51:06 UTC
I fixed the builds locally by adding localbase, and pkgconfig to ${USES}; removing the DCMAKE_HWLOC_2_LIBRARY_PATH* variables from ${CMAKE_ARGS}, and updating the pkg-plist to reflect the use of hwloc > 2.5.

Seeing as how this is problem is not appearing on pkg fallout, I wonder if it is genuine problem?
Comment 7 Ganael LAPLANCHE freebsd_committer freebsd_triage 2025-05-07 11:10:30 UTC
Hello Alastair,

Thanks for your report.

Maybe not a genuine problem... I've tried to reproduce it on a fresh -CURRENT poudriere jail but could not (it builds fine). I'll investigate more, stay tuned.
Comment 8 Alastair Hogge 2025-05-07 11:28:47 UTC
(In reply to Ganael LAPLANCHE from comment #7)

After updating the Ports tree today (roughly 24 hours between updates, I think), there are other Ports that use Ninja, that are also failing. Every once in a while, this happens with Ninja, often someone else commits a fix.
Comment 9 Alastair Hogge 2025-05-10 02:36:44 UTC
Created attachment 260306 [details]
devel/onetbb: Switch to pkgconfig

So I made a patch anyways, in case there is interest in moving to pkg-config, and updating the generate OneTTB bindings to hwloc-2.5+. I also did some Makefile housekeeping.

* Configure the Port to use pkg-config over tuning CMake, add localbase,
  and pkgconfig to ${USES}, drop CMAKE_HWLOC_2_LIBRARY_PATH* from
  ${CMAKE_ARGS}; this allows the build to correctly generate bindings
  for hwloc > 2.5
* port{clippy|fmt|lint} maintenance
* Update ${LIB_DEPENDS} to current practices; remove shared library
  version

poudriere-testport devel/onetbb:
main-amd64-default: Pass
main-i386-default: Pass
13_4-amd64-release: Pass
13_4-i386-release: Pass
13_5-amd64-release: Pass
13_5-i386-release: Pass
14_2-amd64-release: Pass
14_2-i386-release: Pass
Comment 10 commit-hook freebsd_committer freebsd_triage 2025-05-12 15:03:22 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=835fa02eb9ccfb7db8648150c2b5002025686e34

commit 835fa02eb9ccfb7db8648150c2b5002025686e34
Author:     Alastair Hogge <agh@riseup.net>
AuthorDate: 2025-05-12 15:00:54 +0000
Commit:     Ganael LAPLANCHE <martymac@FreeBSD.org>
CommitDate: 2025-05-12 15:02:18 +0000

    devel/onetbb: Switch to pkgconfig

    - Configure the Port to use pkg-config over tuning CMake, add localbase,
      and pkgconfig to ${USES}, drop CMAKE_HWLOC_2_LIBRARY_PATH* from
      ${CMAKE_ARGS}; this allows the build to correctly generate bindings
      for hwloc > 2.5
    - port{clippy|fmt|lint} maintenance
    - Update ${LIB_DEPENDS} to current practices; remove shared library
      version

    PR:     286625
    Reported by:    Alastair Hogge <agh@riseup.net>

 devel/onetbb/Makefile  | 28 +++++++++++++---------------
 devel/onetbb/pkg-plist |  6 +++---
 2 files changed, 16 insertions(+), 18 deletions(-)
Comment 11 Ganael LAPLANCHE freebsd_committer freebsd_triage 2025-05-12 15:04:31 UTC
Hello Alastair,

I've just committed your patch. Thanks a lot for your contribution!

Best regards,

Ganael.
Comment 12 Alastair Hogge 2025-05-12 19:59:02 UTC
(In reply to Ganael LAPLANCHE from comment #11)

Thanks very much