humphd / browser-vm

A small Linux x86 VM meant for use in the browser
MIT License
175 stars 43 forks source link

How to add nodejs package? #13

Open ConstantinFF opened 1 year ago

ConstantinFF commented 1 year ago

I have been trying to add the nodejs package to the build. But the build hangs without error.

From the menu nodejs dependencies are

nodejs needs a toolchain w/ C++, dynamic library, NPTL, gcc >= 7, wchar, host gcc >= 8

So

  1. Inside Dockerfile I use FROM ubuntu:22.04 to have the latest gcc
  2. Added also apt-get -q -y install file libbz2-dev, because they were required during the build
  3. I clone and use latest code from https://github.com/buildroot/buildroot.git
  4. Then I enabled toolchain with c++ from the menu
  5. And the v86_defconfig config file that I got is:
    BR2_x86_pentiumpro=y
    BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
    BR2_TOOLCHAIN_BUILDROOT_CXX=y
    BR2_CCACHE=y
    BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_v86_PATH)/board/v86/rootfs_overlay/"
    BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_v86_PATH)/board/v86/post-image.sh"
    BR2_LINUX_KERNEL=y
    BR2_LINUX_KERNEL_CUSTOM_VERSION=y
    BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.172"
    BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
    BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_v86_PATH)/board/v86/linux.config"
    BR2_PACKAGE_NODEJS=y
    BR2_PACKAGE_NODEJS_NPM=y
    BR2_PACKAGE_NANO=y
    BR2_TARGET_ROOTFS_INITRAMFS=y
    BR2_TARGET_ROOTFS_ISO9660=y
    BR2_TARGET_SYSLINUX=y

The phase in which build stops and hangs is:

