Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/nodejs: fix additional modules installation
@ 2023-10-31  9:01 Giulio Benetti
  2023-11-06 19:12 ` Marcus Hoffmann via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Giulio Benetti @ 2023-10-31  9:01 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Yann E . MORIN, Daniel Price, Thomas Petazzoni,
	Martin Bark

At the moment the npm_config_nodedir is set to the build directory but
npm nodedir must be the one on target to find the expected files. So let's
set npm_config_nodedir to $(TARGET_DIR)/usr.

Fixes:
https://bugs.busybox.net/show_bug.cgi?id=15826

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 package/nodejs/nodejs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 2a8c570932..8f86413049 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -20,7 +20,7 @@ NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
 	npm_config_arch=$(NODEJS_CPU) \
 	npm_config_target_arch=$(NODEJS_CPU) \
 	npm_config_build_from_source=true \
-	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
+	npm_config_nodedir=$(TARGET_DIR)/usr \
 	npm_config_prefix=$(TARGET_DIR)/usr \
 	npm_config_cache=$(BUILD_DIR)/.npm-cache
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/nodejs: fix additional modules installation
  2023-10-31  9:01 [Buildroot] [PATCH] package/nodejs: fix additional modules installation Giulio Benetti
@ 2023-11-06 19:12 ` Marcus Hoffmann via buildroot
  2023-11-07 21:51   ` Yann E. MORIN
  2023-11-07 15:15 ` Yann E. MORIN
  2023-11-07 21:40 ` Yann E. MORIN
  2 siblings, 1 reply; 6+ messages in thread
From: Marcus Hoffmann via buildroot @ 2023-11-06 19:12 UTC (permalink / raw)
  To: Giulio Benetti, buildroot
  Cc: Martin Bark, Yann E . MORIN, Thomas Petazzoni, Daniel Price

Thanks Guilio, this fixes our build problem!

On 31.10.23 10:01, Giulio Benetti wrote:
> At the moment the npm_config_nodedir is set to the build directory but
> npm nodedir must be the one on target to find the expected files. So let's
> set npm_config_nodedir to $(TARGET_DIR)/usr.
>
> Fixes:
> https://bugs.busybox.net/show_bug.cgi?id=15826
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Tested-by: Marcus Hoffmann <marcus.hoffmann@othermo.de>

> ---
>   package/nodejs/nodejs.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 2a8c570932..8f86413049 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -20,7 +20,7 @@ NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
>       npm_config_arch=$(NODEJS_CPU) \
>       npm_config_target_arch=$(NODEJS_CPU) \
>       npm_config_build_from_source=true \
> -     npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
> +     npm_config_nodedir=$(TARGET_DIR)/usr \
>       npm_config_prefix=$(TARGET_DIR)/usr \
>       npm_config_cache=$(BUILD_DIR)/.npm-cache
>
________________________________

othermo GmbH | Sitz der Gesellschaft: Alzenau | Amtsgericht Aschaffenburg: HRB 14783 | USt-IdNr.: DE319977978 | Geschäftsführung: Dr. Dennis Metz.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/nodejs: fix additional modules installation
  2023-10-31  9:01 [Buildroot] [PATCH] package/nodejs: fix additional modules installation Giulio Benetti
  2023-11-06 19:12 ` Marcus Hoffmann via buildroot
