From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 045434BFA5 for ; Mon, 28 Jul 2025 02:20:57 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7F61468D442; Mon, 28 Jul 2025 05:20:53 +0300 (EEST) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 65171687B78 for ; Mon, 28 Jul 2025 05:20:47 +0300 (EEST) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-75bd436d970so2377617b3a.3 for ; Sun, 27 Jul 2025 19:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753669245; x=1754274045; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=4Vngga2MY1byEM48OmUzjUyh6egn5IPGZwJJil3/960=; b=Y2r+4931WU/oRMnBwtPpWvujPnkYsG2DAkHwjjYum0uJeE5L1IvlflxqkZ/f5He+qr Kqklf6AilAY7vAAz5DQPEKJlKBpCf757uIbiTh8Pk7RuKPpCnELH71X0NsOfnMyFwId1 QEuqEDCJEQV+i+DFiHlMVhiJ+HvNUWMpzyiFr0nYHW09GJCmjfowZvEoRDPS6UiWr4l8 99Q4kw52AgTj6uyD7NunO3S/GeTYz9WLbuCB0QPrQf53T0CBmwOBxubRGJtyAY2ckXz2 YcVC2x5ASK5S7E9ow0nrvqAssZ0eLpKEuKYwcrY73lf2STyhV3BNhJImA+BtjxsSbvOJ V4xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753669245; x=1754274045; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4Vngga2MY1byEM48OmUzjUyh6egn5IPGZwJJil3/960=; b=QqC9xaoyXZ3nuB9C5j9rxTMiDHd9hev7W3zkvQxHCKdpztlCe9GU6R54jd3lj2qlNk 3J2S41o/x4quog0RfqxqE83GT9qe2ubi77DRjALAGLjfWyKdS0VgP6gNOKY/ck4au7/5 KjLkuv3eX39aV6+JOPYi5VtJhCA5MBM9Z79rCW3pcb0tgHkwObnu+jpTg6Nb8HdAny/m Y9BhxSdBprguw0s9dvIORPF0UGljTOCcmtxG3IYhW2ZUAnnAftPyxFzYCQXfOMvQZSvL iwS5hKT5h/M3bBfZ5wqBAjkMnmc9IFOsjmHeoVIR+HhYe7VvqH9NzeI7Gl7Q3AHcNvN5 GqVQ== X-Gm-Message-State: AOJu0YwMH15bgcuezdBcjHPZuggCPeMIxrGlCKatYohzX3sO6UeXadnH 3V0Gy+c14eqysEVd/X1O0m4CZ95/azp9g2NKBSE1uFe550qZw4omsdPrqLZJDQ== X-Gm-Gg: ASbGncv1VsCua+ijaydxnX+sAwnk3oh3BGZOEozvSZX4cZfObM8IOeTQzGLhDoONr4e z0gQ4tMYVsfhJiz0V3XxGufjXi3pMUfEeV1l/gqI/vtH3v8HxeEC27I88vIGhWALY0wuzTQng54 ebT/DvTnQ8UnD35TKdvzpZAhB6IHf/O9FSxhtX/wuAt/mqNd26im84x+cDbZZJ3qxvfc+9Qjpk3 TBD7b5oYJsaoiUz150FLyW/OIGUX93xcoluN81YCYcfbGk2NmoQEZWsc0XgBKHYdDjKeIU8M5p+ HC+t6BkQUJwrwK98cwxloPQS+Caj4QmhTn6DwGOHsWJpkgy71EvedgW6XMWj0Ppyhmp+pKqfR7k 22W7xFaClr6wof8fSe1g7ooHP5iT9DQ== X-Google-Smtp-Source: AGHT+IFNhb9gTzjqisREgY33EFGL1kQG+uwjwCTpJmNKu0W38Udz3syfZk9xVJWug0T3YXcb4v1cag== X-Received: by 2002:a05:6a00:22ca:b0:74b:4dcc:a150 with SMTP id d2e1a72fcca58-7633276cc84mr14243287b3a.6.1753669245044; Sun, 27 Jul 2025 19:20:45 -0700 (PDT) Received: from [192.168.1.72] ([187.36.165.21]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-767c8b53dd3sm1015435b3a.138.2025.07.27.19.20.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jul 2025 19:20:44 -0700 (PDT) Message-ID: <16244ec8-956c-44d5-a925-426beead798e@gmail.com> Date: Sun, 27 Jul 2025 23:20:42 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <19ac6efe-69be-438e-a87b-ca9c91ab9290@gmail.com> Content-Language: en-US From: Daniel Bermond Autocrypt: addr=danielbermond@gmail.com; keydata= xsBNBFdxiMkBCADLGEJIsXwGZtwUtXQ4EfgnbcYSL048OIkLHZa9fEKkiIE7FuliD0SgRphq oHbw4Q8C5TtbttxKAglg3elkLsoEmE1qa4d8rRGU2Foys35BJHEe2LoqV8jjtkNP2bvsnNYk yksi0iLUebCJ8C3QNw7jNa8BsFtXCFQ1H1eixcduxk6rXAa0igK6FlES+cz3/8xjp4W2x+iG KnHXJnQDdxMUKQ+E6ms/64I7ZpqT5OTpC7b0SMkr2yhe5DmmbySqLX+deDxivybyIIrvd6Y5 Kp00X4K5PWx17Pg6ETeET4i3bzVVejrv8heotpJyvK853b7riATkb9wzYPIJKFsWe2dHABEB AAHNKERhbmllbCBCZXJtb25kIDxkYW5pZWxiZXJtb25kQGdtYWlsLmNvbT7CwJEEEwEIADsC GwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AWIQQ/+mq3tpqubMomPd4BmnR0KX2FdwUCW8IS +gIZAQAKCRABmnR0KX2Fd7wrB/wNS9qxPI8IMCMu17w8icAx9XV6JUkWF9mVupi5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To: Subject: Re: [FFmpeg-devel] [PATCH v3] avformat/avisynth: fix segfault when also compiled with libvmaf X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 7/27/25 21:34, Kacper Michajlow wrote: > On Mon, 28 Jul 2025 at 02:04, Daniel Bermond wrote: >> >> When FFmpeg is compiled with support for both avisynth and libvmaf, >> a segmentation fault occurs when using avisynth (.avs) input. >> >> This happens because both avisynthplus and vmaf have the exactly >> same C++ symbol 'Cache::~Cache()'[1][2], which is a C++ destructor. >> When using avisynth input, this destructor is also called in the >> vmaf side, although no vmaf object was created, thus causing a >> segmentation fault. >> >> Without changing this conflicting symbol in avisynthplus and/or >> vmaf upstream code, a solution is to switch the 'RTLD_LOCAL'[3] > > I'm not opposed to a workaround to the issues as an interim solution, > but has this issue been reported to upstream? Classes with such > generic names should be put in a namespace in the respective projects. Thank you for the reply. I have not reported this upstream. Both projects does not follow such rules as encapsulating classes in a unique namespaces and/or uniquely naming the classes. They simply use generic class names in the top namespace of the public API. This is their code design/style/standards, present the entire source code. The programmer/manager is supposedly to be aware of such issues in the code design stage, and yet they decided to be like this. > Additionally it would be good for those projects to be built with > -fvisibility=hidden to reduce the amount of exposed symbols and only > expose API entry points. Compiling avisynthplus with '-fvisibility=hidden' makes ffmpeg to give an error when trying to open an .avs input: 'Error opening input: Unknown error occurred' No more details when using the ffmpeg '-verbose' option. But compiling vmaf with this flag works and avoids the segfault. Not sure if this is the best solution, as this would be needed in every GNU/Linux distribution out there that uses avisynth + vmaf in ffmpeg, but surely it is another good solution. Thanks for the suggestion. > > - Kacper > >> flag for 'RTLD_DEEPBIND'[4] when calling 'dlopen()' on the >> avisynthplus library. This will make the avisynthplus symbols >> loaded by 'dlopen()' to be ahead of the symbols loaded in the >> global scope, and consequently avoid the segmentation fault by >> preventing the conflicting vmaf C++ destructor to be called. >> >> More details can be seen in the discussion of the Arch Linux bug >> report[5] about this issue. >> >> [1] https://github.com/AviSynth/AviSynthPlus/blob/v3.7.5/avs_core/core/cache.h#L62 >> [2] https://github.com/Netflix/vmaf/blob/v3.0.0/libvmaf/src/svm.cpp#L75 >> [3] https://man.archlinux.org/man/dlopen.3#RTLD_LOCAL >> [4] https://man.archlinux.org/man/dlopen.3#RTLD_DEEPBIND >> [5] https://gitlab.archlinux.org/archlinux/packaging/packages/ffmpeg/-/issues/19 >> >> Signed-off-by: Daniel Bermond >> --- >> libavformat/avisynth.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c >> index cb2be10925..bef61b4a60 100644 >> --- a/libavformat/avisynth.c >> +++ b/libavformat/avisynth.c >> @@ -120,7 +120,7 @@ typedef struct AviSynthContext { >> >> static av_cold int avisynth_load_library(AviSynthContext *avs) >> { >> - avs->avs_library.library = dlopen(AVISYNTH_LIB, RTLD_NOW | RTLD_LOCAL); >> + avs->avs_library.library = dlopen(AVISYNTH_LIB, RTLD_NOW | RTLD_DEEPBIND); >> if (!avs->avs_library.library) >> return AVERROR_UNKNOWN; >> >> -- >> 2.50.1 >> _______________________________________________ >> 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". -- Best regards, Daniel Bermond _______________________________________________ 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".