>>> nodejs 16.17.1 Configuring
mkdir -p /root/buildroot-2022.08/output/build/nodejs-16.17.1/bin
ln -sf /root/buildroot-2022.08/output/host/bin/python3 /root/buildroot-2022.08/output/build/nodejs-16.17.1/bin/python
/usr/bin/install -D -m 755 package/nodejs//v8-qemu-wrapper.in /root/buildroot-2022.08/output/build/nodejs-16.17.1/out/Release/v8-qemu-wrapper
/usr/bin/sed -i -e "s%@QEMU_USER@%/root/buildroot-2022.08/output/host/bin/qemu-i386%g" /root/buildroot-2022.08/output/build/nodejs-16.17.1/out/Release/v8-qemu-wrapper
/usr/bin/sed -i -e "s%@TOOLCHAIN_HEADERS_VERSION@%"4.19"%g" /root/buildroot-2022.08/output/build/nodejs-16.17.1/out/Release/v8-qemu-wrapper
/usr/bin/sed -i -e "s%@QEMU_USERMODE_ARGS@%%g" /root/buildroot-2022.08/output/build/nodejs-16.17.1/out/Release/v8-qemu-wrapper
/usr/bin/sed -i -e "s%@MAYBE_WRAPPER@%'<(PRODUCT_DIR)/v8-qemu-wrapper',%g" /root/buildroot-2022.08/output/build/nodejs-16.17.1/node.gyp
/usr/bin/sed -i -e "s%@MAYBE_WRAPPER@%'<(PRODUCT_DIR)/v8-qemu-wrapper',%g" /root/buildroot-2022.08/output/build/nodejs-16.17.1/tools/v8_gypfiles/v8.gyp
(cd /root/buildroot-2022.08/output/build/nodejs-16.17.1; PATH="/root/buildroot-2022.08/output/host/bin:/root/buildroot-2022.08/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" AR="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc-ar" AS="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-as" LD="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-ld" NM="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc-nm" CC="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc" GCC="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc" CPP="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-cpp" CXX="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-g++" FC="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gfortran" F77="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gfortran" RANLIB="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc-ranlib" READELF="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-readelf" STRIP="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-strip" OBJCOPY="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-objcopy" OBJDUMP="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/root/buildroot-2022.08/output/host/bin/ccache /usr/bin/gcc" GCC_FOR_BUILD="/root/buildroot-2022.08/output/host/bin/ccache /usr/bin/gcc" CXX_FOR_BUILD="/root/buildroot-2022.08/output/host/bin/ccache /usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I/root/buildroot-2022.08/output/host/include" CFLAGS_FOR_BUILD="-O2 -I/root/buildroot-2022.08/output/host/include" CXXFLAGS_FOR_BUILD="-O2 -I/root/buildroot-2022.08/output/host/include" LDFLAGS_FOR_BUILD="-L/root/buildroot-2022.08/output/host/lib -Wl,-rpath,/root/buildroot-2022.08/output/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-as" DEFAULT_LINKER="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="/root/buildroot-2022.08/output/host/bin/pkg-config" STAGING_DIR="/root/buildroot-2022.08/output/host/i686-buildroot-linux-gnu/sysroot" INTLTOOL_PERL=/usr/bin/perl PATH=/root/buildroot-2022.08/output/build/nodejs-16.17.1/bin:"/root/buildroot-2022.08/output/host/bin:/root/buildroot-2022.08/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" LDFLAGS=" -latomic" LD="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-g++" PYTHON=/root/buildroot-2022.08/output/host/bin/python3 /root/buildroot-2022.08/output/host/bin/python3 configure.py --prefix=/usr --dest-cpu=ia32     --shared-zlib --shared-cares --shared-libuv --shared-nghttp2 --without-dtrace --without-etw --cross-compiling --dest-os=linux --ninja --shared-openssl --with-intl=none )
INFO: configure completed successfully
>>> nodejs 16.17.1 Building
PATH="/root/buildroot-2022.08/output/host/bin:/root/buildroot-2022.08/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PYTHON=/root/buildroot-2022.08/output/host/bin/python3 /usr/bin/make -j17 -C /root/buildroot-2022.08/output/build/nodejs-16.17.1 PATH="/root/buildroot-2022.08/output/host/bin:/root/buildroot-2022.08/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" AR="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc-ar" AS="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-as" LD="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-ld" NM="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc-nm" CC="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc" GCC="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc" CPP="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-cpp" CXX="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-g++" FC="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gfortran" F77="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gfortran" RANLIB="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-gcc-ranlib" READELF="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-readelf" STRIP="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-strip" OBJCOPY="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-objcopy" OBJDUMP="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/root/buildroot-2022.08/output/host/bin/ccache /usr/bin/gcc" GCC_FOR_BUILD="/root/buildroot-2022.08/output/host/bin/ccache /usr/bin/gcc" CXX_FOR_BUILD="/root/buildroot-2022.08/output/host/bin/ccache /usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I/root/buildroot-2022.08/output/host/include" CFLAGS_FOR_BUILD="-O2 -I/root/buildroot-2022.08/output/host/include" CXXFLAGS_FOR_BUILD="-O2 -I/root/buildroot-2022.08/output/host/include" LDFLAGS_FOR_BUILD="-L/root/buildroot-2022.08/output/host/lib -Wl,-rpath,/root/buildroot-2022.08/output/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-as" DEFAULT_LINKER="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="/root/buildroot-2022.08/output/host/bin/pkg-config" STAGING_DIR="/root/buildroot-2022.08/output/host/i686-buildroot-linux-gnu/sysroot" INTLTOOL_PERL=/usr/bin/perl NO_LOAD=cctest.target.mk PATH=/root/buildroot-2022.08/output/build/nodejs-16.17.1/bin:"/root/buildroot-2022.08/output/host/bin:/root/buildroot-2022.08/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" LDFLAGS=" -latomic" LD="/root/buildroot-2022.08/output/host/bin/i686-buildroot-linux-gnu-g++"
make[1]: Entering directory '/root/buildroot-2022.08/output/build/nodejs-16.17.1'
ninja -C out/Release 
ninja: Entering directory `out/Release'
[180/2653] CC obj/deps/brotli/c/dec/brotli.decode.o
../../deps/brotli/c/dec/decode.c:2036:41: warning: argument 2 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Wvla-parameter]
 2036 |     size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from ../../deps/brotli/c/dec/decode.c:7:
../../deps/brotli/c/include/brotli/decode.h:204:19: note: previously declared as a variable length array 'const uint8_t[*decoded_size]' {aka 'const unsigned char[*decoded_size]'}
  204 |     const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../deps/brotli/c/dec/decode.c:2037:14: warning: argument 4 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Wvla-parameter]
 2037 |     uint8_t* decoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
In file included from ../../deps/brotli/c/dec/decode.c:7:
../../deps/brotli/c/include/brotli/decode.h:206:13: note: previously declared as a variable length array 'uint8_t[encoded_size]' {aka 'unsigned char[encoded_size]'}
  206 |     uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[211/2653] CC obj/deps/brotli/c/enc/brotli.encode.o
../../deps/brotli/c/enc/encode.c:1473:20: warning: argument 5 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Wvla-parameter]
 1473 |     const uint8_t* input_buffer, size_t* encoded_size,
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from ../../deps/brotli/c/enc/encode.c:9:
../../deps/brotli/c/include/brotli/encode.h:314:19: note: previously declared as a variable length array 'const uint8_t[*encoded_size]' {aka 'const unsigned char[*encoded_size]'}
  314 |     const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../deps/brotli/c/enc/encode.c:1474:14: warning: argument 7 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Wvla-parameter]
 1474 |     uint8_t* encoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
In file included from ../../deps/brotli/c/enc/encode.c:9:
../../deps/brotli/c/include/brotli/encode.h:316:13: note: previously declared as a variable length array 'uint8_t[input_size]' {aka 'unsigned char[input_size]'}
  316 |     uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2598/2653] ACTION generating: "obj/to...8_gypfiles/v8_snapshot.gen/embedded.S"