error: undefined reference to 'gst_drm_dumb_allocator_get_type' on Clang 17
When compiling GStreamer's git snapshot with Clang 17, I see an error quoted in the subject. Here is the full output:
[511/3255] Generating subprojects/gst-plugins-base/gst-libs/gst/allocators/GstAllocators-1.0.gir with a custom command (wrapped by meson to set env)
FAILED: subprojects/gst-plugins-base/gst-libs/gst/allocators/GstAllocators-1.0.gir
env PKG_CONFIG_PATH=/opt/intel/oneapi/mkl/2023.2.0/lib/pkgconfig:/opt/intel/oneapi/tbb/2021.10.0/env/../lib/pkgconfig:/home/user/clang-env/share/pkgconfig:/home/user/clang-env/lib/pkgconfig:/home/user/gcc-env/share/pkgconfig:/home/user/gcc-env/lib/pkgconfig:/home/user/binutils-env/lib/pkgconfig:/home/user/libs-dev/GTK/gstreamer-build/meson-uninstalled CC=clang /home/user/clang-env/bin/g-ir-scanner --quiet --no-libtool --namespace=GstAllocators --nsversion=1.0 --warn-all --output subprojects/gst-plugins-base/gst-libs/gst/allocators/GstAllocators-1.0.gir '--add-init-section=extern void gst_init(gint*,gchar**);g_setenv("GST_REGISTRY_DISABLE", "yes", TRUE);g_setenv("GST_REGISTRY_1.0", "/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gir_empty_registry.reg", TRUE);g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);gst_init(NULL,NULL);' --quiet --c-include=gst/allocators/allocators.h -I/home/user/libs-dev/GTK/gstreamer/subprojects/gst-plugins-base/gst-libs/gst/allocators -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs/gst/allocators -I/home/user/libs-dev/GTK/gstreamer/subprojects/gst-plugins-base/. -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/. -I/home/user/libs-dev/GTK/gstreamer/subprojects/gst-plugins-base/gst-libs -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs -I/home/user/libs-dev/GTK/gstreamer/subprojects/gstreamer/. -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/. --filelist=/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs/gst/allocators/libgstallocators-1.0.so.0.2300.0.p/GstAllocators_1.0_gir_filelist --include=Gst-1.0 --symbol-prefix=gst --identifier-prefix=Gst --pkg-export=gstreamer-allocators-1.0 --cflags-begin -DG_DISABLE_DEPRECATED -I/home/user/libs-dev/GTK/gstreamer/subprojects/gst-plugins-base/. -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/. -I/home/user/libs-dev/GTK/gstreamer/subprojects/gst-plugins-base/gst-libs -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs -I/home/user/libs-dev/GTK/gstreamer/subprojects/gstreamer/. -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/. -I/home/user/libs-dev/GTK/gstreamer/subprojects/gstreamer/gst/parse -I/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst/parse -I/usr/include/libdrm -I/home/user/clang-env/include/glib-2.0 -I/home/user/clang-env/lib/glib-2.0/include -I/home/user/clang-env/include/gobject-introspection-1.0 --cflags-end --add-include-path=/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst --add-include-path=/home/user/clang-env/share/gir-1.0 -L/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst -L/home/user/clang-env/lib -L/home/user/binutils-env/lib --extra-library=gstreamer-1.0 -L/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs/gst/allocators --library gstallocators-1.0 -L/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst -L/home/user/clang-env/lib -L/home/user/binutils-env/lib --extra-library=drm --extra-library=glib-2.0 --extra-library=gobject-2.0 --extra-library=gmodule-2.0 --extra-library=m --extra-library=dl --extra-library=unwind --extra-library=dw --extra-library=elf --extra-library=girepository-1.0 --sources-top-dirs /home/user/libs-dev/GTK/gstreamer/subprojects/gst-plugins-base --sources-top-dirs /home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base
/home/user/libs-dev/GTK/gstreamer-build/tmp-introspect2vkccofq/GstAllocators-1.0.o:GstAllocators-1.0.c:GI_GET_TYPE_FUNCS_: error: undefined reference to 'gst_drm_dumb_allocator_get_type'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked, libgstallocators-1.0.so
exists and does have gst_drm_dumb_allocator_get_type:
$ objdump --syms subprojects/gst-plugins-base/gst-libs/gst/allocators/libgstallocators-1.0.so | grep gst_drm_dumb_allocator_get_type
00000000000061b0 l O .bss 0000000000000008 gst_drm_dumb_allocator_get_type.static_g_define_type_id
0000000000001c50 l F .text 000000000000007f gst_drm_dumb_allocator_get_type_once
0000000000001c00 g F .text 0000000000000045 gst_drm_dumb_allocator_get_type
Here is the command line invoked by the scanner, which is, in fact, failed:
clang -o /home/user/libs-dev/GTK/gstreamer-build/tmp-introspectyjny159h/GstAllocators-1.0 /home/user/libs-dev/GTK/gstreamer-build/tmp-introspectyjny159h/GstAllocators-1.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst -Wl,-rpath,/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst -L/home/user/clang-env/lib -Wl,-rpath,/home/user/clang-env/lib -L/home/user/binutils-env/lib -Wl,-rpath,/home/user/binutils-env/lib -L/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs/gst/allocators -Wl,-rpath,/home/user/libs-dev/GTK/gstreamer-build/subprojects/gst-plugins-base/gst-libs/gst/allocators -L/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst -Wl,-rpath,/home/user/libs-dev/GTK/gstreamer-build/subprojects/gstreamer/gst -L/home/user/clang-env/lib -Wl,-rpath,/home/user/clang-env/lib -L/home/user/binutils-env/lib -Wl,-rpath,/home/user/binutils-env/lib -lgstallocators-1.0 -lgstreamer-1.0 -ldrm -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lm -ldl -lunwind -ldw -lelf -lgirepository-1.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lglib-2.0
GCC builds without errors.