Compiled on RPI4B-4G with 5.10.77-piCore-v8 Reference: https://linux.die.net/man/1/gcc If you use multiple -O options, with or without level numbers, the last such option is the one that is effective. By exporting flags, -Os goes after -O3 Compile Flags: # ../deps/v8/src/torque/implementation-visitor.cc:3375:36: error: exception handling disabled, use '-fexceptions' to enable CFLAGS='-march=armv8-a+crc -mtune=cortex-a72 -Os -pipe' CXXFLAGS='-march=armv8-a+crc -mtune=cortex-a72 -Os -pipe' LDFLAGS='-Wl,-O1' export CFLAGS CXXFLAGS LDFLAGS Dependencies: compiletc python3.8 c-ares-dev icu-dev libuv-dev nghttp2-dev openssl-dev llvm-bin Commands: # fix LTO plugin P=/usr/local/libexec/gcc/aarch64-unknown-linux-gnu/10.2.0/liblto_plugin.so.0.0.0 sudo mkdir -p /usr/local/lib/bfd-plugins sudo ln -sfv $P /usr/local/lib/bfd-plugins/liblto_plugin.so # extract in /tmp (pi4 has enough memory) tar -xf node-v16.14.0.tar.gz cd node-v16.14.0/ patch -Np1 < Favor4Size.patch ./configure --prefix=/usr/local --shared-cares --shared-libuv --shared-openssl --shared-nghttp2 --shared-zlib --with-intl=system-icu --enable-lto --verbose # compile and install in a go nohup time make -j4 install DESTDIR=/tmp/packing-node &> /tmp/node-build-install.log & real 4h 37m 21s user 17h 18m 25s sys 44m 39.36s cd /tmp/packing-node # find . -type f -exec file {} ';' > /tmp/file.info # grep ELF /tmp/file.info strip --strip-unneeded ./usr/local/bin/node # dev mkdir -p /tmp/packing-node-dev/usr/local/ mv /tmp/packing-node/usr/local/include /tmp/packing-node-dev/usr/local/