diff --git a/fix-ppc64.patch b/fix-ppc64.patch new file mode 100644 index 0000000..92d0421 --- /dev/null +++ b/fix-ppc64.patch @@ -0,0 +1,42 @@ +From: Antonio Larrosa +Subject: Work around what seems to be a gcc bug only happening in ppc64/ppc64le + +When building code like: +constexpr Duration defaultMinFrameDuration = 1.0s / 30.0; +or +constexpr Duration controllerMinFrameDuration = 1.0s / 60.0; + +gcc 11.1.1 is giving this error: + +[ 235s] In file included from ../include/libcamera/base/log.h:10, +[ 235s] from ../src/ipa/raspberrypi/raspberrypi.cpp:18: +[ 235s] ../src/ipa/raspberrypi/raspberrypi.cpp:64:53: in ‘constexpr’ expansion of ‘std::chrono::operator/, double>(std::literals::chrono_literals::operator""s(1.0e+0l), 3.0e+1)’ +[ 235s] /usr/include/c++/11/chrono:710:39: error: ‘(1.0e+0l / 3.0e+1)’ is not a constant expression +[ 235s] 710 | return __cd(__cd(__d).count() / __s); +[ 235s] | ~~~~~~~~~~~~~~~~~~^~~~~ +[ 235s] ../src/ipa/raspberrypi/raspberrypi.cpp:73:56: in ‘constexpr’ expansion of ‘std::chrono::operator/, double>(std::literals::chrono_literals::operator""s(1.0e+0l), 6.0e+1)’ + +This change works around it to let it build fine. + +Index: libcamera-0~2809.e0704e97/src/ipa/raspberrypi/raspberrypi.cpp +=================================================================== +--- libcamera-0~2809.e0704e97.orig/src/ipa/raspberrypi/raspberrypi.cpp ++++ libcamera-0~2809.e0704e97/src/ipa/raspberrypi/raspberrypi.cpp +@@ -61,7 +61,7 @@ using utils::Duration; + /* Configure the sensor with these values initially. */ + constexpr double defaultAnalogueGain = 1.0; + constexpr Duration defaultExposureTime = 20.0ms; +-constexpr Duration defaultMinFrameDuration = 1.0s / 30.0; ++const Duration defaultMinFrameDuration = 1.0s / 30.0; + constexpr Duration defaultMaxFrameDuration = 250.0s; + + /* +@@ -70,7 +70,7 @@ constexpr Duration defaultMaxFrameDurati + * we rate-limit the controller Prepare() and Process() calls to lower than or + * equal to this rate. + */ +-constexpr Duration controllerMinFrameDuration = 1.0s / 60.0; ++const Duration controllerMinFrameDuration = 1.0s / 60.0; + + LOG_DEFINE_CATEGORY(IPARPI) + diff --git a/libcamera.changes b/libcamera.changes index e2fda5b..6e1e45f 100644 --- a/libcamera.changes +++ b/libcamera.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Aug 27 18:03:48 UTC 2021 - Antonio Larrosa + +- Add patch to work around what seems to be a bug in gcc 11 with + constexpr being treated as "non const" only in ppc64/ppc64le: + * fix-ppc64.patch + ------------------------------------------------------------------- Fri Jul 23 17:38:10 UTC 2021 - Marcus Rueckert diff --git a/libcamera.spec b/libcamera.spec index 46fbf6e..35ce9b7 100644 --- a/libcamera.spec +++ b/libcamera.spec @@ -28,6 +28,7 @@ URL: http://libcamera.org/ Source: %name-%version.tar.xz Source1: baselibs.conf Patch1: vers.diff +Patch2: fix-ppc64.patch BuildRequires: boost-devel BuildRequires: c++_compiler BuildRequires: libQt5Core-devel @@ -96,7 +97,11 @@ libcamera is an experimental camera user-space API. This is its integration plugin for gstreamer. %prep -%autosetup -p1 +%autosetup -p1 -N +%patch1 -p1 +%ifarch ppc64 ppc64le +%patch2 -p1 +%endif %build export CFLAGS="%optflags -Wno-error"