Compile bug: FreeBSD ggml vulkan compilation issue
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- operating-systems
Research direction
The build fails at ggml/src/ggml-vulkan/ggml-vulkan-comm.cpp line 370, where fcntl(fd, F_DUPFD_CLOEXEC, 0) is called on FreeBSD and the constant is undeclared. Check which headers that file includes, and whether F_DUPFD_CLOEXEC is available under the platform guards used elsewhere in the file. Done when the file compiles on FreeBSD without changing behaviour on Linux or macOS. The issue names PR #25051 as the source of the change.
Written by the indexing model from the issue text.
Description
Git commit
cd8427d018c07eefab6c110f7f115c31ec4c6157
Operating systems
Other? (Please let us know in description)
GGML backends
Vulkan
Problem description & steps to reproduce
Can not compile
/zfast/github/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-comm.cpp:370:69: error: use of undeclared identifier 'F_DUPFD_CLOEXEC' 370 | const int imp_fd = fd < 0 || i == last ? fd : fcntl(fd, F_DUPFD_CLOEXEC, 0); | ^~~~~~~~~~~~~~~ 1 error generated.
OS uname -a:
reeBSD devmach 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n290301-c7523e8cfbd0: Thu Oct 22 17:23:36 CEST 2026 root@jrepo-cur-znver4:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64
PR #25051
@pwilkin could you take a look ?
First Bad Commit
dcbb0916772195bee457d23751edf8c1cbdc707e
Compile command
#!/bin/tcsh
setenv MY_BUILD_DIR "build-${1}"
echo "MY_BUILD_DIR: $MY_BUILD_DIR"
rm -rf $MY_BUILD_DIR
# -march=native -mtune=native -O3 -Ofast -ffast-math -funroll-loops -fno-math-errno -fno-trapping-math \
# -funsafe-math-optimizations -fassociative-math -fno-signed-zeros -fomit-frame-pointer -flto=auto -DNDEBUG
# broken:
# -ffast-math
# may broke code:
# -fno-semantic-interposition
# -funsafe-math-optimizations
setenv CFLAGS "-march=native -mtune=native -O3 -DNDEBUG -fno-strict-aliasing"
# -Ofast -fomit-frame-pointer -flto=auto -fno-signed-zeros \
# -funsafe-math-optimizations -fno-trapping-math -fno-math-errno \
# -fno-strict-aliasing
# cmake -B build \
# -DCMAKE_C_COMPILER=clang18 \
# -DCMAKE_CXX_COMPILER=clang++18 \
# -DCMAKE_C_COMPILER_LAUNCHER=ccache \
# -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
# -DCMAKE_LINKER=ld.lld
setenv CC clang23
setenv CXX clang++23
cmake -B ${MY_BUILD_DIR} \
-DCMAKE_C_FLAGS="${CFLAGS}" \
-DCMAKE_CXX_FLAGS="${CFLAGS}" \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DGGML_LTO=ON \
-DGGML_NATIVE=ON \
-DGGML_AVX2=ON \
-DGGML_AVX512=ON \
-DGGML_AVX512_BF16=ON \
-DGGML_AVX512_VBMI2=ON \
-DGGML_AVX512_VBMI=ON \
-DGGML_AVX512_VNNI=ON \
-DGGML_SSE42=ON \
-DGGML_FMA=ON \
-DGGML_F16C=ON \
-DGGML_BMI2=ON \
-DGGML_OPENMP=ON \
-DGGML_ACCELERATE=ON \
-DGGML_CPU_ACCELERATE=ON \
-DGGML_CPU=ON \
-DGGML_CPU_REPACK=ON \
-DGGML_VULKAN=ON \
-DGGML_BUILD_TESTS=OFF \
-DLLAMA_BUILD_TESTS=OFF
# -DGGML_CUDA_FA_ALL_QUANTS=ON
# -DLLAMA_BUILD_EXAMPLES=OFF
# -DGGML_BLAS=ON
# -DGGML_BLAS_VENDOR=OpenBLAS
# -DGGML_CPU_REPACK=ON
# -DGGML_AVX=OFF
# -DGGML_BLAS_VENDOR=Blis
cmake --build ${MY_BUILD_DIR} --config Release -j 32
Relevant log output
zfast/github/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-comm.cpp:370:69: error: use of undeclared identifier 'F_DUPFD_CLOEXEC'
370 | const int imp_fd = fd < 0 || i == last ? fd : fcntl(fd, F_DUPFD_CLOEXEC, 0);
| ^~~~~~~~~~~~~~~
1 error generated.
- Dominant language
- C++
- Stars
- 133k
- Forks
- 25.1k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 495
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ggml-org/llama.cpp
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
ggml-org/llama.cpp#31601 · 1 comment ·
Maintainers usually reply within 1 day
-
Compile bug: tools/server/server-context.cpp fails to compile with Intel icx/icpx: std::setw missing <iomanip> includePossibly taken @afnan-mojumder claimed this 3 days ago. Openbug-unconfirmed
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ggml-org/llama.cpp#31458 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
ggml-org/llama.cpp#31456 · 2 comments ·
Maintainers usually reply within 1 day
-
Misc. bug: Sub-heading levels are incorrect for the CUDA, MUSA, and SYCL sections in the Docker documentationPossibly taken A pull request linked to this issue is open or already merged. Openbug-unconfirmed
Difficulty 1/5 Under an hour Newbie friendliness 85/100
ggml-org/llama.cpp#31404 · 1 comment ·
Maintainers usually reply within 1 day
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
All issues in ggml-org/llama.cpp
Similar issues
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutPossibly taken @Spockkk0225 claimed this today. Openci
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
alibaba/neug#1195 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SCIInstitute/SCIRun#2909 ·
Maintainers usually reply within 2 days
-
area: packaging blocked dependencies P3: low post-stable value: medium
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
patrick-hudson/put.gd-desktop#1210 ·
Maintainers usually reply within 1 day