@ 2023-11-07 15:15 ` Yann E. MORIN
  2023-11-07 17:27   ` Yann E. MORIN
  2023-11-07 21:40 ` Yann E. MORIN
  2 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2023-11-07 15:15 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: Martin Bark, Daniel Price, Thomas Petazzoni, buildroot

Giluio, All,

On 2023-10-31 10:01 +0100, Giulio Benetti spake thusly:
> At the moment the npm_config_nodedir is set to the build directory but
> npm nodedir must be the one on target to find the expected files. So let's
> set npm_config_nodedir to $(TARGET_DIR)/usr.
> 
> Fixes:
> https://bugs.busybox.net/show_bug.cgi?id=15826
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>  package/nodejs/nodejs.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 2a8c570932..8f86413049 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -20,7 +20,7 @@ NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
>  	npm_config_arch=$(NODEJS_CPU) \
>  	npm_config_target_arch=$(NODEJS_CPU) \
>  	npm_config_build_from_source=true \
> -	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
> +	npm_config_nodedir=$(TARGET_DIR)/usr \

So, there is a first issue in the original npm_config_nodedir, as it
references NODEJS_VERSION which no longer exists since 4cbc2af604e7
(package/nodejs: rename to nodejs-src and convert to virtual package),
when we renamed the actual version variable to NODEJS_COMMON_VERSION.

This is visible in the build log of #15826:

    npm ERR! gyp WARN read config.gypi ENOENT: no such file or directory, open '/home/marcus/repos/buildroot-upstream/output/build/nodejs-/include/node/config.gypi'

Notice the /nodejs-/ part of the path: it hints that a variable is not
expanded as would be expected; in this case, the wrong variable is
expanded. (I have started a build with the variable name fixed; let's
see what happens...)

Furthermore, even though this again is an npm-mess issue, I'd like a bit
more explanations on why we need to change npm_config_nodedir now, when
it has been working so far, since it was introduced 10 years ago with
commit b31bc7d43870 (nodejs: new package). Presumably, it did work then

Maybe the explanation is just "in fact it has never worked!", and then
it would be nice to know why it never worked.

Daniel, I know it's been 10 years now, but do you happen to have some
recollection of what was going on?

Finally, I *think* your patch might be correct, but not for the good
reasons...

Regards,
Yann E. MORIN.

>  	npm_config_prefix=$(TARGET_DIR)/usr \
>  	npm_config_cache=$(BUILD_DIR)/.npm-cache
>  
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/nodejs: fix additional modules installation
  2023-11-07 15:15 ` Yann E. MORIN
@ 2023-11-07 17:27   ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2023-11-07 17:27 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: buildroot, Martin Bark, Thomas Petazzoni, Daniel Price

Giulio, All,

On 2023-11-07 16:15 +0100, Yann E. MORIN spake thusly:
> Giluio, All,

Woops, sorry for the typo... :-(

> On 2023-10-31 10:01 +0100, Giulio Benetti spake thusly:
> > At the moment the npm_config_nodedir is set to the build directory but
> > npm nodedir must be the one on target to find the expected files. So let's
> > set npm_config_nodedir to $(TARGET_DIR)/usr.
> > 
> > Fixes:
> > https://bugs.busybox.net/show_bug.cgi?id=15826
> > 
> > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> > ---
> >  package/nodejs/nodejs.mk | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> > index 2a8c570932..8f86413049 100644
> > --- a/package/nodejs/nodejs.mk
> > +++ b/package/nodejs/nodejs.mk
> > @@ -20,7 +20,7 @@ NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
> >  	npm_config_arch=$(NODEJS_CPU) \
> >  	npm_config_target_arch=$(NODEJS_CPU) \
> >  	npm_config_build_from_source=true \
> > -	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
> > +	npm_config_nodedir=$(TARGET_DIR)/usr \
> 
> So, there is a first issue in the original npm_config_nodedir, as it
> references NODEJS_VERSION which no longer exists since 4cbc2af604e7
> (package/nodejs: rename to nodejs-src and convert to virtual package),
> when we renamed the actual version variable to NODEJS_COMMON_VERSION.
> 
> This is visible in the build log of #15826:
> 
>     npm ERR! gyp WARN read config.gypi ENOENT: no such file or directory, open '/home/marcus/repos/buildroot-upstream/output/build/nodejs-/include/node/config.gypi'
> 
> Notice the /nodejs-/ part of the path: it hints that a variable is not
> expanded as would be expected; in this case, the wrong variable is
> expanded. (I have started a build with the variable name fixed; let's
> see what happens...)

Seemingly the same error, so that did not fix the issue.

> Furthermore, even though this again is an npm-mess issue, I'd like a bit
> more explanations on why we need to change npm_config_nodedir now, when
> it has been working so far, since it was introduced 10 years ago with
> commit b31bc7d43870 (nodejs: new package). Presumably, it did work then
> 
> Maybe the explanation is just "in fact it has never worked!", and then
> it would be nice to know why it never worked.
> 
> Daniel, I know it's been 10 years now, but do you happen to have some
> recollection of what was going on?
> 
> Finally, I *think* your patch might be correct, but not for the good
> reasons...

So, the file that is looked for is:  ..../include/node/config.gypi , so
that looks more like something we should look in staging rather than in
target.

New build started... (nodejs takes 1h15min to build here....)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/nodejs: fix additional modules installation
  2023-10-31  9:01 [Buildroot] [PATCH] package/nodejs: fix additional modules installation Giulio Benetti
  2023-11-06 19:12 ` Marcus Hoffmann via buildroot
  2023-11-07 15:15 ` Yann E. MORIN
@ 2023-11-07 21:40 ` Yann E. MORIN
  2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2023-11-07 21:40 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: Martin Bark, Daniel Price, Thomas Petazzoni, buildroot

Giulio, All,

On 2023-10-31 10:01 +0100, Giulio Benetti spake thusly:
> At the moment the npm_config_nodedir is set to the build directory but
> npm nodedir must be the one on target to find the expected files. So let's
> set npm_config_nodedir to $(TARGET_DIR)/usr.
> 
> Fixes:
> https://bugs.busybox.net/show_bug.cgi?id=15826
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

I have drastically extended the commit log to explain what nodedir is,
and why we decided to set it to...

> ---
>  package/nodejs/nodejs.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 2a8c570932..8f86413049 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -20,7 +20,7 @@ NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
>  	npm_config_arch=$(NODEJS_CPU) \
>  	npm_config_target_arch=$(NODEJS_CPU) \
>  	npm_config_build_from_source=true \
> -	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
> +	npm_config_nodedir=$(TARGET_DIR)/usr \

... STAGING_DIR, not TARGET_DIR.

Applied to master, thanks.

Regards,
Yann E. MORIN.

>  	npm_config_prefix=$(TARGET_DIR)/usr \
>  	npm_config_cache=$(BUILD_DIR)/.npm-cache
>  
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/nodejs: fix additional modules installation
  2023-11-06 19:12 ` Marcus Hoffmann via buildroot
@ 2023-11-07 21:51   ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2023-11-07 21:51 UTC (permalink / raw)
  To: Marcus Hoffmann
  Cc: Giulio Benetti, Daniel Price, Martin Bark, Thomas Petazzoni,
	buildroot

Marcus, All,

On 2023-11-06 20:12 +0100, Marcus Hoffmann via buildroot spake thusly:
> Thanks Guilio, this fixes our build problem!
> 
> On 31.10.23 10:01, Giulio Benetti wrote:
> >At the moment the npm_config_nodedir is set to the build directory but
> >npm nodedir must be the one on target to find the expected files. So let's
> >set npm_config_nodedir to $(TARGET_DIR)/usr.
> >
> >Fixes:
> >https://bugs.busybox.net/show_bug.cgi?id=15826
> >
> >Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Tested-by: Marcus Hoffmann <marcus.hoffmann@othermo.de>

Thanks for providing your tested-by tag.

However, since I changed the patch to use STAGING_DIR instead of
TARGET_DIR, I dropped your tested-by, because the new code is now too
different from what you tested.

Still, seeing a Tested-by tag on such a patch gave me enough interest
to look deeper and investigate to find the actual issue and come up with
a better fix. So, thank you!

Regards,
Yann E. MORIN.

> >---
> >  package/nodejs/nodejs.mk | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> >index 2a8c570932..8f86413049 100644
> >--- a/package/nodejs/nodejs.mk
> >+++ b/package/nodejs/nodejs.mk
> >@@ -20,7 +20,7 @@ NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
> >      npm_config_arch=$(NODEJS_CPU) \
> >      npm_config_target_arch=$(NODEJS_CPU) \
> >      npm_config_build_from_source=true \
> >-     npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
> >+     npm_config_nodedir=$(TARGET_DIR)/usr \
> >      npm_config_prefix=$(TARGET_DIR)/usr \
> >      npm_config_cache=$(BUILD_DIR)/.npm-cache
> >
> ________________________________
> 
> othermo GmbH | Sitz der Gesellschaft: Alzenau | Amtsgericht Aschaffenburg: HRB 14783 | USt-IdNr.: DE319977978 | Geschäftsführung: Dr. Dennis Metz.
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-07 21:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31  9:01 [Buildroot] [PATCH] package/nodejs: fix additional modules installation Giulio Benetti
2023-11-06 19:12 ` Marcus Hoffmann via buildroot
2023-11-07 21:51   ` Yann E. MORIN
2023-11-07 15:15 ` Yann E. MORIN
2023-11-07 17:27   ` Yann E. MORIN
2023-11-07 21:40 ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox