Undefined reference to `nvds_meta_api_get_type'

Hi,

I’m getting strange linking errors with the following code:

#include "gstnvdsmeta.h"
auto type = nvds_meta_api_get_type();
[build] ../AdInter/libgstadinter.so: undefined reference to `nvds_meta_api_get_type'
[build] collect2: error: ld returned 1 exit status

My library is yet linked to both libnvds_meta.so and libnvdsgst_meta.so.

Oddly, in the same file, nvds_meta_get_info and gst_buffer_get_nvds_meta also don’t work, but gst_buffer_get_nvds_batch_meta works !

Any idea why this error occurs ?

Thanks.

• Hardware Platform : Jetson
• DeepStream Version : 5 (it was also the case on DS.4)
• JetPack Version 4.4 DP
• TensorRT Version 7.1

Hi
You need to link metada library to your code.

Hi,

Thanks for your response, but you might want to read over my question.

As I said, my code is already linked to the metadata library.
The gst_buffer_get_nvds_batch_meta function even works !
But not nvds_meta_get_info or gst_buffer_get_nvds_meta, which are also declared in gstnvdsmeta.h.

Bump.

Can you please try to reproduce the behavior ? I’m pretty sure this is a bug.

Hi
Could you specify how could I repro your issue? Is that possible to share one workable test code to repro?

Of course:

Here’s main.cpp :

#include <gst/gst.h>
#include "gstnvdsmeta.h"

int
main (int argc, char *argv[])
{
    // does compile
    GstBuffer* buf = gst_buffer_new();
    gst_buffer_get_nvds_batch_meta(buf);

    // does not compile (linking issue)
    nvds_meta_get_info();
    return 0;
}

And the corresponding Makefile (adapted from deepstream-user-metadata-test) :

APP:= nvds-meta-test

TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)

NVDS_VERSION:=5.0

INCLUDES_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/sources/includes
LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/

ifeq ($(TARGET_DEVICE),aarch64)
  CFLAGS:= -DPLATFORM_TEGRA
endif

SRCS:= $(wildcard *.c)

INCS:= $(wildcard *.h)

PKGS:= gstreamer-1.0

OBJS:= $(SRCS:.c=.o)

CFLAGS+= -I$(INCLUDES_INSTALL_DIR)

CFLAGS+= `pkg-config --cflags $(PKGS)`

LIBS:= `pkg-config --libs $(PKGS)`

LIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_meta -lnvds_meta \
       -Wl,-rpath,$(LIB_INSTALL_DIR)

all: $(APP)

%.o: %.c $(INCS) Makefile
	$(CC) -c -o $@ $(CFLAGS) $<

$(APP): $(OBJS) Makefile
	$(CC) -o $(APP) $(OBJS) $(LIBS)

clean:
	rm -rf $(OBJS) $(APP)

Hi
I have reproed your issue, will file one bug, thanks for your patience.

Thanks !

Don’t forget that it’s not only nvds_meta_get_info, but also gst_buffer_get_nvds_meta, and maybe other functions I didn’t try.