@zen you are right, I am mistaken, after looking at Nvidia website it is said that even gcc 15 is supported by CUDA 13.0. Tbh I was using gcc 14 previously and it did build fine. But the patch I believe should be added to solve sm_50 architecture detection (now it's, for me with Ampere, Enabling CUDA support for dlib. DLIB WILL USE CUDA, compute capabilities: 86), but I believe it can be built with even gcc 15 so no need to isntall gcc14 even from AUR or anywhere. It builds nicely without chroot and with GCC 15 with that patch applied in my laptop.
Search Criteria
Package Base Details: python-dlib
Package Actions
| Git Clone URL: | https://aur.archlinux.org/python-dlib.git (read-only, click to copy) |
|---|---|
| Submitter: | u1bmoW1r16 |
| Maintainer: | zen |
| Last Packager: | zen |
| Votes: | 17 |
| Popularity: | 0.98 |
| First Submitted: | 2016-10-27 15:05 (UTC) |
| Last Updated: | 2026-01-19 10:29 (UTC) |
Packages (2)
gregory112 commented on 2026-02-01 11:39 (UTC)
zen commented on 2026-01-29 08:25 (UTC)
I build with gcc14 in a clean chroot. It can build.
gregory112 commented on 2026-01-29 02:44 (UTC)
@wondermr I had to add options=('!lto' '!strip' '!debug') as there were some errors when installing _dlib_pybind11 so file missing debugging symbols. However, you are right, GCC 13 is not officially supported for CUDA 13. Your patch also fixes the sm code as previously dlib was always built with sm_50. I tried with Python 3.14 and gcc13 from AUR and it builds successfully, howdy is also able to use it too.
wondermr commented on 2026-01-26 10:06 (UTC) (edited on 2026-01-26 12:39 (UTC) by wondermr)
Fixed build with CUDA 13.x and GCC 14+:
- Enforced GCC 13 (CUDA 13 is incompatible with default GCC 14/15).
- Fixed CMake 4.x compatibility (FindCUDA removal workaround via CMP0146).
- Dropped obsolete sm_50 support (removed in CUDA 13) and added GPU architecture auto-detection.
# Maintainer: Zen Wen <zen.8841@gmail.com>
# Maintainer: Jingbei Li <i@jingbei.li>
# Contributor: Lev Velykoivanenko <velykoivanenko dot lev at gmail dot com>
# Contributor: Flávio Zavan <flavio dot zavan at gmail dot com>
# Contributor: pingplug
# Contributor: perlawk
# Contributor: xsmile
#
# CUDA 13.x fixes:
# - gcc13 required (CUDA 13.x incompatible with GCC 14+)
# - CMAKE_POLICY_DEFAULT_CMP0146=OLD (cmake 4.x removed FindCUDA)
# - sm_50 -> sm_XX (sm_50 dropped in CUDA 13.x)
#
# Set DLIB_CUDA_COMPUTE_CAP env var to override GPU arch (default: auto-detect or 86)
_build_cpu=1
_build_cuda=1
pkgbase=python-dlib
[[ $_build_cpu -eq 1 ]] && pkgname+=('python-dlib')
[[ $_build_cuda -eq 1 ]] && pkgname+=('python-dlib-cuda')
_pkgname=dlib
pkgver=20.0
pkgrel=3
pkgdesc="Dlib is a general purpose cross-platform C++ library designed using contract programming and modern C++ techniques."
arch=('x86_64')
url="http://www.dlib.net/"
license=('BSL-1.0')
depends=('cblas' 'ffmpeg' 'giflib' 'lapack' 'libjpeg-turbo' 'libjxl' 'libpng' 'libx11')
makedepends=('boost' 'cmake' 'python-setuptools' 'sqlite')
[[ $_build_cuda -eq 1 ]] && makedepends+=('cuda' 'cudnn' 'gcc13')
optdepends=('sqlite')
source=("https://github.com/davisking/dlib/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('705749801c7896f5c19c253b6be639f4cef2c1831a9606955f01b600b3d86d80')
[[ $_build_cuda -eq 1 ]] && options=(!lto)
# Detect GPU compute capability
_get_cuda_arch() {
if [[ -n "$DLIB_CUDA_COMPUTE_CAP" ]]; then
echo "$DLIB_CUDA_COMPUTE_CAP"
elif command -v nvidia-smi &>/dev/null; then
nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '.'
else
echo "86"
fi
}
prepare() {
cd "$srcdir/"
if [[ $_build_cuda -eq 1 ]]; then
cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-cuda"
cd "${_pkgname}-${pkgver}-cuda"
local cuda_arch=$(_get_cuda_arch)
echo "Patching for CUDA compute capability: sm_${cuda_arch}"
# Patch 1: Update default CUDA compute capability in main CMakeLists.txt
sed -i "s/DLIB_USE_CUDA_COMPUTE_CAPABILITIES 50/DLIB_USE_CUDA_COMPUTE_CAPABILITIES ${cuda_arch}/g" \
dlib/CMakeLists.txt
# Patch 2: Add CMAKE_POLICY_DEFAULT_CMP0146 to CUDA_TEST_CMAKE_FLAGS
sed -i '/set(CUDA_TEST_CMAKE_FLAGS/,/)/s|)$| "-DCMAKE_POLICY_DEFAULT_CMP0146=OLD")|' \
dlib/CMakeLists.txt
# Patch 3: Fix sm_50 in test_for_cuda (CUDA 13.x dropped sm_50)
sed -i "s/-arch=sm_50/-arch=sm_${cuda_arch}/g" \
dlib/cmake_utils/test_for_cuda/CMakeLists.txt
# Patch 4: Fix sm_50 in test_for_cudnn
sed -i "s/-arch=sm_50/-arch=sm_${cuda_arch}/g" \
dlib/cmake_utils/test_for_cudnn/CMakeLists.txt
fi
}
build_python-dlib() {
cd "${srcdir}/${_pkgname}-${pkgver}"
python setup.py build --no DLIB_USE_CUDA
}
build_python-dlib-cuda() {
cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
local cuda_arch=$(_get_cuda_arch)
echo "Building with CUDA compute capability: sm_${cuda_arch}"
export CC=/usr/bin/gcc-13
export CXX=/usr/bin/g++-13
export CUDAHOSTCXX=/usr/bin/g++-13
python setup.py build \
--set DLIB_USE_CUDA=ON \
--set DLIB_USE_CUDA_COMPUTE_CAPABILITIES="${cuda_arch}" \
--set CMAKE_POLICY_DEFAULT_CMP0146=OLD \
--set CUDA_HOST_COMPILER=/usr/bin/gcc-13 \
--set CMAKE_C_COMPILER=/usr/bin/gcc-13 \
--set CMAKE_CXX_COMPILER=/usr/bin/g++-13 \
--set USE_AVX_INSTRUCTIONS=ON
}
build() {
if [[ $_build_cpu -eq 1 ]]; then build_python-dlib; fi
if [[ $_build_cuda -eq 1 ]]; then build_python-dlib-cuda; fi
}
package_python-dlib() {
depends+=('python')
cd "${srcdir}/${_pkgname}-${pkgver}"
python setup.py install --skip-build --prefix=/usr --root="$pkgdir" --optimize=1
}
package_python-dlib-cuda() {
depends+=('cuda' 'cudnn' 'python')
provides=('python-dlib')
conflicts=('python-dlib')
cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
python setup.py install --skip-build --prefix=/usr --root="$pkgdir" --optimize=1
}
DestroyedLife commented on 2026-01-15 08:12 (UTC)
The PKGBUILD on this needs to be amended to remove the specific call to gcc-14 and g++-14. These are unnecessary and are creating a hard dependency on a specific version of a package for no reason (which because gcc-14 is in the AUR, also means you have to build the entire GCC suite from source, which is a complete waste of time.)
openmindead commented on 2026-01-12 10:31 (UTC)
As of now there's no need to make gcc-14 a hard dependency, just delete "-14" from g++ and gcc from build_python-dlib-cuda(). Current gcc15 worked just fine.
pblague commented on 2025-12-24 01:37 (UTC)
Yes, please add gcc14 as a make dependency to the make file. Thank you!
nathawat_a commented on 2025-10-29 09:07 (UTC) (edited on 2025-10-29 09:08 (UTC) by nathawat_a)
The current version of GCC is 15, but the PKGBUILD still uses GCC-14. If the user does not manually install GCC-14, the build will fail.
This change ensures the build process works even if GCC-14 is not manually installed.
-makedepends=('other-dependencies')
+makedepends=('gcc14' 'other-dependencies')
Velocifyer commented on 2025-10-21 20:37 (UTC)
This needs to have gcc14 as a (make?) dependancy.
micwoj92 commented on 2025-06-10 23:53 (UTC)
Please use spdx license identifier.
Pinned Comments
petronny commented on 2024-03-30 13:11 (UTC) (edited on 2024-03-30 13:13 (UTC) by petronny)
Set
_build_cpuand_build_cudato 1 and 0 to build or not build the CPU or CUDA version.If
options=(!lto)has no effect, please check if it's still enabled in/etc/makepkg.conf.petronny commented on 2023-11-28 04:57 (UTC)
Prebuilt binaries of this package can be found in arch4edu.