gotthardp / meta-lorawan

OpenEmbedded/Yocto Project layer with LoRaWAN tools
5 stars 3 forks source link

Can't find escript when compiling #5

Closed bramroelandts closed 5 years ago

bramroelandts commented 5 years ago

I'm trying to compile the Erlang LoRaWAN server on Yocto. I successfully compiled erlang and erlang-modules (I tried both, as suggested in this issue).

All but one compile task succeeds. Bitbake throws the following error:

ERROR:` lorawan-server-0.6.2-r0 do_compile: oe_runmake failed ERROR: lorawan-server-0.6.2-r0 do_compile: Function failed: do_compile (log file is located at /home/bram/Development/iot2020/build/tmp/work/i586-nlp-32-poky-linux/lorawan-server/0.6.2-r0/temp/log.do_compile.24330)

ERROR: Logfile of failure stored in: /home/bram/Development/iot2020/build/tmp/work/i586-nlp-32-poky-linux/lorawan-server/0.6.2-r0/temp/log.do_compile.24330

Log data follows: | DEBUG: Executing shell function do_compile | NOTE: make -j 4 release | ERROR: oe_runmake failed | /usr/bin/env: ‘escript’: No such file or directory | Makefile:35: recipe for target 'release' failed | make: *** [release] Error 127 | WARNING: exit code 1 from a shell command. | ERROR: Function failed: do_compile (log file is located at /home/bram/Development/iot2020/build/tmp/work/i586-nlp-32-poky-linux/lorawan-server/0.6.2-r0/temp/log.do_compile.24330)

ERROR: Task (/home/bram/Development/iot2020/meta-lorawan/recipes-core/lorawan-server/lorawan-server_0.6.2.bb:do_compile) failed with exit code '1' NOTE: Tasks Summary: Attempted 4437 tasks of which 4436 didn't need to be rerun and 1 failed.

I'm compiling this on Ubuntu 18.04 with 64-bit Erlang 20installed on my system. How would I go about debugging this issue? Help is greatly appreciated.

gotthardp commented 5 years ago

This is an immortal issue. I was never able to debug this as I was never able to reproduce this. I suspect it is because the build environment is using the local Erlang installation instead the erlang-native, which should be used. Would you mind installing Erlang in the build machine itself (outside the bitbake environment)?

bramroelandts commented 5 years ago

Judging from the multiple issues opened about this, this issue indeed seems quite persistent.

Because I tested the application server on my build machine first, Erlang 20 OTP is installed on the build machine (Ubuntu 18.04). To include Erlang in the Yocto image, I'm using the meta-erlang layer. Although I am unsure which version of Erlang meta-erlang installs, I think it installs Erlang 21, while on my build machine Erlang 20 is used.

Is it possible the issue is related to the difference between Erlang version of host machine and the bitbake image?

gotthardp commented 5 years ago

That's unlikely, but possible.

bramroelandts commented 5 years ago

Just to be sure, I installed Erlang 21 instead of 20 onto my host machine. Still no luck with compilation, as the same error keeps popping up. Do you have any suggestions as to how I can debug this issue any further? Should I use another Ubuntu distro and just set up a vanilla Yocto environment? Anything else?

gotthardp commented 5 years ago

Would it be possible to use Debian instead of Ubuntu?

sampopitkanen commented 5 years ago

I had the same issue but I was able to fix it. You need to inherit erlang and npm so that it will use the escript and npm commands from the Yocto build system instead of the native installed tools. Also, the inherit line needs to be moved earlier so that the inherited classes do not overwrite some of the variables set in the recipe.

This patch shows the changes I made to get it to work:

diff --git a/recipes-core/lorawan-server/lorawan-server_0.6.6.bb b/recipes-core/lorawan-server/lorawan-server_0.6.6.bb index d2cf791..e14e9fe 100644 --- a/recipes-core/lorawan-server/lorawan-server_0.6.6.bb +++ b/recipes-core/lorawan-server/lorawan-server_0.6.6.bb @@ -7,6 +7,8 @@ DEPENDS = "erlang" LICENSE = "MIT" LIC_FILES_CHKSUM = >"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

+inherit useradd update-rc.d erlang npm + SRCURI = "git://github.com/gotthardp/lorawan-server.git;branch=master \ file://lorawan-server.init \ file://lorawan-server.default" @@ -18,7 +20,7 @@ RDEPENDS${PN} += "bash erlang erlang-compiler erlang-syntax-tools erlang-crypto erlang-inets erlang-asn1 erlang-public-key erlang-ssl erlang-mnesia erlang-os-mon \ erlang-xmerl"

-inherit useradd update-rc.d +FILES_${PN} += " /etc "

USERADD_PACKAGES = "${PN}" USERADDPARAM${PN} = "--home-dir /var/lib/lorawan-server --create-home lorawan"

gotthardp commented 5 years ago

@sampopitkanen, thanks a lot!