You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "lupyuen (via GitHub)" <gi...@apache.org> on 2024/01/02 05:33:14 UTC
[PR] examples/hello_nim: Fix nimcache location [nuttx-apps]
lupyuen opened a new pull request, #2247:
URL: https://github.com/apache/nuttx-apps/pull/2247
## Summary
The Nim Example App fails to build because the `.nimcache` is located 2 folders up. This PR fixes the location of `.nimcache` in the `Makefile` of the Nim Example App.
`.nimcache` is explained in [this article](https://lupyuen.github.io/articles/nim#inside-nim-on-nuttx).
## Impact
Nim Example App builds and runs correctly after fixing the `.nimcache` location.
No impact on other apps, since the `Makefile` is used only by the Nim Example App.
## Testing
We tested on QEMU Arm64:
```bash
$ tools/configure.sh -l qemu-armv8a:nsh
## TODO: Init networking: https://github.com/lupyuen2/wip-pinephone-nuttx/commit/77b8295eb761954370481ed113254b7e930f65c0
## TODO: Suppress warnings: https://github.com/lupyuen2/wip-pinephone-nuttx/commit/e82be7d1f9f662ef369a3c4adc8290a4035f9857
$ make menuconfig
## Enable "Application Configuration > Examples > Hello World Example (Nim)"
## Networking support: Enable "Networking support"
## Networking Support → SocketCAN Support:
## Enable "SocketCAN Support"
## Enable "sockopt support"
## RTOS Features → Tasks and Scheduling:
## Enable "Support parent/child task relationships"
## Enable "Retain child exit status"
$ make
```
### Before Fixing
NuttX Build fails because `.nimcache/hello_nim_async.h` could not be found:
```text
./hello_nim_main.c:26:10: fatal error: hello_nim_async.h: No such file or directory
26 | #include "hello_nim_async.h"
```
[(See the Build Log)](https://gist.github.com/lupyuen/b13a7b36a404c94180aaa501d5a88700)
### After Fixing
NuttX Build succeeds and Nim Example App runs correctly. Note that we need to [suppress the warnings](https://github.com/lupyuen2/wip-pinephone-nuttx/commit/e82be7d1f9f662ef369a3c4adc8290a4035f9857) and [initialise the network](https://github.com/lupyuen2/wip-pinephone-nuttx/commit/77b8295eb761954370481ed113254b7e930f65c0). We might need to fix these in a future PR.
```text
$ qemu-system-aarch64 \
-cpu cortex-a53 \
-nographic \
-machine virt,virtualization=on,gic-version=3 \
-net none \
-chardev stdio,id=con,mux=on \
-serial chardev:con \
-mon chardev=con,mode=readline \
-kernel nuttx
NuttShell (NSH) NuttX-12.0.3
nsh> uname -a
NuttX 12.0.3 77b8295eb76 Jan 2 2024 04:53:17 arm64 qemu-armv8a
nsh> hello_nim
task_spawn: name=hello_nim entry=0x402a4f4c file_actions=0x403ede48 attr=0x403ede50 argv=0x403edf90
spawn_execattrs: Setting policy=2 priority=100 for pid=3
pthread_mutex_init: mutex=0x403e4918 attr=0
pthread_mutex_init: Returning 0
Hello from task 1! loops: 0
pthread_mutex_timedlock: mutex=0x403e4918
pthread_mutex_timedlock: Returning 0
pthread_mutex_unlock: mutex=0x403e4918
pthread_mutex_unlock: Returning 0
Hello from task 2! loops: 0
Hello from task 3! loops: 0
Hello from task 1! loops: 1
Hello from task 2! loops: 1
Hello from task 3! loops: 1
Hello from task 1! loops: 2
Hello from task 2! loops: 2
Hello from task 3! loops: 2
nxsig_tcbdispatch: TCB=0x403ebd40 pid=2 signo=17 code=5 value=0 masked=NO
nsh>
```
[(See the NuttX Log)](https://gist.github.com/lupyuen/dc10bbb329a33020cef789fa9a20c4c8)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/hello_nim: Fix nimcache location [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #2247:
URL: https://github.com/apache/nuttx-apps/pull/2247#issuecomment-1874353054
@lupyuen why not enable nim in ci to avoid it may break in the future?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/hello_nim: Fix nimcache location [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #2247:
URL: https://github.com/apache/nuttx-apps/pull/2247
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] examples/hello_nim: Fix nimcache location [nuttx-apps]
Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #2247:
URL: https://github.com/apache/nuttx-apps/pull/2247#issuecomment-1874894353
Thanks @xiaoxiang781216! Right now the `hello_nim` build fails on QEMU Arm64 because of the `const` warnings (since GCC `-Werror` is enabled). Lemme figure out if Nim Compiler can generate correct `const` code, then we can add it to CI.
For now: I shall run an Auto Daily Build on my GitHub Actions account (with GCC `-Werror` disabled). So I will know if the Nim Build breaks.
```text
../../.nimcache/@m..@s..@s..@s..@s..@shome@svscode@s.choosenim@stoolchains@snim-@hdevel@slib@spure@sasyncdispatch.nim.c:362:285: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
362 | IGNOF(tyObject_SelectorImpl__JWlu9aJYbxUSEZxA8xSjuMg), .depth = 0, .display = TM__gfe9a52b5gJr8GSrnr883iA_3, .traceImpl = (void*)eqtrace___pureZasyncdispatch_u2061, .flags = 0};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
[(List of warnings)](https://gist.github.com/lupyuen/61f2e60f36b19f379406c83405ef16fd#file-nuttx-nim-arm64a-log-L409-L678)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org