1
0
forked from pool/libcamera

Accepting request 914665 from home:alarrosa:branches:graphics

- 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

I'll submit it to upstream next week (on Wednesday)

OBS-URL: https://build.opensuse.org/request/show/914665
OBS-URL: https://build.opensuse.org/package/show/graphics/libcamera?expand=0&rev=24
This commit is contained in:
Jan Engelhardt 2021-08-28 13:51:22 +00:00 committed by Git OBS Bridge
parent 84e3cb681a
commit cfc045e257
3 changed files with 55 additions and 1 deletions

42
fix-ppc64.patch Normal file
View File

@ -0,0 +1,42 @@
From: Antonio Larrosa <alarrosa@suse.com>
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/<long double, std::ratio<1>, 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/<long double, std::ratio<1>, 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)

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Aug 27 18:03:48 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- 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 <mrueckert@suse.de>

View File

@ -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"