From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 92EE4471C9 for ; Thu, 28 Sep 2023 09:46:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A79C068CAED; Thu, 28 Sep 2023 12:46:17 +0300 (EEST) 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-Google-Smtp-Source: AGHT+IFtypNJVDW4LqFKgcriTanH5TXVcQHsMWrSyw5H8DD/FZPOSJCbX8HUnPbQhIHM7miJwxeWTQ== 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=20Storsj=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 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: 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) -- 2.34.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".