Deepstream pkg-config file

So, I found a deepstream.pc file at /opt/nvidia/deepstream/deepstream-4.0/lib/pkg-config which is great, but the include path is wrong, so I can’t rely on it. I figure this is in error since the includes are found inside samples but wanted to report it so it could be fixed in the next release. Also, I mentioned it earlier, but it would be nice if the $PREFIX was something like /usr/local which pkg-config searches by default.

Hi Mdegans,
Thanks for reporting this!

^^ include path is wrong
Regarding “include path”, do you refer to “/usr/local/deepstream-4.0” ?

^^$PREFIX was something like /usr/local
Do you mean changing “prefix=/usr/local/deepstream-4.0” to “prefix=/usr/local/” ?

Thanks for the quick response, mchi

do you refer to “/usr/local/deepstream-4.0” ?

Not quite. That’s the current $PREFIX. I refer to the include path which evaluates to /usr/local/deepstream-4.0/include (see current deepstream.pc file below). The problem is the path does not exist. It should be includedir=${prefix}/sources/includes if the current $PREFIX and file locations are kept as they are.

prefix=/usr/local/deepstream-4.0
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
toolsdir=${exec_prefix}/bin

Name: NVIDIA DeepStream SDK
Description: NVIDIA DeepStream SDK
Version: 4.0
Requires: gstreamer-1.0 >= 1.14.1
Libs: -L${libdir} LIB_LIST -Wl,-rpath,${libdir}
Cflags: -I${includedir}

Re: prefix. I don’t know what your build system is, but if you are making a Debian package, my understanding is the $PREFIX should be /usr (the include path /usr/include/foo?, libdir /usr/lib/foo? and so on.)

As I’m sure you’re aware, Gstreamer plugins can go in /usr/lib/$ARCH-linux-gnu/gstreamer-1.0/ (there is already a symlink there for deepstream). GST_PLUGIN_PATH can also be amended instead to look somwhere else.

pkg-config will search these folders by default on Ubuntu x86, but it will not search /opt/… by default:

 $ pkg-config --variable pc_path pkg-config
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

So basically, if you use a $PREFIX of /usr or /usr/local (edit: .deb packages should use /usr per the docs), you’re covered automatically. Othewise PKG_CONFIG_PATH can be defined and/or amended for additional paths.

For consistency’s sake, here is where various other Nvidia projects put them:

[user@x86-hostname] -- [/usr/lib/pkgconfig]
 $ ls
accinj64-10.1.pc  cufftw-10.2.pc    nppc-10.2.pc     nppidei-10.2.pc  nppisu-10.2.pc      nvidia-ml-10.2.pc
accinj64-10.2.pc  cuinj64-10.1.pc   nppi-10.1.pc     nppif-10.1.pc    nppitc-10.1.pc      nvjpeg-10.1.pc
cublas-10.pc      cuinj64-10.2.pc   nppi-10.2.pc     nppif-10.2.pc    nppitc-10.2.pc      nvjpeg-10.2.pc
cuda-10.1.pc      curand-10.1.pc    nppial-10.1.pc   nppig-10.1.pc    npps-10.1.pc        nvrtc-10.1.pc
cuda-10.2.pc      curand-10.2.pc    nppial-10.2.pc   nppig-10.2.pc    npps-10.2.pc        nvrtc-10.2.pc
cudart-10.1.pc    cusolver-10.1.pc  nppicc-10.1.pc   nppim-10.1.pc    nvToolsExt-10.1.pc
cudart-10.2.pc    cusolver-10.2.pc  nppicc-10.2.pc   nppim-10.2.pc    nvToolsExt-10.2.pc
cufft-10.1.pc     cusparse-10.1.pc  nppicom-10.1.pc  nppist-10.1.pc   nvgraph-10.1.pc
cufft-10.2.pc     cusparse-10.2.pc  nppicom-10.2.pc  nppist-10.2.pc   nvgraph-10.2.pc
cufftw-10.1.pc    nppc-10.1.pc      nppidei-10.1.pc  nppisu-10.1.pc   nvidia-ml-10.1.pc

