Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Riscv64 native #157

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Riscv64 native #157

wants to merge 3 commits into from

Conversation

fede2cr
Copy link

@fede2cr fede2cr commented Oct 9, 2024

riscv64 hardware is getting larger (64-core and 192-core hardware are available), so this is a recipe to build in riscv64 hardware without the use of cross compiler or distro-external toolchains.

Tested with:
bin/local_build.sh -r riscv64-native -v v20.18.0

@rvagg
Copy link
Member

rvagg commented Oct 9, 2024

Nice, but it probably doesn't belong here because these are all built in a single x64 Linux machine. So this won't run and produce anything.

@wojiushixiaobai

This comment was marked as outdated.

@rvagg
Copy link
Member

rvagg commented Dec 16, 2024

In theory both DESTCPU and ARCH should be detected automatically, so they may not be needed at all in the musl recipe; see https://github.com/nodejs/node/blob/main/Makefile#L934-L935 and then that might give you what you want - which I assume is an easy easy way of building Node.js in a container for your platform bundled like it's supposed to be? Because if we can't compile it on an x64 Linux machine then we can't publish it at unofficial-builds.nodejs.org (currently anyway), this just becomes an exercise in adding code that's not used by this particular project.

Try removing those two options and if you can tell me whether it builds successfully for your in riscv64 and x64 if you have access to both, then that would be very useful.

@wojiushixiaobai
Copy link

wojiushixiaobai commented Dec 16, 2024

@rvagg
You are right, this will work, but we need to do some additional configuration to get it to work on riscv64 and loong64.

#!/usr/bin/env bash

set -e
set -x

release_urlbase="$1"
disttype="$2"
customtag="$3"
datestring="$4"
commit="$5"
fullversion="$6"
source_url="$7"
source_urlbase="$8"
config_flags=""
make_flags=""

alpineArch="$(apk --print-arch)"
case "${alpineArch##*-}" in
  riscv64)
    config_flags+="--openssl-no-asm"
    ;;
  loongarch64)
    make_flags+=" DESTCPU=loong64 ARCH=loong64"
    config_flags+="--openssl-no-asm"
    ;;
esac

cd /home/node

tar -xf node.tar.xz
cd "node-${fullversion}"

export CC="ccache gcc"
export CXX="ccache g++"

make_flags+=" \
  VARIATION=musl \
  DISTTYPE=$disttype \
  CUSTOMTAG=$customtag \
  DATESTRING=$datestring \
  COMMIT=$commit \
  RELEASE_URLBASE=$release_urlbase \
  CONFIG_FLAGS=$config_flags"

make -j$(getconf _NPROCESSORS_ONLN) binary V= $make_flags

mv node-*.tar.?z /out/

@rvagg
Copy link
Member

rvagg commented Dec 16, 2024

OK, I don't think I mind, if it works. Is loong64 supported by Alpine already?

@wojiushixiaobai
Copy link

OK, I don't think I mind, if it works. Is loong64 supported by Alpine already?

Yes,
alpine linux 3.21.0 already supports loongarch64, but the alpine:3.21 container image is not ready yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants