All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
@ 2018-09-04 13:12 Giulio Benetti
  2018-09-04 20:58 ` Peter Korsgaard
  2018-09-28 12:41 ` Peter Korsgaard
  0 siblings, 2 replies; 7+ messages in thread
From: Giulio Benetti @ 2018-09-04 13:12 UTC (permalink / raw)
  To: buildroot

Autotools miss avcodec function check leading to conflicts between local
functions and avcodec functions.

Add patch to swap $FFMPEG_LIBS and -lavutil which are checked when
AC_CHECK_LIB on avcodec_* functions. $FFMPEG_LIBS contain -ldrm that must
be listed after -lavutil.

Fixes:
http://autobuild.buildroot.net/results/394/3945e06ea0dd1e16013184fbab5b67b3561c87ce/
http://autobuild.buildroot.net/results/576/576c7d71313c45753848462717200b2b8ff5bb0e/
http://autobuild.buildroot.net/results/f33/f339ac6ea30815eeb8ecb144c971f56c06a9f995

Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
---
Changes V2->V3:
* don't append -ldrm, swap $FFMPEG_LIBS with -lavutil

Changes V1->V2:
* merge -ldrm into FFMPEG_LIBS instead of repeating it thrice.

 ...ffmpeg-and-avcodec-function-conflict.patch | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 package/mediastreamer/0002-m4-fix-local-ffmpeg-and-avcodec-function-conflict.patch

diff --git a/package/mediastreamer/0002-m4-fix-local-ffmpeg-and-avcodec-function-conflict.patch b/package/mediastreamer/0002-m4-fix-local-ffmpeg-and-avcodec-function-conflict.patch
new file mode 100644
index 0000000000..cdaa0fab24
--- /dev/null
+++ b/package/mediastreamer/0002-m4-fix-local-ffmpeg-and-avcodec-function-conflict.patch
@@ -0,0 +1,42 @@
+From d12e74a559602b3dff9a6bf38fcbb139535c9c9c Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@micronovasrl.com>
+Date: Mon, 3 Sep 2018 20:27:00 +0200
+Subject: [PATCH] m4: fix local ffmpeg and avcodec function conflict
+
+Autotools miss avcodec function check.
+This is due to linker library list order, -ldrm is appended too early
+respect to -lavutil. This results in missing drm library functions for
+avcodec functions:
+- drmGetVersion()
+- drmFreeVersion()
+So these functions:
+- avcodec_get_context_defaults3
+- avcodec_open2
+- avcodec_encode_video2
+can't link correctly during check and they seem not to be present.
+Then macros HAVE_FUN_avcodec_* are not defined in mediastreamer-config.h
+So local avcodec functions conflict with real avcodec library functions.
+
+In acinclude.m4 file, swap $FFMPEG_LIBS and -lavutil if avcodec is found.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
+---
+ acinclude.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 6c31ed82..89ff6643 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -110,7 +110,7 @@ AC_DEFUN([MS_CHECK_VIDEO],[
+ 			if test x$avcodec_found = xno ; then
+ 			   AC_MSG_WARN([Could not find libavcodec (from ffmpeg) headers and library.])
+ 			else
+-			   FFMPEG_LIBS="$FFMPEG_LIBS -lavutil"
++			   FFMPEG_LIBS="-lavutil $FFMPEG_LIBS"
+ 			fi
+ 			
+ 			
+-- 
+2.17.1
+
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
  2018-09-04 13:12 [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict Giulio Benetti
@ 2018-09-04 20:58 ` Peter Korsgaard
  2018-09-04 21:34   ` Giulio Benetti
  2018-09-28 12:41 ` Peter Korsgaard
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2018-09-04 20:58 UTC (permalink / raw)
  To: buildroot

>>>>> "Giulio" == Giulio Benetti <giulio.benetti@micronovasrl.com> writes:

 > Autotools miss avcodec function check leading to conflicts between local
 > functions and avcodec functions.

 > Add patch to swap $FFMPEG_LIBS and -lavutil which are checked when
 > AC_CHECK_LIB on avcodec_* functions. $FFMPEG_LIBS contain -ldrm that must
 > be listed after -lavutil.

 > Fixes:
 > http://autobuild.buildroot.net/results/394/3945e06ea0dd1e16013184fbab5b67b3561c87ce/
 > http://autobuild.buildroot.net/results/576/576c7d71313c45753848462717200b2b8ff5bb0e/
 > http://autobuild.buildroot.net/results/f33/f339ac6ea30815eeb8ecb144c971f56c06a9f995

 > Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
 > ---
 > Changes V2->V3:
 > * don't append -ldrm, swap $FFMPEG_LIBS with -lavutil

 > Changes V1->V2:
 > * merge -ldrm into FFMPEG_LIBS instead of repeating it thrice.

Committed after extending the commit message to clarify that this is
about static linking, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
  2018-09-04 20:58 ` Peter Korsgaard
@ 2018-09-04 21:34   ` Giulio Benetti
  2018-09-04 21:56     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Giulio Benetti @ 2018-09-04 21:34 UTC (permalink / raw)
  To: buildroot

Hello Peter,

Il 04/09/2018 22:58, Peter Korsgaard ha scritto:
>>>>>> "Giulio" == Giulio Benetti <giulio.benetti@micronovasrl.com> writes:
> 
>   > Autotools miss avcodec function check leading to conflicts between local
>   > functions and avcodec functions.
> 
>   > Add patch to swap $FFMPEG_LIBS and -lavutil which are checked when
>   > AC_CHECK_LIB on avcodec_* functions. $FFMPEG_LIBS contain -ldrm that must
>   > be listed after -lavutil.
> 
>   > Fixes:
>   > http://autobuild.buildroot.net/results/394/3945e06ea0dd1e16013184fbab5b67b3561c87ce/
>   > http://autobuild.buildroot.net/results/576/576c7d71313c45753848462717200b2b8ff5bb0e/
>   > http://autobuild.buildroot.net/results/f33/f339ac6ea30815eeb8ecb144c971f56c06a9f995
> 
>   > Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
>   > ---
>   > Changes V2->V3:
>   > * don't append -ldrm, swap $FFMPEG_LIBS with -lavutil
> 
>   > Changes V1->V2:
>   > * merge -ldrm into FFMPEG_LIBS instead of repeating it thrice.
> 
> Committed after extending the commit message to clarify that this is
> about static linking, thanks.
> 

Sorry for my ignorance, so library order during linking is an issue only
with static libraries?

Best regards
Giulio Benetti

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
  2018-09-04 21:34   ` Giulio Benetti
@ 2018-09-04 21:56     ` Peter Korsgaard
  2018-09-04 22:10       ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2018-09-04 21:56 UTC (permalink / raw)
  To: buildroot

>>>>> "Giulio" == Giulio Benetti <giulio.benetti@micronovasrl.com> writes:

Hi,

 >> Committed after extending the commit message to clarify that this is
 >> about static linking, thanks.

 > Sorry for my ignorance, so library order during linking is an issue only
 > with static libraries?

Yes, when statically linking ld will only pull in the object files
containing referenced symbols, so you need to list the libraries in the
dependency order (E.G. if you call a function in library a that in turn
calls a function in library b then you must use -la -b).

For details, see
E.G. https://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
  2018-09-04 21:56     ` Peter Korsgaard
@ 2018-09-04 22:10       ` Arnout Vandecappelle
  2018-09-05  6:29         ` Giulio Benetti
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2018-09-04 22:10 UTC (permalink / raw)
  To: buildroot



On 04/09/2018 23:56, Peter Korsgaard wrote:
>>>>>> "Giulio" == Giulio Benetti <giulio.benetti@micronovasrl.com> writes:
> 
> Hi,
> 
>  >> Committed after extending the commit message to clarify that this is
>  >> about static linking, thanks.
> 
>  > Sorry for my ignorance, so library order during linking is an issue only
>  > with static libraries?
> 
> Yes, when statically linking ld will only pull in the object files
> containing referenced symbols, so you need to list the libraries in the
> dependency order (E.G. if you call a function in library a that in turn
> calls a function in library b then you must use -la -b).
> 
> For details, see
> E.G. https://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking

 Note the explanation of --start-group/--end-group, which is sometimes the
easiest way to fix a linking order issue.

 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
  2018-09-04 22:10       ` Arnout Vandecappelle
@ 2018-09-05  6:29         ` Giulio Benetti
  0 siblings, 0 replies; 7+ messages in thread
From: Giulio Benetti @ 2018-09-05  6:29 UTC (permalink / raw)
  To: buildroot

Hello all,

Il 05/09/2018 00:10, Arnout Vandecappelle ha scritto:
> 
> 
> On 04/09/2018 23:56, Peter Korsgaard wrote:
>>>>>>> "Giulio" == Giulio Benetti <giulio.benetti@micronovasrl.com> writes:
>>
>> Hi,
>>
>>   >> Committed after extending the commit message to clarify that this is
>>   >> about static linking, thanks.
>>
>>   > Sorry for my ignorance, so library order during linking is an issue only
>>   > with static libraries?
>>
>> Yes, when statically linking ld will only pull in the object files
>> containing referenced symbols, so you need to list the libraries in the
>> dependency order (E.G. if you call a function in library a that in turn
>> calls a function in library b then you must use -la -b).
>>
>> For details, see
>> E.G. https://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking
> 
>   Note the explanation of --start-group/--end-group, which is sometimes the
> easiest way to fix a linking order issue.

Thank you that clarified me a lot.
Giulio

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict
  2018-09-04 13:12 [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict Giulio Benetti
  2018-09-04 20:58 ` Peter Korsgaard
@ 2018-09-28 12:41 ` Peter Korsgaard
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2018-09-28 12:41 UTC (permalink / raw)
  To: buildroot

>>>>> "Giulio" == Giulio Benetti <giulio.benetti@micronovasrl.com> writes:

 > Autotools miss avcodec function check leading to conflicts between local
 > functions and avcodec functions.

 > Add patch to swap $FFMPEG_LIBS and -lavutil which are checked when
 > AC_CHECK_LIB on avcodec_* functions. $FFMPEG_LIBS contain -ldrm that must
 > be listed after -lavutil.

 > Fixes:
 > http://autobuild.buildroot.net/results/394/3945e06ea0dd1e16013184fbab5b67b3561c87ce/
 > http://autobuild.buildroot.net/results/576/576c7d71313c45753848462717200b2b8ff5bb0e/
 > http://autobuild.buildroot.net/results/f33/f339ac6ea30815eeb8ecb144c971f56c06a9f995

 > Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
 > ---
 > Changes V2->V3:
 > * don't append -ldrm, swap $FFMPEG_LIBS with -lavutil

 > Changes V1->V2:
 > * merge -ldrm into FFMPEG_LIBS instead of repeating it thrice.

Committed to 2018.02.x and 2018.05.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-09-28 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-04 13:12 [Buildroot] [PATCH v3] mediastreamer: fix avcodec functions conflict Giulio Benetti
2018-09-04 20:58 ` Peter Korsgaard
2018-09-04 21:34   ` Giulio Benetti
2018-09-04 21:56     ` Peter Korsgaard
2018-09-04 22:10       ` Arnout Vandecappelle
2018-09-05  6:29         ` Giulio Benetti
2018-09-28 12:41 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.