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

[HELP] Recreating symlinks/switching directory (configure) #12940

Open
1 task done
serpent213 opened this issue Aug 17, 2024 · 3 comments
Open
1 task done

[HELP] Recreating symlinks/switching directory (configure) #12940

serpent213 opened this issue Aug 17, 2024 · 3 comments
Labels
Community: Question Further information is requested

Comments

@serpent213
Copy link

serpent213 commented Aug 17, 2024

Description

I'm new to NuttX and not sure where to find help. In this form it says: “Asking a question or getting help: use this form or Mailing list.” – over there it says: “[email protected] is for people who want to contribute code to NuttX.” 🤷🏼‍♂️

Also I was looking for a Matrix or Discord chat. Nothing...?

But now to my question; I'm assuming I have a fundamental misunderstanding regarding the configure phase, as I couldn't find anything related to my issue.

My Make.defs in the root (nuttx) folder is an absolute link to the selected board. Now, what do I do when my directory layout changes? I'm working in that tree from macOS, where it is located under /Users/, and also in a Linux devcontainer, where it is located under /workspaces/. Edit: (I run QEMU in the container and flash to hardware under macOS.)

How can I easily recreate all the symlinks to switch between the environments?

The only way I found so far was git clean -fdx and then run configure again, otherwise I get

$ ./tools/configure.sh -E -l esp32-devkitc:wifi
make: Entering directory '/workspaces/nuttx/nuttx'
tools/Unix.mk:27: /workspaces/nuttx/nuttx/Make.defs: No such file or directory
make: *** No rule to make target '/workspaces/nuttx/nuttx/Make.defs'.  Stop.
make: Leaving directory '/workspaces/nuttx/nuttx'

...but that's not really sustainable.

Verification

  • I have verified before submitting the report.
@serpent213 serpent213 added the Community: Question Further information is requested label Aug 17, 2024
@serpent213
Copy link
Author

Or maybe the problem is that the links are created absolute, in the first place?

$ ./tools/configure.sh -E -l esp32-devkitc:wifi
  Copy files
  Select CONFIG_HOST_LINUX=y
  Select CONFIG_HOST_ARM64=y
  Refreshing...
CP: arch/dummy/Kconfig to /workspaces/nuttx/nuttx/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /workspaces/nuttx/nuttx/boards/dummy/dummy_kconfig
LN: platform/board to /workspaces/nuttx/apps/platform/dummy
LN: include/arch to arch/xtensa/include
LN: include/arch/board to /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/include
LN: drivers/platform to /workspaces/nuttx/nuttx/drivers/dummy
LN: include/arch/chip to /workspaces/nuttx/nuttx/arch/xtensa/include/esp32
LN: arch/xtensa/src/chip to /workspaces/nuttx/nuttx/arch/xtensa/src/esp32
LN: arch/xtensa/src/board to /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/../common
LN: arch/xtensa/src/board/board to /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/src
mkkconfig in /workspaces/nuttx/apps/audioutils
mkkconfig in /workspaces/nuttx/apps/benchmarks
mkkconfig in /workspaces/nuttx/apps/boot
mkkconfig in /workspaces/nuttx/apps/canutils
mkkconfig in /workspaces/nuttx/apps/crypto
mkkconfig in /workspaces/nuttx/apps/database
mkkconfig in /workspaces/nuttx/apps/examples/mcuboot
mkkconfig in /workspaces/nuttx/apps/examples
mkkconfig in /workspaces/nuttx/apps/fsutils
mkkconfig in /workspaces/nuttx/apps/games
mkkconfig in /workspaces/nuttx/apps/graphics
mkkconfig in /workspaces/nuttx/apps/industry
mkkconfig in /workspaces/nuttx/apps/inertial
mkkconfig in /workspaces/nuttx/apps/interpreters/luamodules
mkkconfig in /workspaces/nuttx/apps/interpreters
mkkconfig in /workspaces/nuttx/apps/logging
mkkconfig in /workspaces/nuttx/apps/lte
mkkconfig in /workspaces/nuttx/apps/math
mkkconfig in /workspaces/nuttx/apps/mlearning
mkkconfig in /workspaces/nuttx/apps/netutils
mkkconfig in /workspaces/nuttx/apps/sdr
mkkconfig in /workspaces/nuttx/apps/system
mkkconfig in /workspaces/nuttx/apps/testing
mkkconfig in /workspaces/nuttx/apps/videoutils
mkkconfig in /workspaces/nuttx/apps/wireless/bluetooth
mkkconfig in /workspaces/nuttx/apps/wireless/ieee802154
mkkconfig in /workspaces/nuttx/apps/wireless
mkkconfig in /workspaces/nuttx/apps
#
# configuration written to .config
#

