Makefile:
SO_NAME := libgstnvvideo4linux2.so
TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
NVDS_VERSION:=6.1
ifeq ($(TARGET_DEVICE),aarch64)
GST_INSTALL_DIR?=/usr/lib/aarch64-linux-gnu/gstreamer-1.0/
LIB_INSTALL_DIR?=/usr/lib/aarch64-linux-gnu/tegra/
LIBS:= -lnvbuf_utils -lnvbufsurface
else
GST_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/gst-plugins/
LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/
CFLAGS:= -DUSE_V4L2_TARGET_NV_CODECSDK=1
LIBS:= -lnvbufsurface
endif
SRCS := $(wildcard *.c)
INCS:= $(wildcard *.h)
INCLUDES += -I…/include
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-I…/…/include
PKGS := gstreamer-1.0
gstreamer-base-1.0
gstreamer-video-1.0
gstreamer-allocators-1.0
glib-2.0
libv4l2
OBJS := $(SRCS:.c=.o)
CFLAGS += -fPIC
-DEXPLICITLY_ADDED=1
-DGETTEXT_PACKAGE=1
-DHAVE_LIBV4L2=1
-DUSE_V4L2_TARGET_NV=1
pkg-config --cflags $(PKGS)
-I/usr/local/cuda-11.6/include
-I/usr/include/gstreamer-1.0
-I/opt/nvidia/deepstream/deepstream-6.1/sources/includes
-I/opt/nvidia/deepstream/deepstream-6.1/sources/libs \
LDFLAGS = -Wl,–no-undefined -L$(LIB_INSTALL_DIR) -Wl,-rpath,$(LIB_INSTALL_DIR)
LIBS := -shared -Wl,-no-undefined
-L/usr/local/cuda-11.6/lib64
-lcudart
-L/lib/x86_64-linux-gnu/gstreamer-1.0
pkg-config --libs $(PKGS)
-L$(LIB_INSTALL_DIR) -lnvdsgst_helper -lnvdsgst_meta -lnvds_meta
-lnvds_infer -lnvbufsurface -lnvdsbufferpool -lnvbufsurftransform -ldl -lpthread -lyaml-cpp \
LIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_helper -lnvdsgst_meta -lnvds_meta
-lnvds_infer -lnvbufsurface -lnvbufsurftransform -lnvdsbufferpool -ldl -lpthread -lyaml-cpp
-lcuda -Wl,-rpath,$(LIB_INSTALL_DIR)
PKGS:= gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0
CFLAGS+=$(shell pkg-config --cflags $(PKGS))
LIBS+=$(shell pkg-config --libs $(PKGS))
all: $(SO_NAME)
%.o: %.c $(INCS) Makefile
$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@
$(SO_NAME): $(OBJS)
$(CC) -shared -o $(SO_NAME) $(OBJS) $(LIBS) $(LDFLAGS)
.PHONY: install
install: $(SO_NAME)
cp -vp $(SO_NAME) $(GST_INSTALL_DIR)
.PHONY: clean
clean:
rm -rf $(OBJS) $(SO_NAME)
is this makefile correct?
ed -L/opt/nvidia/deepstream/deepstream-6.1/lib/ -Wl,-rpath,/opt/nvidia/deepstream/deepstream-6.1/lib/
/bin/ld: gstv4l2bufferpool.o: in function gst_v4l2_buffer_pool_copy_buffer': gstv4l2bufferpool.c:(.text+0x96c): undefined reference to
NvBufferMemMap’
/bin/ld: gstv4l2bufferpool.c:(.text+0xa9d): undefined reference to NvBufferMemUnMap' /bin/ld: gstv4l2bufferpool.c:(.text+0xcd4): undefined reference to
ExtractFdFromNvBuffer’
/bin/ld: gstv4l2bufferpool.c:(.text+0xd95): undefined reference to NvBufferTransform' /bin/ld: gstv4l2bufferpool.o: in function
gst_v4l2_buffer_pool_import_dmabuf’:
gstv4l2bufferpool.c:(.text+0x1b1d): undefined reference to ExtractFdFromNvBuffer' /bin/ld: gstv4l2allocator.o: in function
gst_v4l2_allocator_alloc_mmap’:
gstv4l2allocator.c:(.text+0x2545): undefined reference to NvBufferGetParams' /bin/ld: gstv4l2allocator.o: in function
gst_v4l2_allocator_dqbuf’:
gstv4l2allocator.c:(.text+0x45cd): undefined reference to `NvBufferGetSize’
collect2: error: ld returned 1 exit status
make: *** [Makefile:86: libgstnvvideo4linux2.so] Error 1
I am facing these linker issues while compiling the plugin .