Linking error with libgstrtspserver-1.0.so in GStreamer 1.20.3

Klaas Jan Russcher kjrusscher at gmail.com
Wed Sep 7 15:39:07 UTC 2022


GStreamer version 1.20.3
GStreamer build with `meson --prefix=/usr/local -Dgpl=enabled
-Dpython=enabled -Dgst-plugins-ugly:x264=enabled -Drs=enabled
-Drtsp_server=enabled -Drtsp_server:examples=enabled builddir`

I am trying to make the [RTSP server example](
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-rtsp-server/docs/README
):

```
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
int main (int argc, char *argv[])
{
  GstRTSPServer *server;
  GMainLoop *loop;
  gst_init (&argc, &argv);
  server = gst_rtsp_server_new ();
  /* make a mainloop for the default context */
  loop = g_main_loop_new (NULL, FALSE);
  /* attach the server to the default maincontext */
  gst_rtsp_server_attach (server, NULL);
  /* start serving */
  g_main_loop_run (loop);
}
```
I use the CMake, the CMakeLists.txt is:
```
cmake_minimum_required(VERSION 3.5)
set(PROJECT "TEST Server")
set(EXECUTABLE_NAME "test-server")
project(${PROJECT})
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
find_package(PkgConfig)

pkg_check_modules(GST REQUIRED
  gstreamer-1.0
  gstreamer-base-1.0
  gstreamer-audio-1.0
  gstreamer-video-1.0
  gstreamer-app-1.0
  gstreamer-rtp-1.0
  gstreamer-rtsp-1.0
  gstreamer-rtsp-server-1.0
)

INCLUDE_DIRECTORIES(
  "include"
  ${GST_INCLUDE_DIRS}
)
set(RTSP_SERVER_SOURCES
  "src/main.c"
)
add_executable(${EXECUTABLE_NAME} ${RTSP_SERVER_SOURCES})
target_link_libraries(${EXECUTABLE_NAME}
  ${GST_LIBRARIES}
)
```

## Error
This is the error that is returned when I make this small example:
```
[ 50%] Building C object CMakeFiles/test-server.dir/src/main.c.o
[100%] Linking C executable ../bin/test-server
/usr/bin/ld: /usr/local/lib/x86_64-linux-gnu/libgstrtspserver-1.0.so:
undefined reference to `gst_rtsp_connection_set_content_length_limit'
/usr/bin/ld: /usr/local/lib/x86_64-linux-gnu/libgstrtspserver-1.0.so:
undefined reference to `gst_element_request_pad_simple'
/usr/bin/ld: /usr/local/lib/x86_64-linux-gnu/libgstrtspserver-1.0.so:
undefined reference to `gst_buffer_new_memdup'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/test-server.dir/build.make:84: ../bin/test-server]
Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/test-server.dir/all]
Error 2
make: *** [Makefile:84: all] Error 2
```

My question: how can I solve this linking error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220907/23dcdc69/attachment.htm>


More information about the gstreamer-devel mailing list