From patchwork Thu Sep 28 09:46:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 43996 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:2a18:b0:15d:8365:d4b8 with SMTP id e24csp3160899pzh; Thu, 28 Sep 2023 02:46:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaauIYordQulAiSwSugqAii4tXYlP4D7gojMBvWYPiMri4aLs8pK5jOZ8R2OP5Kil3M12v X-Received: by 2002:a17:906:191:b0:9ae:57b8:ad1b with SMTP id 17-20020a170906019100b009ae57b8ad1bmr688985ejb.21.1695894381404; Thu, 28 Sep 2023 02:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695894381; cv=none; d=google.com; s=arc-20160816; b=gts3fqA0WAK80ieuJaVsQO5YDRoLS3xvJncIdILZT8O6rwLtyhdg6bWgClvXv0yWq7 Qnj9+FJSIvkykIc0wBPB7Q6G6g/OtHCO4u/pZhmKnfocstQInblC500c5kD8c0Js/cj8 WCPg+YMJTmESWqBAbDrGD/E/r0S1s4x3jAoW/FX2wbJp+rC/AhBppOsNsKCc49/s6Wcz JOkbUxc+rB+pgeVMTZ/FaEIW+jY+S5qO+t/kEtSnBqDa1lkeSheeBzs3+CipCJU5dq6W 82jFZPYhcHgDWweJeif9fQiD/wwohbv9qJgu2ebWWZ4tAotWePcArMnKWMrPP/ajy3zT J4cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=GV4FmnAQH+IO+/Jrg5dksBPfFvyCoAhJcG13Yo7Tag4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=BR19Alty5+Gni9CJbVvYk04wP96uFf7pCHlGIHcDs4PvmUmvszCGHRrttKhOTJOIaj pFd3T6rsqYaSwH+eDYjtuzDE7cdnMUDon8lugZjo6Nxar3nnxJ41sSEzAGaBA2aW3J4A YGWRQtIPZ25c3es8vupcTfSCp5ayP1qgsL+uI0Jka2GsIw6iEdqgrcQ1AlCDV/Wi/o73 sBdztMFOlWpGMEXKFGeaFmzNKryP1oHmIZzzKJmsROVvwZH/vJhEDO4sYdKFRX/Q2y+K EfCeogzaGjqNCUoooiRZm7u+5lUyHJAYOLNS1EKS3ix4S0CnrTZB5On2CKtcViwd6279 7gQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b="YlO1P/+1"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q3-20020a170906388300b009a1990f178fsi13790632ejd.334.2023.09.28.02.46.20; Thu, 28 Sep 2023 02:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b="YlO1P/+1"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB84E68CAEE; Thu, 28 Sep 2023 12:46:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9C63168CAC8 for ; Thu, 28 Sep 2023 12:46:11 +0300 (EEST) Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2bfed7c4e6dso211686751fa.1 for ; Thu, 28 Sep 2023 02:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1695894371; x=1696499171; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=hucxuZT+x5r7XLNePkGEtUUBTHCxQmtYlwGKoZUUlJA=; b=YlO1P/+1h6/foMKI65Z72yrOzkwmM/oN3VKAhdGRpJ+yJrIr2hJZCUPAUbuZfOWno5 KVsebfaMcnUoCC1HdS+7GfcBCDybx8p1OqG6wyTGU2tcHHkV1q4YJAFSid3R+zqCgTAj AIYl3rBo1CiX7fsKaDhTNVuKauZ7xuc09bQUgsGQrDBoLZzUr581BUfehVDw3YF6ViHY 5oVcFijphAMvqnaAUlQ+ihEJoPgTZ3XQtF644Q+OqmzdwZJWnfNTWu+YzrYyqJ6xEbrq VUG3ja9qoP48c/YfRHV/ljL8iccqXNbT+I31svvIkyuN+7gZi64qPwJzFhmRvbiXrDOl y8VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695894371; x=1696499171; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hucxuZT+x5r7XLNePkGEtUUBTHCxQmtYlwGKoZUUlJA=; b=esdC2EOSMY1Q2itrz2NI83E8oRr+reIA867mwUypaIhJLur31vY/vUyWLa+ZPQU0Mn pBGXsWCaQFvVSOZ2/XsFI+rzF+JFUlRSdWmm8qb9PzXQAy9EbJPPzL7Wem1hk7YLwszY cbqU1XZAOC8zO3BTQToJRG4NhC0Ph697jCvqcXL/gSEtCvggejolrcovvJodBo3PEHWd oEzOX3ZCR2cmGkpIfZrBRV1DQ2+5BRss1vYyp6COmu5ZgGA5k+LQSpkmhdz6LXPmwrlO DX5d57niKMzd0H2q9jiGz0UbzTB3DpCiepTHBkluS0ihig/g2PO5orVDtrZx922DmKRj n86Q== X-Gm-Message-State: AOJu0YzPwKJkUNwpUQ1hBlEPoNdZ8svZwmvDXFFMk3HcCXpe1OCRNLZg erdKaYOvLGkOe3wjfMMLLkXSLR8YAB7Gjlvzchprkw== X-Received: by 2002:a2e:8912:0:b0:2bf:7dac:a41 with SMTP id d18-20020a2e8912000000b002bf7dac0a41mr801351lji.13.1695894370575; Thu, 28 Sep 2023 02:46:10 -0700 (PDT) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id n3-20020a2e9043000000b002bbacc6c523sm3609034ljg.49.2023.09.28.02.46.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 02:46:10 -0700 (PDT) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Sep 2023 12:46:09 +0300 Message-Id: <20230928094609.3744767-1-martin@martin.st> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] tools: Don't include the direct library names when linking 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: eMfUK9BCs8TI When linking the main tools, the object files to link are set up via the variable OBJS-, but for the tools, we've only used the target's list of dependencies. In most cases, this has been fine, but it has caused specifying the libraries to link in a duplicate fashion; the linking command has looked like this: $CC -Llibavutil ... tools/tool.o libavutil/libavutil.a -lavutil Normally, the libraries to link are handled with "-Llibavutil -lavutil"; when linking the main fftools, this is how they are linked. In the case of the binaries under the "tools" directory (within the make variable TOOLS), we've passed the full set of dependencies to the linker, via $^, which does contain the names of the dependency libraries as well. When libraries are built as regular static libraries, or shared unix libraries, this has all worked fine. When libraries are built as DLLs for Windows, though, the norm is not to pass the actual DLL to the linker, but an import library. Mingw tools generally can handle linking directly against a DLL as well, but MSVC tools don't support that, and error out with a very cryptic error message: libavdevice\avdevice.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D8 By omitting these parts of the dependencies, linking of these tool executables succeed in MSVC builds with shared libraries enabled. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bf1b69f96b..78652c47bd 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ FF_DEP_LIBS := $(DEP_LIBS) FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS) $(TOOLS): %$(EXESUF): %.o - $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS) target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)