Skip to content

Commit 8371547

Browse files
authored
Fix FreeBSD build failure involving threads.h, and add FreeBSD CI build (AcademySoftwareFoundation#2300)
* Fix FreeBSD build failure involving threads.h - internal_thread.h: skip <threads.h> on FreeBSD so the pthread fallback is used, avoiding -lstdthreads (fixes AcademySoftwareFoundation#2299) - Add ci_freebsd.yml: build and test on FreeBSD via vmactions/freebsd-vm Signed-off-by: Cary Phillips <cary@ilm.com> * pin freebsd-vm@v1 to sha Signed-off-by: Cary Phillips <cary@ilm.com> --------- Signed-off-by: Cary Phillips <cary@ilm.com>
1 parent 6ba3cde commit 8371547

2 files changed

Lines changed: 63 additions & 2 deletions

File tree

.github/workflows/ci_freebsd.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright (c) Contributors to the OpenEXR Project.
3+
#
4+
# Build and test on FreeBSD using a community VM action.
5+
# GitHub does not provide native FreeBSD runners; this uses vmactions/freebsd-vm.
6+
# Validates the pthread fallback in internal_thread.h (issue #2299).
7+
8+
name: CI (FreeBSD)
9+
10+
on:
11+
push:
12+
paths:
13+
- '**'
14+
- '!**.md'
15+
- '!website/**'
16+
- '!bazel/**'
17+
- '!src/wrappers/**'
18+
- '!.github/workflows/**'
19+
- '.github/workflows/ci_freebsd.yml'
20+
pull_request:
21+
paths:
22+
- '**'
23+
- '!**.md'
24+
- '!website/**'
25+
- '!bazel/**'
26+
- '!src/wrappers/**'
27+
- '!.github/workflows/**'
28+
- '.github/workflows/ci_freebsd.yml'
29+
30+
permissions:
31+
contents: read
32+
33+
jobs:
34+
freebsd:
35+
name: FreeBSD
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Build and test on FreeBSD
39+
uses: vmactions/freebsd-vm@4807432c7cab1c3f97688665332c0b932062d31f # v1
40+
with:
41+
release: '15.0'
42+
envs: GITHUB_REPOSITORY GITHUB_REF GITHUB_SHA
43+
usesh: true
44+
prepare: |
45+
pkg install -y cmake ninja git
46+
run: |
47+
set -e
48+
git clone --depth 1 "https://github.com/${GITHUB_REPOSITORY}.git" src
49+
cd src
50+
# shallow clone, only the commit that triggered the run, i.e. GITHUB_SHA
51+
git fetch --depth 1 origin "${GITHUB_SHA}"
52+
git checkout "${GITHUB_SHA}"
53+
cmake -B _build -S . -G Ninja \
54+
-DCMAKE_BUILD_TYPE=Release \
55+
-DOPENEXR_FORCE_INTERNAL_IMATH=ON \
56+
-DOPENEXR_FORCE_INTERNAL_DEFLATE=ON \
57+
-DOPENEXR_FORCE_INTERNAL_OPENJPH=ON \
58+
-DBUILD_TESTING=ON
59+
cmake --build _build
60+
ctest --test-dir _build --output-on-failure

src/lib/OpenEXRCore/internal_thread.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ call_once (once_flag* flag, void (*func) (void))
2929
{
3030
InitOnceExecuteOnce (flag, once_init_fn, (PVOID) func, NULL);
3131
}
32-
# elif __has_include(<threads.h>)
32+
# elif __has_include(<threads.h>) && !defined(__FreeBSD__)
3333
/*
34-
* On Linux (glibc 2.28+), use standard <threads.h>
34+
* On Linux (glibc 2.28+), use standard <threads.h>.
35+
* FreeBSD requires -lstdthreads for <threads.h>; use pthread fallback instead.
3536
*/
3637
# include <threads.h>
3738

0 commit comments

Comments
 (0)