Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbingham/77694777b9bfdf67be8d6ed35e6904b9 to your computer and use it in GitHub Desktop.
Save kbingham/77694777b9bfdf67be8d6ed35e6904b9 to your computer and use it in GitHub Desktop.
From 3507214a30a9b615faf7d0998defdde69864f386 Mon Sep 17 00:00:00 2001
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Date: Sun, 30 Oct 2022 22:12:38 +0000
Subject: [PATCH] gstreamer: provider: Support builds with
GST_DISABLE_GST_DEBUG
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When the host system packages gstreamer with GST_DISABLE_GST_DEBUG defined, the
libcamera build fails due to an unused GstLibcameraProvider pointer.
[2/20] Compiling C++ object src/gstreamer/libgstlibcamera.so.p/gstlibcameraprovider.cpp.o
FAILED: src/gstreamer/libgstlibcamera.so.p/gstlibcameraprovider.cpp.o
/usr/bin/g++ -Isrc/gstreamer/libgstlibcamera.so.p -Isrc/gstreamer
-I../src/gstreamer -Iinclude -I../include -Iinclude/libcamera/ipa
-Iinclude/libcamera -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -fdiagnostics-color=always
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra
-Werror -std=c++17 -O0 -Wshadow -include
/home/tkloczko/rpmbuild/BUILD/libcamera-0.0.1/x86_64-redhat-linux-gnu/config.h
-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-fdata-sections -ffunction-sections -flto=auto -flto-partition=none
-fPIC -DLIBCAMERA_BASE_PRIVATE '-DVERSION=0.0.1' '-DPACKAGE=libcamera'
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -MD -MQ
src/gstreamer/libgstlibcamera.so.p/gstlibcameraprovider.cpp.o -MF
src/gstreamer/libgstlibcamera.so.p/gstlibcameraprovider.cpp.o.d -o
src/gstreamer/libgstlibcamera.so.p/gstlibcameraprovider.cpp.o -c
../src/gstreamer/gstlibcameraprovider.cpp
../src/gstreamer/gstlibcameraprovider.cpp: In function ‘GList* gst_libcamera_provider_probe(GstDeviceProvider*)’:
../src/gstreamer/gstlibcameraprovider.cpp:175:31: error: unused variable ‘self’ [-Werror=unused-variable]
175 | GstLibcameraProvider *self = GST_LIBCAMERA_PROVIDER(provider);
| ^~~~
cc1plus: all warnings being treated as errors
Resolve this by ensuring the pointer is only declared when GST_DISABLE_GST_DEBUG is not defined.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
Use of a #define wouldn't usually be my first choice here, but otherwise
we'd have to do something to reimplement GST_INFO_OBJECT and
GST_ERROR_OBJECT and that doesn't seem practical in this small scenario.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
src/gstreamer/gstlibcameraprovider.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp
index 6eb0a0eb0c40..c200b6e22e04 100644
--- a/src/gstreamer/gstlibcameraprovider.cpp
+++ b/src/gstreamer/gstlibcameraprovider.cpp
@@ -172,7 +172,9 @@ G_DEFINE_TYPE_WITH_CODE(GstLibcameraProvider, gst_libcamera_provider,
static GList *
gst_libcamera_provider_probe(GstDeviceProvider *provider)
{
+#ifndef GST_DISABLE_GST_DEBUG
GstLibcameraProvider *self = GST_LIBCAMERA_PROVIDER(provider);
+#endif
std::shared_ptr<CameraManager> cm;
GList *devices = nullptr;
gint ret;
--
2.34.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment