blog.iwanluijks.nl
IL
Blog post

Using a custom GNU Assembler version for GCC on OpenBSD 7.3

By Iwan Luijks · · Back to blog


When building NodeJS on OpenBSD you will likely run into the problem of the GNU Assembler (read gas) version being outdated and passing on --openssl-no-asm to the configure script.

You can't pass along the --with-as option to the configure script for NodeJS as it will simply ignore it (see configure.py for gas version detection). A simple trick will allow you to change the gas version for egcc (userland installed GCC).

Having installed GCC (thus you will have the egcc command available) as follows:

# pkg_info -Q gcc
# pkg_add gcc-8.4.0p15

Install gas:

# pkg_info -Q gas
# pkg_add gas-2.31.1
# whereis gas
/usr/local/bin/gas

Now move on creating a symlink to that gas binary in egcc's libexec:

# cd /usr/local/libexec/gcc/x86_64-unknown-openbsd7.3/8.4.0/
# ln -s /usr/local/bin/gas as

Verify the gas version egcc uses, using the same command NodeJS uses to detect the gas version as follows:

# egcc -Wa,-v -c -o /dev/null -x assembler /dev/log

You should see GNU Assembler version 2.31.1 here.

See https://gcc.gnu.org/install/configure.html (look for --with-as) for more information on how GCC looks for the assembler. See https://github.com/nodejs/node/blob/main/configure.py on how NodeJS detects the GNU Assembler (gas) version.

This relates to errors you might get

Don't forget to install g++ too if necessary and set it as compiler in the session's environment using CXX=eg++.

Anyways, it relates to the warning "solvable" by passing --openssl-no-asm

# CC=egcc CXX=eg++ ./configure
Node.js configure: Found Python 3.11.4

ERROR: Did not find a new enough assembler, install one or build with
        --openssl-no-asm.
        Please refer to BUILDING.md

Or the error about missing instructions:

Error: no such instruction: `pmaxud %xmm2,%xmm1`

This article was updated on . Labeled under: openbsd, nodejs.