diff mbox series

package/rauc: fix host build with systemd

Message ID 20201113122605.901352-1-b.bilas@grinn-global.com
State Superseded
Headers show
Series package/rauc: fix host build with systemd | expand

Commit Message

Bartosz Bilas Nov. 13, 2020, 12:26 p.m. UTC
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....

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
---
 package/rauc/rauc.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni Nov. 13, 2020, 1:08 p.m. UTC | #1
On Fri, 13 Nov 2020 13:26:05 +0100
Bartosz Bilas <b.bilas@grinn-global.com> wrote:

> 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....
> 
> Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
> ---
>  package/rauc/rauc.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/rauc/rauc.mk b/package/rauc/rauc.mk
> index 61c50ab316..3cd1c85ee7 100644
> --- a/package/rauc/rauc.mk
> +++ b/package/rauc/rauc.mk
> @@ -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
Bartosz Bilas Nov. 13, 2020, 1:28 p.m. UTC | #2
Hi Thomas,

On 13.11.2020 14:08, Thomas Petazzoni wrote:
> On Fri, 13 Nov 2020 13:26:05 +0100
> Bartosz Bilas <b.bilas@grinn-global.com> wrote:
>
>> 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....
>>
>> Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
>> ---
>>   package/rauc/rauc.mk | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/package/rauc/rauc.mk b/package/rauc/rauc.mk
>> index 61c50ab316..3cd1c85ee7 100644
>> --- a/package/rauc/rauc.mk
>> +++ b/package/rauc/rauc.mk
>> @@ -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!
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?
>
> Thomas
Best
Bartek
Thomas Petazzoni Nov. 13, 2020, 1:33 p.m. UTC | #3
Hello,

On Fri, 13 Nov 2020 14:28:01 +0100
Bartosz Bilas <b.bilas@grinn-global.com> wrote:

> 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
Bartosz Bilas Nov. 13, 2020, 1:44 p.m. UTC | #4
Hi Thomas,

On 13.11.2020 14:33, Thomas Petazzoni wrote:
> Hello,
>
> On Fri, 13 Nov 2020 14:28:01 +0100
> Bartosz Bilas <b.bilas@grinn-global.com> wrote:
>
>> 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 ?
Yes, it does. Let's reject this patch then.
> Thomas 
Best
Bartek
diff mbox series

Patch

diff --git a/package/rauc/rauc.mk b/package/rauc/rauc.mk
index 61c50ab316..3cd1c85ee7 100644
--- a/package/rauc/rauc.mk
+++ b/package/rauc/rauc.mk
@@ -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 \