From patchwork Wed May 11 16:43:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: orbea X-Patchwork-Id: 1629648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=riseup.net header.i=@riseup.net header.a=rsa-sha256 header.s=squak header.b=jfxcnNlO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kz11v4d1Qz9sCq for ; Thu, 12 May 2022 02:43:30 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nopQs-0006XA-Hw; Wed, 11 May 2022 16:43:26 +0000 Received: from mx0.riseup.net ([198.252.153.6]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nopQp-0006X1-LC for fwts-devel@lists.ubuntu.com; Wed, 11 May 2022 16:43:24 +0000 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4Kz11j5gCbz9s7W for ; Wed, 11 May 2022 09:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1652287401; bh=sZ4xnW2az9UtzwWwzU64TBPW5vOWssI6+slii55Pp8s=; h=Date:From:To:Subject:From; b=jfxcnNlORj+fS3E0kFZG6quDfjuvB7XBnn1DNYHAvpE8dnzUIUqwu3ny4V/ecfPP+ DYlJE644FAMTtToJcudwrpesV4lP3SSqSZyb+dKaRZ+dvHTScKSdw+uAz8oj5W3+XI mTFT7KwHKju3DBeJvUh3jUWFKCfHMnIKADuyAreg= X-Riseup-User-ID: 010095F27B4A0A1D0F7214B944629283869FA82F63B30B2A0C066A7BAE3B326F Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4Kz11j432qz5vwY for ; Wed, 11 May 2022 09:43:21 -0700 (PDT) Date: Wed, 11 May 2022 09:43:20 -0700 From: orbea To: fwts-devel@lists.ubuntu.com Subject: fwts-22.03.00 build fix patch Message-ID: <20220511094320.22779bf8@Akita> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Hi, When building fwts with slibtool (https://dev.midipix.org/cross/slibtool) the build fail with undefined references. This is because the build system is using -lfoo linker flags for internal dependencies instead of using the libtool archive (.la) files instead. Additionally there are several instances of hardcoded pkg-config calls and linker flags in LDFLAGS rather than LIBADD and LDADD. I attached a patch that fixes the issues by doing a few things. * Removed hardcoded pkg-config calls and replaced them with PKG_CHECK_MODULES as needed. * Clearly delimited LDFLAGS from LDADD and LIBADD. Build systems should only add non-dependency linker flags to LDFLAGS while LDADD and LIBADD should be for any required dependencies. * Removed any -lfoo linker flags for internal dependencies and added them as .la files to link the fwts binary which now uses -no-undefined. Using -lfoo linker flags should be only for external dependencies and often results in undefined errors or the linker flags entirely not found with slibtool. Slibtool is far more strict about user error than GNU libtool which often silently hides such issues. * Cleared out a few unneeded or redundant linker flags. Gentoo bug: https://bugs.gentoo.org/780372 From 47bc82375865e2548edcb1607ca52ec60d632123 Mon Sep 17 00:00:00 2001 From: orbea Date: Tue, 10 May 2022 20:35:01 -0700 Subject: [PATCH 1/2] build: Improve linking This improves the linking enough to get the build to complete with slibtool and GNU libtool. --- configure.ac | 2 ++ src/Makefile.am | 20 ++++++++++---------- src/lib/src/Makefile.am | 18 ++++++++++-------- src/libfwtsacpica/Makefile.am | 7 ++----- src/libfwtsiasl/Makefile.am | 4 ++-- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index f40c367..7ee5604 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,8 @@ AC_CHECK_HEADERS([asm/opal-prd.h]) AC_CHECK_HEADERS([mtd/mtd-abi.h]) AC_CHECK_HEADERS([pci/pci.h]) + PKG_CHECK_MODULES([GIO], [gio-2.0]) + PKG_CHECK_MODULES([GLIB], [glib-2.0]) AM_CONDITIONAL([HAVE_ASM_OPAL_PRD_H], [test "x$ac_cv_header_asm_opal_prd_h" = "xyes"]) AM_CONDITIONAL([HAVE_MTD_ABI_H], diff --git a/src/Makefile.am b/src/Makefile.am index 9a26af8..e2180e7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,7 +12,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/acpica/source/compiler \ -I$(top_srcdir)/efi_runtime \ -I$(top_srcdir)/smccc_test \ - -pthread `pkg-config --cflags glib-2.0 gio-2.0` \ + -pthread \ -Wall -Werror -Wextra \ -Wno-address-of-packed-member \ -Wfloat-equal -Wmissing-declarations \ @@ -23,7 +23,11 @@ AM_CPPFLAGS = \ bin_PROGRAMS = fwts -fwts_CPPFLAGS = $(AM_CPPFLAGS) -DACPI_DEBUG_OUTPUT +fwts_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + @GIO_CFLAGS@ \ + @GLIB_CFLAGS@ \ + -DACPI_DEBUG_OUTPUT if HAVE_LIBFDT dt_tests = \ @@ -207,16 +211,12 @@ fwts_SOURCES = main.c \ $(power_mgmt_tests) \ $(dt_tests) -fwts_LDFLAGS = -lm -lbsd `pkg-config --libs glib-2.0 gio-2.0` +fwts_LDFLAGS = -no-undefined fwts_LDADD = \ - -lfwts \ - -L$(top_builddir)/src \ - -L$(top_builddir)/src/acpica \ - -L$(top_builddir)/src/libfwtsiasl \ - -L$(top_builddir)/src/libfwtsacpica \ - -L$(top_builddir)/src/lib/src \ - -lfwtsacpica + $(top_builddir)/src/lib/src/libfwts.la \ + $(top_builddir)/src/libfwtsiasl/libfwtsiasl.la \ + $(top_builddir)/src/libfwtsacpica/libfwtsacpica.la man_MANS = ../doc/fwts.1 ../doc/fwts-collect.1 ../doc/fwts-frontend-text.1 diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am index 0a39882..94bfcdf 100644 --- a/src/lib/src/Makefile.am +++ b/src/lib/src/Makefile.am @@ -21,22 +21,24 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/libfwtsiasl \ -I$(top_srcdir)/src/acpica/source/include \ -I$(top_srcdir)/src/acpica/source/compiler \ - `pkg-config --silence-errors --cflags json` \ - `pkg-config --silence-errors --cflags json-c` \ - `pkg-config --cflags glib-2.0 gio-2.0` \ -DDATAROOTDIR=\"$(datarootdir)\" \ -Wall -Werror -Wextra \ -Wno-address-of-packed-member pkglib_LTLIBRARIES = libfwts.la -libfwts_la_LDFLAGS = \ +libfwts_la_LDFLAGS = -version-info 1:0:0 + +libfwts_la_LIBADD = \ -lm -lpthread -lbsd \ - -version-info 1:0:0 \ - -L$(top_builddir)/src/libfwtsiasl \ - -lfwtsiasl `pkg-config --libs glib-2.0 gio-2.0` + @GIO_LIBS@ \ + @GLIB_LIBS@ -libfwts_la_CPPFLAGS = $(AM_CPPFLAGS) -DACPI_DEBUG_OUTPUT +libfwts_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + @GIO_CFLAGS@ \ + @GLIB_CFLAGS@ \ + -DACPI_DEBUG_OUTPUT if HAVE_LIBFDT dt_sources = \ diff --git a/src/libfwtsacpica/Makefile.am b/src/libfwtsacpica/Makefile.am index f37f585..62f0d8c 100644 --- a/src/libfwtsacpica/Makefile.am +++ b/src/libfwtsacpica/Makefile.am @@ -74,7 +74,8 @@ CLEANFILES = osunixxf_munged.c \ pkglib_LTLIBRARIES = libfwtsacpica.la -libfwtsacpica_la_LDFLAGS = -lpthread -version-info 1:0:0 +libfwtsacpica_la_LDFLAGS = -version-info 1:0:0 +libfwtsacpica_la_LIBADD = -lpthread libfwtsacpica_la_CPPFLAGS = $(AM_CPPFLAGS) # @@ -280,8 +281,4 @@ libfwtsacpica_la_SOURCES = \ ../../src/acpica/source/tools/acpiexec/aeinstall.c \ ../../src/acpica/source/os_specific/service_layers/osgendbg.c -libfwtsacpica_la_LIBADD = \ - -L../../src/lib/src -lfwts -lrt - - -include ../../git.mk diff --git a/src/libfwtsiasl/Makefile.am b/src/libfwtsiasl/Makefile.am index 328134c..2728780 100644 --- a/src/libfwtsiasl/Makefile.am +++ b/src/libfwtsiasl/Makefile.am @@ -104,8 +104,8 @@ BUILT_SOURCES = aslcompiler.y \ # # Just export fwts specific API so we don't clash with core ACPICA library # -libfwtsiasl_la_LDFLAGS = -export-symbols-regex "fwts_.*" -lpthread -version-info 1:0:0 - +libfwtsiasl_la_LDFLAGS = -export-symbols-regex "fwts_.*" -version-info 1:0:0 +libfwtsiasl_la_LIBADD = -lpthread CLEANFILES = $(BUILT_SOURCES) libfwtsiasl_la_CPPFLAGS = $(AM_CPPFLAGS) -- 2.35.1