nodejs / unofficial-builds

Unofficial binaries for Node.js
https://unofficial-builds.nodejs.org
221 stars 46 forks source link

instalation path routes #122

Closed mckaygerhard closed 4 months ago

mckaygerhard commented 4 months ago

the README and files does not details if the nodejs program will search for modules in "/usr/lib" or "./lib" or what tripled, any info of this?

this is to difference system installed modules and user only installed modules

rvagg commented 4 months ago

Run node -pe process.config.variables.node_prefix then look at https://nodejs.org/api/modules.html#loading-from-the-global-folders for what $PREFIX means. IIRC all the recipes here use default settings, e.g. https://github.com/nodejs/unofficial-builds/blob/main/recipes/x86/run.sh#L30 I think that means $PREFIX should all be /usr/local, as per https://github.com/nodejs/node/blob/main/Makefile#L7

mckaygerhard commented 3 months ago

umm thanks.. so were forced to use /usr/local then

rvagg commented 3 months ago

not quite, it's just how it's landed here and nobody thought to change it, perhaps we could migrate here and change all our recipes? I think that's probably best done on a major version bump, so we'd have to maintain some branching around that version but then we could --prefix=/ during compile.

I personally prefer /usr/local so this suits me, but it doesn't bother me too much so you're welcome to propose it if you feel like coding that up for all the recipes.

rvagg commented 3 months ago

fwiw I did remember to set this in the snaps, so they default to /! https://github.com/nodejs/snap/blob/3f56afb0f323ceda8660b9c6db51ddfce76c9f93/snapcraft.yaml.sh#L98

there's precedent at least

I think the binaries from nodejs.org though use /usr/local, so maybe that's a stronger precedent?

mckaygerhard commented 3 months ago

well /usr/local its default unix philosophy ! i asking only cos i was planning to package into deb/rpm but seems will not work with such prefix so i will plan to build for older distributions..

most people said shit about "nobody uses x version" but that's lie.. its few ones but the world is huge .. and still there are people here using older releases and older devices

rvagg commented 3 months ago

but that's lie.. its few ones but the world is huge .. and still there are people here using older releases and older devices

yep, I agree and I've tried to lean toward the extended support model of this, but the tail is very very long and sometimes you have to draw a line somewhere just for the sake of combinatorial explosiveness

mckaygerhard commented 3 months ago

i will try to package it for older debian and alpine releases.. thanks for your support and i'll tyry to help as i can to this repo

mckaygerhard commented 3 months ago

hi, i checked and try to build by myselft but in script but despicte error of https://github.com/nodejs/unofficial-builds/issues/123 i note the argument passed to python "--prefix=/" in log (check issue referenced)

rvagg commented 3 months ago

Yeah, you're right about that, so this took me down a rabbit hole but it looks like we've never been able to use make build to set a custom prefix. Even from when it was first introduced: https://github.com/nodejs/node/commit/42aac41b9399dbdb14e3f250f358c14ec13ee5e4, it's been stuck at / since then even though we have logic for where to install it with PREFIX! I think maybe that people just don't use global modules enough to notice but this is a little bit strange.

So, I think what you're going to need to do is separately ./configure ... and make build rather than use the make binary which has historically been reserved for making releases.

mckaygerhard commented 3 months ago

i was able to build using /usr prefix.. but README was not so clear.. i made a PR about this! chek it!

mckaygerhard commented 3 months ago

@rvagg you must open this again.. i checked the log of compilation and prefix do not honors in local or remote builds, relevant part is posted :

noted the part : rm -f -r out/deps out/Release python3 ./configure --prefix=/ in part of the log, i already setup run.sh to put CONFIG_FLAGS and already put in Dockerfile "export PREFIX="/usr" and already add same in docker file.. but this par of the log seem does not honor such configuration:

