diff mbox series

[OpenWrt-Devel] rules.mk: remove "$(STAGING_DIR)/include"

Message ID 20191101091829.GA16215@darth.lan
State Accepted
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel] rules.mk: remove "$(STAGING_DIR)/include" | expand

Commit Message

Sebastian Kemper Nov. 1, 2019, 9:18 a.m. UTC
"$(STAGING_DIR)/include" was carried over from buildroot-ng to OpenWrt
in commit 60c1f0f64d23003a19a07d6b9638542130f6641d. buildroot has
dropped this directory a long time ago.

In OpenWrt the directory is still created by the PrepareStaging macro
and is part of the default TARGET_CPPFLAGS. But nothing at all installs
headers into this directory, nor should anything be installed under this
path.

Removing this directory from TARGET_CPPFLAGS will cut down the log noise
a bit. Not only will CPPFLAGS be shorter, there will be less warnings
set off by "-Wmissing-include-dirs" (or even failures when paired with
"-Werror"). After all the directory does not even _exist_ in the SDKs,
which are used on the build bots when building packages (see [1] and
[2]).

make[8]: Entering directory '/builder/shared-workdir/build/sdk/build_dir/target-aarch64_generic_musl/libmbim-1.20.0/src/common'
  CC       libmbim_common_la-mbim-common.lo
cc1: error: /builder/shared-workdir/build/sdk/staging_dir/target-aarch64_generic_musl/include: No such file or directory [-Werror=missing-include-dirs]
cc1: all warnings being treated as errors

[1] https://github.com/openwrt/packages/issues/10377
[2] https://github.com/openwrt/packages/pull/10378

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
---
 rules.mk       | 2 +-
 tools/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.23.0

Comments

Jo-Philipp Wich Nov. 1, 2019, 9:21 a.m. UTC | #1
Hi,

[...]

> Removing this directory from TARGET_CPPFLAGS will cut down the log noise
> a bit. Not only will CPPFLAGS be shorter, there will be less warnings
> set off by "-Wmissing-include-dirs" (or even failures when paired with
> "-Werror"). After all the directory does not even _exist_ in the SDKs,
> which are used on the build bots when building packages (see [1] and
> [2]).

[...]

> Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>

Acked-by: Jo-Philipp Wich <jo@mein.io>


I wanted to look into this for a long time but never had the motivation
to actually do comprehensive tests of the impacts of the removal.

So, thanks for looking into that - its fine from my side.

~ Jo
Rosen Penev Nov. 1, 2019, 7:06 p.m. UTC | #2
On Fri, Nov 1, 2019 at 2:21 AM Jo-Philipp Wich <jo@mein.io> wrote:
>
> Hi,
>
> [...]
>
> > Removing this directory from TARGET_CPPFLAGS will cut down the log noise
> > a bit. Not only will CPPFLAGS be shorter, there will be less warnings
> > set off by "-Wmissing-include-dirs" (or even failures when paired with
> > "-Werror"). After all the directory does not even _exist_ in the SDKs,
> > which are used on the build bots when building packages (see [1] and
> > [2]).
Would it also make sense to remove $(STAGING_DIR)/lib ? Locally, it
seems libpam gets installed there (probably a bug).
>
> [...]
>
> > Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
>
> Acked-by: Jo-Philipp Wich <jo@mein.io>
>
>
> I wanted to look into this for a long time but never had the motivation
> to actually do comprehensive tests of the impacts of the removal.
>
> So, thanks for looking into that - its fine from my side.
>
> ~ Jo
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Sebastian Kemper Nov. 1, 2019, 7:21 p.m. UTC | #3
On Fri, Nov 01, 2019 at 12:06:39PM -0700, Rosen Penev wrote:
> Would it also make sense to remove $(STAGING_DIR)/lib ? Locally, it
> seems libpam gets installed there (probably a bug).

Quoting FHS 3.0 regarding /lib's purpose: "The /lib directory contains
those shared library images needed to boot the system and run the
commands in the root filesystem, ie. by binaries in /bin and /sbin."

I think /lib should stay.

Regards,
Seb
Rosen Penev Nov. 1, 2019, 8:04 p.m. UTC | #4
On Fri, Nov 1, 2019 at 12:21 PM Sebastian Kemper <sebastian_ml@gmx.net> wrote:
>
> On Fri, Nov 01, 2019 at 12:06:39PM -0700, Rosen Penev wrote:
> > Would it also make sense to remove $(STAGING_DIR)/lib ? Locally, it
> > seems libpam gets installed there (probably a bug).
>
> Quoting FHS 3.0 regarding /lib's purpose: "The /lib directory contains
> those shared library images needed to boot the system and run the
> commands in the root filesystem, ie. by binaries in /bin and /sbin."
>
> I think /lib should stay.
OTOH, many modern distros just symlink everything to /usr.

Anyway,

Acked-by: Rosen Penev <rosenp@gmail.com>
>
> Regards,
> Seb
Sebastian Kemper Nov. 2, 2019, 10:33 a.m. UTC | #5
On Fri, Nov 01, 2019 at 01:04:04PM -0700, Rosen Penev wrote:
> On Fri, Nov 1, 2019 at 12:21 PM Sebastian Kemper <sebastian_ml@gmx.net> wrote:
> >
> > On Fri, Nov 01, 2019 at 12:06:39PM -0700, Rosen Penev wrote:
> > > Would it also make sense to remove $(STAGING_DIR)/lib ? Locally, it
> > > seems libpam gets installed there (probably a bug).
> >
> > Quoting FHS 3.0 regarding /lib's purpose: "The /lib directory contains
> > those shared library images needed to boot the system and run the
> > commands in the root filesystem, ie. by binaries in /bin and /sbin."
> >
> > I think /lib should stay.
> OTOH, many modern distros just symlink everything to /usr.

Good morning Rosen,

I did not want to imply that OpenWrt follows FHS, I don't know about
that. I just think having /lib and /bin around makes much more sense
than /include.

Kind regards,
Seb

> Anyway,
>
> Acked-by: Rosen Penev <rosenp@gmail.com>
> >
> > Regards,
> > Seb
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/rules.mk b/rules.mk
index fbf42f725d..66ddea2883 100644
--- a/rules.mk
+++ b/rules.mk
@@ -174,7 +174,7 @@  TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3) $(call qstrip,$(
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_ASFLAGS_DEFAULT = $(TARGET_CFLAGS)
 TARGET_ASFLAGS = $(TARGET_ASFLAGS_DEFAULT)
-TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
+TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include
 TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
 ifneq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 LIBGCC_S_PATH=$(realpath $(wildcard $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC))))
diff --git a/tools/Makefile b/tools/Makefile
index 23671cba91..2f57d25525 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -123,7 +123,7 @@  define PrepareStaging
 		$(if $(QUIET),,set -x;) \
 		mkdir -p "$$dir"; \
 		cd "$$dir"; \
-		mkdir -p bin lib include stamp; \
+		mkdir -p bin lib stamp; \
 	); done
 endef