If I had my wish, that’s where deepstream-4.0.pc would go.

edit: lastly, i just discovered there seems to be no .pc for the aarch64 build – at least not where the x86-64 .pc is.

1 Like

Hi mdegans,
Got, we have an internal ticket to track this improvement.
Will update to you once we have progress.

Thanks!

Hey. So I noticed that there is no pkg-config at all in deepstream-5.0

  • Is the plan to abandon pkg-config support?
  • If this is the case, what is the suggested workflow when using a build system like CMake to find deepstream’s headers, libraries, etc?

Hi @mdegans
We will discuss internally and give you update later.
Thanks!

1 Like

Thanks. I really don’t care what format you decide on, but figuring out everything manually is sometimes time-consuming, and it adds a lot of ugliness to my build files.

The pkg-config remains in deepstream-5.0 at the path /opt/nvidia/deepstream/deepstream-5.0/lib/pkg-config.

However, the prefix points to /usr/local. Should it not point to /opt, considering that is where deepstream installs via the .deb?

The .pc file does not work for me, without changes.

I didn’t see it was there, since it moved, @magnusm but you’re right. The prefix should probably just be /usr/local if deepstream is going to live there (or /usr if it’s going ot be in /usr), and /opt/nvidia/deepstream/deepstream-5.0/ if it’s not moving anywhere. Likewise the actual .pc file can be installed to a search path for pkg-config, or PKG_CONFIG_PATH appended.

a (probably) working example for those who read this thread:

prefix=/opt/nvidia/deepstream/deepstream-5.0/
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/sources/includes
toolsdir=${exec_prefix}/bin

Name: DeepStream
Description: NVIDIA DeepStream SDK
Version: 5.0
Requires: gstreamer-1.0 >= 1.14.1
Libs: -L${libdir} -Wl,-rpath,${libdir}
Cflags: -I${includedir}

You’ll also have to add -lnvds_meta (or whatever) to your linker flags if you’re linking to that library, for example, but at least with the .pc you don’t have to clutter up your build files with a bunch of paths. You should be able to just save the above as deepstream.pc and stick it in someplace like /usr/local/share/pkgconfig. If anybody tests this and it doesn’t work for you, lmk so i can amend it. Hopefully by the GA release a working .pc will be added (and tested).

1 Like

Yeah that .pc looks like similar to what I had earlier, but I decided to use CMake’s find_package instead, which achieves a similar thing.

Here’s my FindNVDS.cmake:

# Select install dir using provided version.
SET(NVDS_INSTALL_DIR /opt/nvidia/deepstream/deepstream-${NVDS_FIND_VERSION})

# List all libraries in deepstream.
SET(NVDS_LIBS
  nvdsgst_meta
  nvds_meta)

# Find all libraries in list.
foreach(LIB ${NVDS_LIBS})
  find_library(${LIB}_PATH NAMES ${LIB} PATHS ${NVDS_INSTALL_DIR}/lib)
  if(${LIB}_PATH)
    set(NVDS_LIBRARIES ${NVDS_LIBRARIES} ${${LIB}_PATH})
  else()
    message(FATAL ERROR " Unable to find lib: ${LIB}")
    set(NVDS_LIBRARIES FALSE)
    break()
  endif()
endforeach()

# Find include directories.
find_path(NVDS_INCLUDE_DIRS
  NAMES
    nvds_version.h
  HINTS
    ${NVDS_INSTALL_DIR}/sources/includes
)

# Check libraries and includes.
if (NVDS_LIBRARIES AND NVDS_INCLUDE_DIRS)
  set(NVDS_FOUND TRUE)
else()
  message(FATAL ERROR " Unable to find NVDS")
endif()

1 Like

Thanks for sharing that. I may try it out next time I make a CMake based DeepStream project. You might consider putting that on your GitHub.