[libcamera-devel] [PATCH] src/ipa/raspberrypi/raspberrypi.cpp: drop constexpr for division
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Oct 15 19:15:20 CEST 2021
Hi Fabrice,
Thank you for the patch.
On Fri, Oct 15, 2021 at 07:02:32PM +0200, Fabrice Fontaine wrote:
> For an unknown reason, build fails with some embedded toolchains since
> commit 92b8ccc42a0f3ad323c79bde3c132d6956011239 on:
>
> In file included from ../include/libcamera/base/log.h:10,
> from ../src/ipa/raspberrypi/raspberrypi.cpp:18:
> ../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)'
> /home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/powerpc64-buildroot-linux-gnu/include/c++/9.3.0/chrono:502:32: error: '(1.0e+0l / 3.0e+1)' is not a constant expression
> 502 | return __cd(__cd(__d).count() / __s);
> ../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)'
> /home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/powerpc64-buildroot-linux-gnu/include/c++/9.3.0/chrono:502:32: error: '(1.0e+0l / 6.0e+1)' is not a constant expression
This seems like it could be a toolchain bug. Does it work with newer gcc
versions on powerpc64 ?
Given that RPi is an ARM64 platform, I'd rather disable compilation of
RPi support on powerpc64 instead of possibly harming the main user.
> So drop constexpr for both divisions to fix this build failure.
>
> Fixes:
> - http://autobuild.buildroot.org/results/49caebe7ef7e3d63de49e78d5d6839dd0aedf10c
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
> ---
> src/ipa/raspberrypi/raspberrypi.cpp | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index fed82e22..8ffb7092 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/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;
> +Duration defaultMinFrameDuration = 1.0s / 30.0;
> constexpr Duration defaultMaxFrameDuration = 250.0s;
>
> /*
> @@ -70,7 +70,7 @@ constexpr Duration defaultMaxFrameDuration = 250.0s;
> * we rate-limit the controller Prepare() and Process() calls to lower than or
> * equal to this rate.
> */
> -constexpr Duration controllerMinFrameDuration = 1.0s / 60.0;
> +Duration controllerMinFrameDuration = 1.0s / 60.0;
>
> LOG_DEFINE_CATEGORY(IPARPI)
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list