+ source_url=https://nodejs.org/download/release/v20.11.1/node-v20.11.1.tar.xz
+ config_flags='--openssl-no-asm --prefix=/usr'
+ cd /home/node
+ tar -xf node.tar.xz
+ cd node-v20.11.1
+ export 'PREFIX=/usr'
+ PREFIX='/usr'
+ export 'CC=ccache gcc'
+ CC='ccache gcc'
+ export 'CXX=ccache g++'
+ CXX='ccache g++'
+ export CXXFLAGS=-m32
+ CXXFLAGS=-m32
+ export CFLAGS=-m32
+ CFLAGS=-m32
++ tr --delete v
++ cut -d . -f 1
++ echo v20.11.1
+ export MAJOR_VERSION=20
+ MAJOR_VERSION=20
+ '[' 20 -ge 16 ']'
+ . /opt/rh/devtoolset-9/enable
++ export PATH=/opt/rh/devtoolset-9/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ PATH=/opt/rh/devtoolset-9/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ export MANPATH=/opt/rh/devtoolset-9/root/usr/share/man:
++ MANPATH=/opt/rh/devtoolset-9/root/usr/share/man:
++ export INFOPATH=/opt/rh/devtoolset-9/root/usr/share/info
++ INFOPATH=/opt/rh/devtoolset-9/root/usr/share/info
++ export PCP_DIR=/opt/rh/devtoolset-9/root
++ PCP_DIR=/opt/rh/devtoolset-9/root
+++ rpm --eval '%{_libdir}'
++ rpmlibdir=/usr/lib64
++ '[' /usr/lib64 '!=' /usr/ ']'
++ rpmlibdir32=:/opt/rh/devtoolset-9/root/usr/lib
++ export LD_LIBRARY_PATH=/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib
++ LD_LIBRARY_PATH=/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib
++ export LD_LIBRARY_PATH=/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib
++ LD_LIBRARY_PATH=/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib
++ export PKG_CONFIG_PATH=/opt/rh/devtoolset-9/root/usr/lib/pkgconfig
++ PKG_CONFIG_PATH=/opt/rh/devtoolset-9/root/usr/lib/pkgconfig
++ getconf _NPROCESSORS_ONLN
+ make -j1 binary V= DESTCPU=x86 PREFIX=/usr ARCH=x86 VARIATION= DISTTYPE=release CUSTOMTAG= DATESTRING= COMMIT= RELEASE_URLBASE=https://unofficial-builds.nodejs.org/download/release/ 'CONFIG_FLAGS=--openssl-no-asm --prefix=/usr'
fatal: Not a git repository (or any of the parent directories): .git
rm -f -r node-v20.11.1-linux-x86
rm -f -r out/deps out/Release
python3 ./configure \
    --prefix=/ \
    --dest-cpu=x86 \
    --tag= \
    --release-urlbase=https://unofficial-builds.nodejs.org/download/release/ \
    --openssl-no-asm --prefix=/usr --download=all --with-intl=full-icu
Node.js configure: Found Python 3.6.8...
WARNING: C++ compiler (CXX=ccache g++, 9.3.1) too old, need g++ 10.1.0 or clang++ 8.0.0
WARNING: --openssl-no-asm will result in binaries that do not take advantage
         of modern CPU cryptographic instructions and will therefore be slower.
         Please refer to BUILDING.md
WARNING: warnings were emitted in the configure phase
INFO: configure completed successfully
make install DESTDIR=node-v20.11.1-linux-x86 V= PORTABLE=1
make -C out BUILDTYPE=Release V=
  TOUCH /home/node/node-v20.11.1/out/Release/obj.target/deps/googletest/gtest_prod.stamp
  CXX(target) /home/node/node-v20.11.1/out/Release/obj.target/simdutf/deps/simdutf/simdutf.o
mckaygerhard commented 3 months ago

ok solve it, you cannot reuse the dockers layers.. all dockers must be prube.. i already put it on the pull request that as note.. not as step