Just noticed that some links are absolute, some relative:

$ find . -type l | xargs ls -l
lrwxr-xr-x  1 self  staff  84 17 Aug 20:12 ./Make.defs -> /workspaces/nuttx/nuttx/tools/../boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
lrwxr-xr-x  1 self  staff  65 17 Aug 20:12 ./arch/xtensa/include/board -> /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/include
lrwxr-xr-x  1 self  staff  49 17 Aug 20:12 ./arch/xtensa/include/chip -> /workspaces/nuttx/nuttx/arch/xtensa/include/esp32
lrwxr-xr-x  1 self  staff  67 17 Aug 20:12 ./arch/xtensa/src/board -> /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/../common
lrwxr-xr-x  1 self  staff  45 17 Aug 20:12 ./arch/xtensa/src/chip -> /workspaces/nuttx/nuttx/arch/xtensa/src/esp32
lrwxr-xr-x@ 1 self  staff  35 16 Aug 17:38 ./boards/arm/imx6/sabre-6quad/configs/citest/run -> ../../../../../../tools/ci/cirun.sh
lrwxr-xr-x@ 1 self  staff  38 16 Aug 17:38 ./boards/arm/stm32/emw3162/src/stm32_wlan_firmware.c -> ../../photon/src/stm32_wlan_firmware.c
lrwxr-xr-x@ 1 self  staff  35 16 Aug 17:38 ./boards/risc-v/qemu-rv/rv-virt/configs/citest/run -> ../../../../../../tools/ci/cirun.sh
lrwxr-xr-x@ 1 self  staff  35 16 Aug 17:38 ./boards/risc-v/qemu-rv/rv-virt/configs/citest64/run -> ../../../../../../tools/ci/cirun.sh
lrwxr-xr-x@ 1 self  staff  35 16 Aug 17:38 ./boards/sim/sim/sim/configs/citest/run -> ../../../../../../tools/ci/cirun.sh
lrwxr-xr-x  1 self  staff  61 17 Aug 20:12 ./boards/xtensa/esp32/common/board -> /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/src
lrwxr-xr-x  1 self  staff  37 17 Aug 20:12 ./drivers/platform -> /workspaces/nuttx/nuttx/drivers/dummy
lrwxr-xr-x@ 1 self  staff  25 16 Aug 17:38 ./fs/zipfs/zlib -> ../../../apps/system/zlib
lrwxr-xr-x  1 self  staff  43 17 Aug 20:12 ./include/arch -> /workspaces/nuttx/nuttx/arch/xtensa/include

Running nuttx-12.6.0-RC1.

@serpent213
Copy link
Author

Using this workaround for now:

$ find . -type l -exec bash -c 'for link; do \
  target=$(readlink "$link"); \
  if [ "${target:0:1}" = / ]; then \
    rel_target=$(realpath --relative-to="$(dirname "$link")" "$target"); \
    rm "$link"; \
    ln -s "$rel_target" "$link"; \
    echo relinked target $target -\> $rel_target; \
  fi; \
done' sh {} +
relinked target /workspaces/nuttx/nuttx/drivers/dummy -> dummy
relinked target /workspaces/nuttx/nuttx/arch/xtensa/include -> ../arch/xtensa/include
relinked target /workspaces/nuttx/nuttx/tools/../boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs -> boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
relinked target /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/include -> ../../../boards/xtensa/esp32/esp32-devkitc/include
relinked target /workspaces/nuttx/nuttx/arch/xtensa/include/esp32 -> esp32
relinked target /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/../common -> ../../../boards/xtensa/esp32/common
relinked target /workspaces/nuttx/nuttx/arch/xtensa/src/esp32 -> esp32
relinked target /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc/src -> ../esp32-devkitc/src

@serpent213
Copy link
Author

Found these instrunctions on how to use CMake, it seems it would circumvent the above issue. But it doesn't work:

$ cmake -B build -DBOARD_CONFIG=esp32-devkitc:wifi -GNinja
CMake Error at CMakeLists.txt:233 (message):
  No CMakeLists.txt found at
  /workspaces/nuttx/nuttx/boards/xtensa/esp32/esp32-devkitc


-- Configuring incomplete, errors occurred!

Further I noticed this C++ Example using CMake – but I think what I want is to create one or more apps in my project git repo and have at least one of them started automatically. Also the .config should live in that repo. NuttX might live inside a git submodule. CMake is fine.

Are there any project templates? What are the best practises?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant