Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack@foxmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] libavformat\file:Fix duplicate JNI symbols
Date: Sun, 24 Mar 2024 22:59:07 +0800
Message-ID: <tencent_CC4D930B6844B3E6536C95C3891BCEB08505@qq.com> (raw)
In-Reply-To: <GV1P250MB07378DCEE871E1F5A3BAC0078F372@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>


On 2024/3/24 21:23, Andreas Rheinhardt wrote:
> admin@shaoxia.xyz:
>> From: 联盟少侠 <admin@shaoxia.xyz>
>>
>> The errors indicate that there are multiple definitions of several JNI (Java Native Interface) symbols in the FFmpeg library. Specifically, the linker ld.lld has found duplicate definitions for the following symbols:
>>
>> - ff_jni_get_env
>> - ff_jni_jstring_to_utf_chars
>> - ff_jni_utf_chars_to_jstring
>> - ff_jni_exception_get_summary
>> - ff_jni_exception_check
>> - ff_jni_init_jfields
>> - ff_jni_reset_jfields
>>
>> These symbols are defined in both libavcodec.a and libavformat.a archives, leading to conflicts during the linking process. The duplicates are found in the same source file ffjni.c, but they are being compiled into two different static libraries.
>>
>> To resolve these errors, ensure that each symbol is defined only once across all linked libraries, or if these symbols are required in both libraries, they should be marked as weak symbols to allow the linker to handle them appropriately. Additionally, check for any build script misconfigurations that may be causing the same file to be included in multiple libraries.
>> ---
>>   libavformat/file.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/file.c b/libavformat/file.c
>> index dd5819c..fa13ae9 100644
>> --- a/libavformat/file.c
>> +++ b/libavformat/file.c
>> @@ -43,7 +43,7 @@
>>   #if CONFIG_ANDROID_CONTENT_PROTOCOL
>>   #include <jni.h>
>>   #include "libavcodec/jni.h"
>> -#include "libavcodec/ffjni.c"
>> +#include "libavcodec/ffjni.h"
>>   #endif
>>   
>>   
> How can this even happen? In case of static builds with the android
> content protocol enabled, libavformat/file.o provides all the symbols
> that libavcodec/ffjni.o also provides. Given that the former is part of
> libavformat.a and this is linked before libavcodec.a, the stuff from the
> former is used and the ffjni.o in libavcodec.a should not be pulled in
> at all.
I guess the error is triggered by creating a shared library from combine 
all static libraries
via -Wl,--whole-archive. It's a common practice to reduce the number of 
shared libraries
in mobile app.
>
> - Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2024-03-24 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23 19:05 admin
2024-03-24  2:16 ` Zhao Zhili
2024-03-24  4:09   ` Zhao Zhili
2024-03-24  5:17 ` [FFmpeg-devel] [PATCH] avcodec, avformat/ffjni: fix " Leo Izen
2024-03-24 13:19   ` Matthieu Bouron
2024-03-24 13:23 ` [FFmpeg-devel] [PATCH] libavformat\file:Fix " Andreas Rheinhardt
2024-03-24 14:59   ` Zhao Zhili [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_CC4D930B6844B3E6536C95C3891BCEB08505@qq.com \
    --to=quinkblack@foxmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git