Skip to contentSkip to conversation

motion: fix build failure due to missing drmGetVersion() and drmFreeVersion()

PATCH New Giulio Benetti 2 participants 4 messages Sep 9, 2018 – Sep 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 motion: fix build failure due to missing drmGetVersion() and drmFreeVersion()

During static linking -ldrm is listed too early respect -lavutil. This cause build failure.

Append extra -ldrm at the tail of $(LIBS) list.

Fixes:
http://autobuild.buildroot.net/results/395/395be1a9cab824b82ef34c2ebd84d54243029b33//

---
 ...-fix-static-linking-for-ldrm-library.patch | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 package/motion/0002-Makefile.in-fix-static-linking-for-ldrm-library.patch
package/motion/0002-Makefile.in-fix-static-linking-for-ldrm-library.patch new file +30 -0
new file mode 100644
index 0000000000..591cca66eb
@@ -0,0 +1,30 @@
+From 7098dafaf297d70bb73a5320bdc522b66c456a56 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Sun, 9 Sep 2018 20:30:33 +0200
+Subject: [PATCH] Makefile.in: fix static linking for -ldrm library
+
+While linking statically -ldrm library is listed too early than -lavutil.
+
+Append additional -ldrm entry to linker $(LIBS) list.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 94c7d40..5cfb490 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -39,7 +39,7 @@ CFLAGS       = @CFLAGS@ -Wall \
+ 	 -DMOTIONDOCDIR=\"$(DESTDIR)$(docdir)\"    \
+ 	 @FFMPEG_CFLAGS@ @MMAL_CFLAGS@
+ LDFLAGS      = @LDFLAGS@
+-LIBS         = @LIBS@  @MMAL_LIBS@ @FFMPEG_LIBS@
++LIBS         = @LIBS@ @FFMPEG_LIBS@ @MMAL_LIBS@ -ldrm
+ OBJ          = motion.o logger.o conf.o draw.o jpegutils.o \
+ 			   video_loopback.o video_v4l2.o video_common.o video_bktr.o \
+ 			   netcam.o netcam_http.o netcam_ftp.o netcam_jpeg.o netcam_wget.o \
+-- 
+2.17.1
+
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 motion: fix build failure due to missing drmGetVersion() and drmFreeVersion()

Hello,09/09/2018 21:33, Giulio Benetti ha scritto:

Quoted 34 lines

During static linking -ldrm is listed too early respect -lavutil. This cause build failure.

Append extra -ldrm at the tail of $(LIBS) list.

Fixes:
http://autobuild.buildroot.net/results/395/395be1a9cab824b82ef34c2ebd84d54243029b33//

---
  ...-fix-static-linking-for-ldrm-library.patch | 30 +++++++++++++++++++
  1 file changed, 30 insertions(+)

create mode 100644 package/motion/0002-Makefile.in-fix-static-linking-for-ldrm-library.patch

package/motion/0002-Makefile.in-fix-static-linking-for-ldrm-library.patch new file +14 -0
new file mode 100644
index 0000000000..591cca66eb
@@ -0,0 +1,30 @@
+From 7098dafaf297d70bb73a5320bdc522b66c456a56 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Sun, 9 Sep 2018 20:30:33 +0200
+Subject: [PATCH] Makefile.in: fix static linking for -ldrm library
+
+While linking statically -ldrm library is listed too early than -lavutil.
+
+Append additional -ldrm entry to linker $(LIBS) list.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/motion/0002-Makefile.in-fix-static-linking-for-ldrm-library.patch line 24

Quoted 10 lines
package/motion/0002-Makefile.in-fix-static-linking-for-ldrm-library.patch new file +10 -0
+diff --git a/Makefile.in b/Makefile.in
+index 94c7d40..5cfb490 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -39,7 +39,7 @@ CFLAGS       = @CFLAGS@ -Wall \
+ 	 -DMOTIONDOCDIR=\"$(DESTDIR)$(docdir)\"    \
+ 	 @FFMPEG_CFLAGS@ @MMAL_CFLAGS@
+ LDFLAGS      = @LDFLAGS@
+-LIBS         = @LIBS@  @MMAL_LIBS@ @FFMPEG_LIBS@
++LIBS         = @LIBS@ @FFMPEG_LIBS@ @MMAL_LIBS@ -ldrm

As pointed here:
https://github.com/Motion-Project/motion/pull/800
It makes more sense to fix at FFmpeg level the variable FFMPEG_LIBS. Otherwise this bug will keep coming out again and again. So please discard this patch and I'm going to fix on ffmpeg package.

Thanks
Giulio Benetti

#2 lore raw

PATCH 1/1 motion: fix build failure due to missing drmGetVersion() and drmFreeVersion()

In reply to Giulio Benetti

Hello,

Quoted 9 lines · Giulio Benetti

During static linking -ldrm is listed too early respect -lavutil. This cause build failure.

Append extra -ldrm at the tail of $(LIBS) list.

Fixes:
http://autobuild.buildroot.net/results/395/395be1a9cab824b82ef34c2ebd84d54243029b33//

This fix should not be needed: the configure.ac script is using pkg-config to detect ffmpeg libraries, and pkg-config should return the right libraries.

In addition, your patch will badly break the build: ffmpeg is only an optional dependency of motion, and DRM support in ffmpeg itself is optional, so the patch is clearly wrong.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 motion: fix build failure due to missing drmGetVersion() and drmFreeVersion()

Hello,

Il 10/09/2018 09:21, Thomas Petazzoni ha scritto:

Quoted 8 lines

Hello,

Quoted 5 lines · Giulio Benetti

During static linking -ldrm is listed too early respect -lavutil. This cause build failure.

Append extra -ldrm at the tail of $(LIBS) list.

Quoted 8 lines
Quoted 4 lines

Fixes:
http://autobuild.buildroot.net/results/395/395be1a9cab824b82ef34c2ebd84d54243029b33//

This fix should not be needed: the configure.ac script is using pkg-config to detect ffmpeg libraries, and pkg-config should return the right libraries.

Now I'm understanding pkg-config, the root cause is in ffmpeg where in libavutil.pc there is not -ldrm appended.
This way every package linking with -lavutil *statically* is going to fail. I've fixed something like this with this patch:
https://github.com/buildroot/buildroot/commit/daf7dd87f4d93923df5e757fd43b3ad214a4a2ae

But it was only a workaround.
I'm going to send a patch to fix once for all this ffmpeg lack. Before I check if there's an upstream patch.

Quoted 4 lines

In addition, your patch will badly break the build: ffmpeg is only an optional dependency of motion, and DRM support in ffmpeg itself is optional, so the patch is clearly wrong.

You're right.

Thanks and
Best regards
Giulio Benetti