From f16219293ab74c0c9e7fa7a3d4fead322e4523b3 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Thu, 4 May 2023 19:56:18 +0200 Subject: [PATCH] rpi-libcamera-apps: fix flags used in aarch64 builds * the CMakeLists.txt recognizes only 2 values: IF (NOT ENABLE_COMPILE_FLAGS_FOR_TARGET) # On a Pi this will give us armhf or arm64. execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH OUTPUT_VARIABLE ENABLE_COMPILE_FLAGS_FOR_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE) endif() message(STATUS "Platform: ${ENABLE_COMPILE_FLAGS_FOR_TARGET}") if ("${ENABLE_COMPILE_FLAGS_FOR_TARGET}" STREQUAL "arm64") # 64-bit binaries can be fully optimised. add_definitions(-ftree-vectorize) elseif ("${ENABLE_COMPILE_FLAGS_FOR_TARGET}" STREQUAL "armv8-neon") # Only build with 32-bit Pi 3/4 specific optimisations if requested on the command line. add_definitions(-mfpu=neon-fp-armv8 -ftree-vectorize) endif() the value from dpkg-architecture on host is useless when cross-compiling, so we always need to pass something for raspberrypi4-64 we were passing "armv8-neon" which results in: aarch64-oe-linux-g++: error: unrecognized command-line option '-mfpu=neon-fp-armv8' as all -mfpu options are rejected in aarch64 builds, pass better ENABLE_COMPILE_FLAGS_FOR_TARGET value for all MACHINEs Signed-off-by: Martin Jansa --- recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb b/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb index 073105d..26565b8 100644 --- a/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb +++ b/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb @@ -26,8 +26,10 @@ EXTRA_OECMAKE = "\ -DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR} \ " -EXTRA_OECMAKE:append:raspberrypi3 = " -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon" -EXTRA_OECMAKE:append:raspberrypi4 = " -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon" +LIBCAMERA_ARCH = "${TARGET_ARCH}" +LIBCAMERA_ARCH:aarch64 = "arm64" +LIBCAMERA_ARCH:arm = "armv8-neon" +EXTRA_OECMAKE += "-DENABLE_COMPILE_FLAGS_FOR_TARGET=${LIBCAMERA_ARCH}" PACKAGECONFIG[x11] = "-DENABLE_X11=1,-DENABLE_X11=0" PACKAGECONFIG[qt] = "-DENABLE_QT=1,-DENABLE_QT=0"