WebThingsIO / zwave-adapter

Z-Wave adapter add-on for WebThings Gateway
Mozilla Public License 2.0
15 stars 20 forks source link

0.11.0 fails to start: ELF load command address/offset not properly aligned #146

Open benfrancis opened 1 month ago

benfrancis commented 1 month ago

I've generated a new release of the Z-wave add-on https://github.com/WebThingsIO/zwave-adapter/releases/tag/v0.11.0 and am currently testing it with gateway 1.1 running on a Raspberry Pi.

If I manually download and extract the zwave-adapter-0.11.0-linux-arm-v10.tgz file to ~/.webthings/addons/ I get the following error on start:

ERROR : zwave-adapter: Failed to start add-on zwave-adapter: Failed to load openzwave-shared: Error: /home/pi/.webthings/addons/zwave-adapter/node_modules/openzwave-shared/build/Release/openzwave_shared.node: ELF load command address/offset not properly aligned

Anyone have any suggestions what might be causing this?

benfrancis commented 1 month ago

Some advice from Dave Hylands (thank you Dave!):

the most likely cause is that the library was compiled for 4K pages, but is being run on a system with 16K pages. This can happen when running a 32-bit executable on a 64-bit RPi5 which apparently uses 16K pages.

Apparently the default kernel for RPi OS on the RPi5 uses 16K pages because it gives a performance increase.

You can check the page size using this.

grep -ir pagesize /proc/self/smaps | head -2

On my RPi5 running Ubuntu 24.04, I get this:

KernelPageSize: 4 kB MMUPageSize: 4 kB

If I run Raspberry Pi OS I get this:

KernelPageSize: 16 kB MMUPageSize: 16 kB

Apparently, if you link with this option (it should only affect the linking stage, not the compilation stage):

LDFLAGS += "-Wl,-z,max-page-size=16384"

then it should fix it to work with 4K & 16K pages. You may need to change LDFLAGS (I don't remember what the build system uses).