Skip to content

Commit

Permalink
graphics/darktable: Build explicitly with GCC 12.x on FreeBSD 12.x
Browse files Browse the repository at this point in the history
On FreeBSD 12.x, it looks like GCC 13+ is incompatible with the version
of libcxx. In the case of darktable, this leads to the following compile
time error:

    In file included from /usr/include/c++/v1/__functional/weak_result_type.h:16,
                     from /usr/include/c++/v1/__functional/invoke.h:14,
                     from /usr/include/c++/v1/__functional_base:15,
                     from /usr/include/c++/v1/string:520,
                     from .../work/darktable-4.4.2/src/external/rawspeed/src/librawspeed/common/ChecksumFile.h:23,
                     from .../work/darktable-4.4.2/src/external/rawspeed/src/librawspeed/common/ChecksumFile.cpp:21:
    /usr/include/c++/v1/type_traits:1770:8: error: expected identifier before '__is_convertible'
     1770 | struct __is_convertible
          |        ^~~~~~~~~~~~~~~~

I have no idea if it is possible to fix or work around this problem in
darktable itself. Thus, on FreeBSD 12.x, we pin the version of GCC to
12. This way, once GCC 13+ bescomes the default version, darktable can
still be built on FreeBSD 12.x, even though the user may have to install
two versions of GCC.

For FreeBSD 13.x and onward, the version of GCC remains unpinned in the
port and the default one will be used.

This solution was discussed with salvadore@ in the following exp-run
request:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273397

PR:		273681
  • Loading branch information
dumbbell committed Oct 1, 2023
1 parent 93a8338 commit 01cc6a2
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions graphics/darktable/Makefile
Expand Up @@ -53,8 +53,6 @@ USE_XORG= ice sm x11 xext xrandr

SHEBANG_FILES= tools/*.sh

USE_GCC= yes

CMAKE_ARGS+= -DBINARY_PACKAGE_BUILD=1 -DUSE_PORTMIDI:BOOL=OFF

CMAKE_BOOL+= BUILD_CMSTEST USE_AVIF USE_CAMERA_SUPPORT USE_HEIF \
Expand Down Expand Up @@ -98,6 +96,32 @@ TOOLS_RUN_DEPENDS= exiftool:graphics/p5-Image-ExifTool

.include <bsd.port.options.mk>

.if ${OPSYS}_${OSREL:R} == FreeBSD_12
# Darktable fails to compile with GCC 13+ on FreeBSD 12.x with the following
# error:
#
# In file included from /usr/include/c++/v1/__functional/weak_result_type.h:16,
# from /usr/include/c++/v1/__functional/invoke.h:14,
# from /usr/include/c++/v1/__functional_base:15,
# from /usr/include/c++/v1/string:520,
# from .../work/darktable-4.4.2/src/external/rawspeed/src/librawspeed/common/ChecksumFile.h:23,
# from .../work/darktable-4.4.2/src/external/rawspeed/src/librawspeed/common/ChecksumFile.cpp:21:
# /usr/include/c++/v1/type_traits:1770:8: error: expected identifier before '__is_convertible'
# 1770 | struct __is_convertible
# | ^~~~~~~~~~~~~~~~
#
# This seems to be an incompatibility between GCC 13+ and libcxx provided with
# FreeBSD 12.x. The workarounbd is to force the use of GCC 12 on this version
# of FreeBSD.
#
# See:
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273397
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273681
USE_GCC= 12
.else
USE_GCC= yes
.endif

.if ${ARCH} == aarch64 || ${ARCH} == powerpc64le
CMAKE_ARGS+= -DUSE_OPENCL:BOOL=OFF
CXXFLAGS+= -DGDK_DISABLE_DEPRECATED
Expand Down

0 comments on commit 01cc6a2

Please sign in to comment.