Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Works on ubuntu v20 (x86_64); timeouts on custom ARM 32-bit Linux distro. #19

Open
metelik opened this issue Mar 25, 2021 · 2 comments
Open

Comments

@metelik
Copy link

metelik commented Mar 25, 2021

Hello,

Linux ubuntu 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux:

iex(2)> :gen_icmp.ping('192.168.1.1', [ttl: 1])
[
  {:ok, '192.168.1.1', {192, 168, 1, 1}, {192, 168, 1, 1}, {15829, 0, 255, 7},
   " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO"}
]

On: Linux smartslot 5.4.66nmc4-dirty #10 SMP PREEMPT Tue Mar 23 05:06:09 PDT 2021 armv7l GNU/Linux:
iex(1)> :gen_icmp.ping('127.0.0.1', [])
[{:error, :timeout, '127.0.0.1', {127, 0, 0, 1}}]

Needless to mention that a standard command line ping works perfectly fine. I am getting timeout in 100% calls. I am not an Erlang expert but wrote few things. I would appreciate any help with debugging this as I do not even know at this stage what might have gone wrong. This is not the only module that involves cross-compilation but this is the only one that works-otherwise. First of all I checked the procket's cross-compile's CFLAGS and LDFLAGS and I haven't noticed anything apparent. Please see below excerpt.

613 ===> Compiling procket
614 make: Entering directory '/mnt/src/agilis_fw/firmware.gvs/deps/lces2/procket/c_src'
615 make -f /mnt/src/agilis_fw/firmware.gvs/deps/lces2/procket/c_src/Makefile.ancillary
616 make[1]: Entering directory '/mnt/src/agilis_fw/firmware.gvs/deps/lces2/procket/c_src'
617 arm-poky-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=vfpv4-d16 -mfloat-abi=hard -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-sec>
618 arm-poky-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=vfpv4-d16 -mfloat-abi=hard -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-sec>
619 ar cr libancillary.a fd_send.o fd_recv.o
620 ranlib libancillary.a
621 make[1]: Leaving directory '/mnt/src/agilis_fw/firmware.gvs/deps/lces2/procket/c_src'
622 echo "CFLAGS =  -O2 -pipe -g -feliminate-unused-debug-types  -fPIC -O2 -I  -I  -I/home/motyl/.local/share/nerves/artifacts/nerves_system_poky-portable->
623 CFLAGS =  -O2 -pipe -g -feliminate-unused-debug-types  -fPIC -O2 -I  -I  -I/home/motyl/.local/share/nerves/artifacts/nerves_system_poky-portable-3.1.3->
624 echo "LDFLAGS = -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -shared -L/home/motyl/.local/share/nerves/art>
625 LDFLAGS = -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -shared -L/home/motyl/.local/share/nerves/artifacts>
626 arm-poky-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=vfpv4-d16 -mfloat-abi=hard -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-sec>
627 arm-poky-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=vfpv4-d16 -mfloat-abi=hard -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-sec>
628 arm-poky-linux-gnueabi-gcc  -march=armv7ve -mthumb -mfpu=vfpv4-d16 -mfloat-abi=hard -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-sec>
629 make: Leaving directory '/mnt/src/agilis_fw/firmware.gvs/deps/lces2/procket/c_src'

This is probably something silly on my side and I hope to help improving the module's cross-compile build if this would appear to be the case.

Checked with the wireshark and no single ICMP packet is being spit out onto the wire.

With my best wishes
Tomasz Motyl

@metelik
Copy link
Author

metelik commented Mar 25, 2021

Okidok...
A slight surprise with the cross-compiled environment:

 :gen_icmp.ping('127.0.0.1', [])
14:53:36.655: [error] iex : Process #PID<0.8574.0> raised an exception
** (UndefinedFunctionError) function :pkt.icmp/1 is undefined (module :pkt is not available)
    :pkt.icmp({:icmp, 8, 0, 0, 36084, 0, {127, 0, 0, 1}, <<0, 0, 0, 0>>, 0, 0, 0, 0, 0})
    (gen_icmp 0.5.3) /mnt/src/agilis_fw/firmware.gvs/deps/lces2/gen_icmp/src/gen_icmp.erl:355: :gen_icmp.packet/2
    (gen_icmp 0.5.3) /mnt/src/agilis_fw/firmware.gvs/deps/lces2/gen_icmp/src/gen_icmp.erl:195: anonymous fn/6 in :gen_icmp.ping/3
[{:error, :timeout, '127.0.0.1', {127, 0, 0, 1}}]

Mystery unraveled. Now I shall need to figure why that happenned. :pkg should be a strict dependency and it had been fetched but not included into the final app.

@msantos
Copy link
Owner

msantos commented May 30, 2021

@metelik Apologies for the very slow response time, didn't see this issue. gmail has been filtering out my github emails.

In case you haven't figured this out, you can try a few things:

  • testing it works by manually copying pkt.beam into your firmware before uploading the image
  • add an explicit dependency on pkt to the application's mix.exs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants