Installing node-rpio requires GCC 4.8 packages for C++11 support

I am porting an existing Nodejs project to Balena.

The project depends on the node package node-rpio.

However, this package depends on

GCC 4.8 packages for C++11 support

I have been using the following nodejs image FROM resin/raspberry-pi-node:8, but how do I add GCC 4.8 to this image?

I hope you can help me on this one, as I would love to transition some of my existing projects to Balena :slight_smile:

As of this writing, the node images are based on the debian base image [1].

As such, you can just go ahead and modify your Dockerfile to install the compiler.

Something like:

FROM resin/raspberry-pi-node:8

# install gcc 4.8 (dependency of node-rpio)
RUN apt-get update
RUN apt-get -f -y install gcc-4.8

# install node-rpio
ADD package.json .
RUN npm i rpio

# ... the rest of your dockerfile

[1] Documenation - “Base Images” https://www.balena.io/docs/reference/base-images/base-images/

1 Like

Thanks for the reply - so nice to get help when you are new to a platform/docker.

I am running my raspberry 3 in local mode, with the docker setup provided by you. It seems to work like a charm, but currently I am waiting a long time for the last step on doing push: removing intermediate container. I will get back when it’s done :slight_smile:

Installing gcc-4.8 like above works, but I now get the error: error: uncaughtException: /usr/src/app/node_modules/rpio/build/Release/rpio.node: invalid ELF header.

Now I am trying to use the arm32v7/node:8-jessie docker image, to see if that will work.
update
Using the arm32v7/node:8-jessie did not work , I still get the invalid ELF header error.

I think it’s a bit weird that I can’t find more GPIO/Nodejs/Raspberry images?

“invalid ELF header” likely implies the executable in the rpio build dir was compiled for the wrong word length (32 / 64), the wrong instruction set architecture, or the wrong ABI.

Could you post the output from inside your container of “readelf -h /usr/src/app/node_modules/rpio/build/Release/rpio.node” ?

Hi @dt-rush, thanks for your help. I finally fixed the issue by NOT doing balena local push -s . You can read more here, if you are interested :slight_smile: