There is a problem, under Linux did not work before. Found an example of a player using gstreamer . I cloned the repository and corrected the code for working with Gstreamer-1.0, I try to make in the directory! The compilation is over, but the linker begins to swear at the absence of libraries, although they are in the system and are located in the / usr / lib / x86_64-linux-gnu / folder.

Errors:

enter image description here

enter image description here

I collect on the virtual machine. I installed the gtk2.0 packages, libgstreamer1.0-dev, libgstreamer-plugins-base1.0-dev, the actual Makefile itself

CC=gcc EXTRA_WARNINGS=-Wall -W -Wformat-nonliteral -Wcast-align -Wpointer-arith \ -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes \ -Wmissing-declarations -Winline -Wundef -Wnested-externs -Wcast- qual \ -Wshadow -Wwrite-strings -Wno-unused-parameter -Wfloat-equal - pedantic -ansi -std=c99 GST_LIBS := $(shell pkg-config --libs gstreamer-1.0 gstreamer-video-1.0) GST_CFLAGS := $(shell pkg-config --cflags gstreamer-1.0 gstreamer-video-1.0) binaries=gst-player-1.0 GTK_LIBS := $(shell pkg-config --libs gtk+-2.0) GTK_CFLAGS := $(shell pkg-config --cflags gtk+-2.0) CFLAGS := -ggdb -Wall $(EXTRA_WARNINGS) LDFLAGS := LDFLAGS := -L/usr/lib/x86_64-linux-gnu/ -L/usr/lib/x86_64-linux- gnu/gstreamer-1.0 -L/usr/lib/x86_64-linux-gnu/glib-2.0 -L/usr/lib/x86_64- linux-gnu/gtk-2.0 $(binaries): gstplayer.o gst-backend.o gst-frontend.o $(binaries): CFLAGS := $(CFLAGS) $(GTK_CFLAGS) $(GST_CFLAGS) $(binaries): LIBS := $(LIBS) $(GTK_LIBS) $(GST_LIBS) all: $(binaries) $(binaries): $(CC) $(LDFLAGS) $(LIBS) -o $@ $^ %.o:: %.c $(CC) $(CFLAGS) -o $@ -c $< 

clean:

What do I need to do to build the application from the object files and run it?

Installed packages:

enter image description here

enter image description here

enter image description here

  • text information is better to attach as text: a) easier to read; b) can be copied; c) the search works. You can correct the text of the question by clicking below the question text - aleksandr barakin

2 answers 2

You have been given a so-called diff file or patch file. In general, it must be saved to a file (arbitrary name, extension can be diff or patch). Next you need to copy this file to the source directory (very often this is the src directory or where the Makefile is). Now run the patch utility.

 patch --dry-run -i <имя файла патча> 

dry-run does not apply a patch, but does a "test". If you swear that the paths do not match, then you need to either transfer the patch file, or use the -p parameter, to which you pass the number, so that it corrects the paths. If everything is ok, then remove the dry-run and it will "patch" everything.

But if you look at the file itself, they propose to make changes in one line in a few characters.

You need to open the Makefile file and in the area of ​​17 lines to make such a replacement

 $(CC) $(LDFLAGS) $(LIBS) -o $@ $^ 

on

 $(CC) $^ $(LDFLAGS) $(LIBS) -o $@ 
  • Thanks for the clarifications! I changed the make-file, the error remained. Apparently somewhere a conflict with libraries. I created a file with the patch extension, launched it — this is what happened: Checking file Makefile Hunk # 1 failed at 17 1 out of 1 Hunk failed. And by the way, did so - gcc -Wall (мои сырцы) -o (выходные) 'pkg-config --cflags --libs gdk gtk+-2.0 glib-2.0 gobject-2.0 gstreamer-1.0' , the same sadness. - JDo
  • I looked carefully - the code uses gstreamer of a very old version, which is no longer compatible with api. - KoVadim
  • It turns out that 1.0 and higher is no longer applicable without rewriting the code? - JDo
  • I found a forky example, there seems to be support for the version above github.com/jamesbond3142/gst-player/blob/james/gst-backend.c. It’s compiled, but it has started to swear at some references. - JDo
  • In general, I corrected the source code, the project was successfully compiled, but the link did not work, citing the lack of libraries. I forcibly LDFLAGS := -L/usr/lib/x86_64-linux-gnu/ -L/usr/lib/x86_64-linux-gnu/gstreamer-1.0 -L/usr/lib/x86_64-linux-gnu/glib-2.0 -L/usr/lib/x86_64-linux-gnu/gtk-2.0 paths into the makefile file: LDFLAGS := -L/usr/lib/x86_64-linux-gnu/ -L/usr/lib/x86_64-linux-gnu/gstreamer-1.0 -L/usr/lib/x86_64-linux-gnu/glib-2.0 -L/usr/lib/x86_64-linux-gnu/gtk-2.0 Still the same problem. - JDo

Everything worked with this makefile:

 CC=gcc EXTRA_WARNINGS=-Wall -W -Wformat-nonliteral -Wcast-align -Wpointer-arith \ -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes \ -Wmissing-declarations -Winline -Wundef -Wnested-externs -Wcast- qual \ -Wshadow -Wwrite-strings -Wno-unused-parameter -Wfloat-equal - pedantic -ansi -std=c99 GST_LIBS=`pkg-config --libs gstreamer-1.0` -lgstvideo-1.0 GST_CFLAGS=`pkg-config --cflags gstreamer-1.0` GTK_LIBS=`pkg-config --libs gtk+-2.0` GTK_CFLAGS=`pkg-config --cflags gtk+-2.0` CFLAGS=-ggdb $(EXTRA_WARNINGS) BINS=gst-player_os all: $(BINS) -player_os: gstplayer.c gst-backend.c gst-frontend.c $(CC) $+ $(CFLAGS) $(GTK_CFLAGS) $(GTK_LIBS) $(GST_CFLAGS) $(GST_LIBS) - o $@ clean: rm -rf $(BINS)