Skip to contentSkip to conversation

package/rauc: fix host build with systemd

PATCH New Bartosz Bilas 2 participants 5 messages Nov 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/rauc: fix host build with systemd

For some reason, autotools pkg infra doesn't pass DESTDIR variable to the host make env which causes errors during the package install step because it tries to install files into its own system instead of host directory.

That fixes the following errors:
/usr/bin/install -c -m 644 data/rauc.service '/usr/lib/systemd/system' /usr/bin/install: cannot create regular file '/usr/lib/systemd/system/rauc.service': Permission denied /usr/bin/install -c -m 644 data/de.pengutronix.rauc.conf 'no'
make[4]: *** [Makefile:1700: install-nodist_systemdunitDATA] Error 1
make[4]: *** Waiting for unfinished jobs....

---
 package/rauc/rauc.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/rauc/rauc.mk +4 -0
index 61c50ab316..3cd1c85ee7 100644
@@ -36,6 +36,10 @@ define RAUC_INSTALL_INIT_SYSTEMD
 		>$(TARGET_DIR)/usr/lib/systemd/system/rauc.service.d/buildroot-enable.conf
 endef
 
+HOST_RAUC_MAKE_ENV = \
+	$(HOST_MAKE_ENV) \
+	DESTDIR=$(STAGING_DIR)
+
 HOST_RAUC_DEPENDENCIES = \
 	host-pkgconf \
 	host-openssl \
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 package/rauc: fix host build with systemd

Quoted 23 lines · On Fri, 13 Nov 2020 13:26:05 +0100 Bartosz Bilas <[email protected]>…

For some reason, autotools pkg infra doesn't pass DESTDIR variable to the host make env which causes errors during the package install step because it tries to install files into its own system instead of host directory.

That fixes the following errors:
/usr/bin/install -c -m 644 data/rauc.service '/usr/lib/systemd/system' /usr/bin/install: cannot create regular file '/usr/lib/systemd/system/rauc.service': Permission denied /usr/bin/install -c -m 644 data/de.pengutronix.rauc.conf 'no'
make[4]: *** [Makefile:1700: install-nodist_systemdunitDATA] Error 1
make[4]: *** Waiting for unfinished jobs....

---
 package/rauc/rauc.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/rauc/rauc.mk +0 -0
index 61c50ab316..3cd1c85ee7 100644

package/rauc/rauc.mk define RAUC_INSTALL_INIT_SYSTEMD · line 41

Quoted 6 lines
package/rauc/rauc.mk +3 -0
@@ -36,6 +36,10 @@ define RAUC_INSTALL_INIT_SYSTEMD
 		>$(TARGET_DIR)/usr/lib/systemd/system/rauc.service.d/buildroot-enable.conf  
 endef
 
+HOST_RAUC_MAKE_ENV = \
+	$(HOST_MAKE_ENV) \
+	DESTDIR=$(STAGING_DIR)

A DESTDIR of $(STAGING_DIR) when building host-rauc doesn't seem correct. It's an autotools package, so we're passing --prefix=$(HOST_DIR) when building host-rauc. If that's not sufficient, then the rauc Makefile.am should be fixed.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/rauc: fix host build with systemd

Hi Thomas,

Quoted 37 lines · Thomas Petazzoni
Quoted 23 lines · On Fri, 13 Nov 2020 13:26:05 +0100 Bartosz Bilas <[email protected]>…

For some reason, autotools pkg infra doesn't pass DESTDIR variable to the host make env which causes errors during the package install step because it tries to install files into its own system instead of host directory.

That fixes the following errors:
/usr/bin/install -c -m 644 data/rauc.service '/usr/lib/systemd/system' /usr/bin/install: cannot create regular file '/usr/lib/systemd/system/rauc.service': Permission denied /usr/bin/install -c -m 644 data/de.pengutronix.rauc.conf 'no'
make[4]: *** [Makefile:1700: install-nodist_systemdunitDATA] Error 1
make[4]: *** Waiting for unfinished jobs....

---
  package/rauc/rauc.mk | 4 ++++
  1 file changed, 4 insertions(+)
package/rauc/rauc.mk +0 -0
index 61c50ab316..3cd1c85ee7 100644

package/rauc/rauc.mk define RAUC_INSTALL_INIT_SYSTEMD · line 41

Quoted 6 lines
package/rauc/rauc.mk +3 -0
@@ -36,6 +36,10 @@ define RAUC_INSTALL_INIT_SYSTEMD
  		>$(TARGET_DIR)/usr/lib/systemd/system/rauc.service.d/buildroot-enable.conf
  endef
 
+HOST_RAUC_MAKE_ENV = \
+	$(HOST_MAKE_ENV) \
+	DESTDIR=$(STAGING_DIR)

A DESTDIR of $(STAGING_DIR) when building host-rauc doesn't seem correct. It's an autotools package, so we're passing --prefix=$(HOST_DIR) when building host-rauc. If that's not sufficient, then the rauc Makefile.am should be fixed.

Quoted 1 line

Thanks!

ouch, I meant about HOST_DIR but I typed STAGING_DIR for some reason... Shouldn't we pass the --prefix=/usr to configure and DESTDIR=$(HOST_DIR) to make in that case?

Quoted 2 lines

Thomas

Best
Bartek

#3 lore raw

PATCH 1/1 package/rauc: fix host build with systemd

Hello,

Quoted 3 lines · On Fri, 13 Nov 2020 14:28:01 +0100 Bartosz Bilas <[email protected]>…

ouch, I meant about HOST_DIR but I typed STAGING_DIR for some reason... Shouldn't we pass the --prefix=/usr to configure and DESTDIR=$(HOST_DIR) to make in that case?

No. --prefix= is where the software will be executed from, so from host binaries it must be --prefix=$(HOST_DIR), and DESTDIR not used.

It is when you're cross-compiling that there is a difference between where the software will be executed from (--prefix) and where you install it after the build (DESTDIR). That's why when cross-compiling you have --prefix=/usr, and DESTDIR=$(TARGET_DIR) or DESTDIR=$(STAGING_DIR). This means "at runtime the software will be in /usr, but for the installation please put it in TARGET_DIR/usr".

Does that make sense ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 package/rauc: fix host build with systemd

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 3 lines · On Fri, 13 Nov 2020 14:28:01 +0100 Bartosz Bilas <[email protected]>…

ouch, I meant about HOST_DIR but I typed STAGING_DIR for some reason... Shouldn't we pass the --prefix=/usr to configure and DESTDIR=$(HOST_DIR) to make in that case?

No. --prefix= is where the software will be executed from, so from host binaries it must be --prefix=$(HOST_DIR), and DESTDIR not used.

Quoted 8 lines

It is when you're cross-compiling that there is a difference between where the software will be executed from (--prefix) and where you install it after the build (DESTDIR). That's why when cross-compiling you have --prefix=/usr, and DESTDIR=$(TARGET_DIR) or DESTDIR=$(STAGING_DIR). This means "at runtime the software will be in /usr, but for the installation please put it in TARGET_DIR/usr".

Does that make sense ?

Yes, it does. Let's reject this patch then.

Quoted 1 line

Thomas

Best
Bartek