urob / zmk-helpers

Convenience macros simplifying ZMK's keymap configuration
MIT License
235 stars 79 forks source link

Error building through Github workflows #9

Closed jbsoum closed 1 year ago

jbsoum commented 1 year ago

trying to build using Github workflows, I get the following error:


 devicetree error: /__w/zmk-config/zmk-config/config/kyria_rev3.keymap:85 (column 132): parse error: expected number or parenthesized expression
CMake Error at /__w/zmk-config/zmk-config/zephyr/cmake/dts.cmake:205 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):
  /__w/zmk-config/zmk-config/zephyr/cmake/app/boilerplate.cmake:542 (include)
-- Configuring incomplete, errors occurred!
  /__w/zmk-config/zmk-config/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /__w/zmk-config/zmk-config/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
  CMakeLists.txt:15 (find_package)

FATAL ERROR: command exited with status 1: /usr/local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/__w/zmk-config/zmk-config/build -S/__w/zmk-config/zmk-config/zmk/app -GNinja -DBOARD=nice_nano_v2 -DZMK_CONFIG=/__w/zmk-config/zmk-config/config -DSHIELD=kyria_rev3_left
Error: Process completed with exit code 1.

I was able to successfully build using a default keymap

urob commented 1 year ago

Do you have a link to the repo with the failed config file?

jbsoum commented 1 year ago

https://github.com/jbsoum/zmk-config

urob commented 1 year ago

The issue is on this line here: https://github.com/jbsoum/zmk-config/blob/50925cc7763746a0f7a3f055b4dfba9f2d98481c/config/kyria_rev3.keymap#L86

AMP doesn't seem to be a valid ZMK keycode (https://zmk.dev/docs/codes). Can you try AMPS?

jbsoum commented 1 year ago

Good call! That was helpful, I was able to identify a few other issues, but I have run into one I can't seem to diagnose.

Link to dev branch here: https://github.com/jbsoum/zmk-config/tree/dev_behavioral_autoshift

Run west build -s zmk/app -b nice_nano_v2 -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/config -DSHIELD="kyria_rev3_left" 
+ west build -s zmk/app -b nice_nano_v2 -- -DZMK_CONFIG=/__w/zmk-config/zmk-config/config -DSHIELD=kyria_rev3_left
-- west build: generating a build system
Including boilerplate (Zephyr base): /__w/zmk-config/zmk-config/zephyr/cmake/app/boilerplate.cmake
-- Application: /__w/zmk-config/zmk-config/zmk/app
-- Adding /__w/zmk-config/zmk-config/zmk/app/boards/shields/kyria
-- ZMK Config directory: /__w/zmk-config/zmk-config/config
-- ZMK Config Kconfig: /__w/zmk-config/zmk-config/config/kyria_rev3.conf
-- Using keymap file: /__w/zmk-config/zmk-config/config/kyria_rev3.keymap
-- Using keymap file: /__w/zmk-config/zmk-config/config/kyria_rev3.keymap
-- Zephyr version: 3.0.0 (/__w/zmk-config/zmk-config/zephyr)
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter 
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nice_nano_v2, Shield(s): kyria_rev3_left
-- Cache files will be written to: /__w/zmk-config/zmk-config/zephyr/.cache
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.15.2 (/opt/zephyr-sdk-0.15.2)
-- Found dtc: /opt/zephyr-sdk-0.15.2/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.15.2 (/opt/zephyr-sdk-0.15.2)
-- Found BOARD.dts: /__w/zmk-config/zmk-config/zmk/app/boards/arm/nice_nano/nice_nano_v2.dts
-- Found devicetree overlay: /__w/zmk-config/zmk-config/zmk/app/boards/shields/kyria/kyria_rev3_left.overlay
-- Found devicetree overlay: /__w/zmk-config/zmk-config/zmk/app/boards/shields/kyria/boards/nice_nano_v2.overlay
-- Found devicetree overlay: /__w/zmk-config/zmk-config/config/kyria_rev3.keymap
devicetree error: missing data after phandle in <Property 'bindings' at '/behaviors/layer' in '/__w/zmk-config/zmk-config/zephyr/misc/empty_file.c'>
CMake Error at /__w/zmk-config/zmk-config/zephyr/cmake/dts.cmake:205 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):
  /__w/zmk-config/zmk-config/zephyr/cmake/app/boilerplate.cmake:542 (include)
-- Configuring incomplete, errors occurred!
  /__w/zmk-config/zmk-config/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /__w/zmk-config/zmk-config/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
  CMakeLists.txt:15 (find_package)
urob commented 1 year ago

I just had a look. It seems your last working config is 32 commits ago and there are quite a few changes, making it a bit hard to debug. I would suggest to go back to your last working commit and add features one-by-one to isolate what's working and what's not. Does it work without the sensor-bindings?

jbsoum commented 1 year ago

Okay, getting closer! Commenting everything out and re-incorporating line by line, it seems like this error is preventing the config from compiling. Specifically the mod_morph at the bottom:

// layer buttons (jbsoum add)
ZMK_BEHAVIOR(ly_def, macro,
     bindings 
          = <&macro_tap &to DEF>
          , <&macro_tap &rgb_ug RGB_COLOR_HSB(45,20,100)>
          ;
 )
ZMK_BEHAVIOR(ly_numhld, macro,
     bindings 
          = <&macro_tap &rgb_ug RGB_COLOR_HSB(110,25,100)>
          , <&macro_press &mo NUM>
          , <&macro_pause_for_release>
          , <&macro_release &mo NUM>
          , <&macro_tap &rgb_ug RGB_COLOR_HSB(45,20,100)>
          ;
 )
ZMK_BEHAVIOR(ly_numtap, macro,
     bindings 
          = <&macro_tap &to NUM>
          , <&macro_tap &rgb_ug RGB_COLOR_HSB(110,25,100)>
          ;
 )
ZMK_BEHAVIOR(ly_nav, macro,
     bindings 
          = <&macro_tap &to NAV>
          , <&macro_tap &rgb_ug RGB_COLOR_HSB(170,25,100)>
          ;
)

ZMK_BEHAVIOR(ly_num, hold_tap,
     flavor = "hold-preferred";
     tapping_term_ms = <200>;
     quick_tap_ms = <0>;
     bindings = <&ly_numhld>, <&ly_numtap>;
)

ZMK_BEHAVIOR(ly, mod_morph,
     bindings = <&ly_num>, <&ly_nav>;
     mods = <(MOD_RCTL|MOD_LCTL)>;
)

That mod_morph takes a hold tap for first parameter, and a macro for the second. Uncommenting the ly mod_morph above results in the following error:

 -- Found devicetree overlay: /__w/zmk-config/zmk-config/config/kyria_rev3.keymap
devicetree error: missing data after phandle in <Property 'bindings' at '/behaviors/ly' in '/__w/zmk-config/zmk-config/zephyr/misc/empty_file.c'>
CMake Error at /__w/zmk-config/zmk-config/zephyr/cmake/dts.cmake:205 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):
  /__w/zmk-config/zmk-config/zephyr/cmake/app/boilerplate.cmake:542 (include)
  /__w/zmk-config/zmk-config/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /__w/zmk-config/zmk-config/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
  CMakeLists.txt:15 (find_package)
urob commented 1 year ago

Can you break it down further? Are all the rgb_ug commands working if you put them directly on the keymap? If so, what about each of the macros? If so, what about the two hold-taps? That's how I usually try to isolate the error if it isn't immediately obvious.

urob commented 1 year ago

Actually, you are not passing any arguments to the hold taps. It requires two arguments but you are passing none. Try adding 0 0 to each of the hold-taps when binding them to the mod-morph.

(NB: args to the mod-morph on your keymap aren't passed-through because the mod-morph doesn't take any args).

urob commented 1 year ago

Did this work? In either case, I am closing this as it doesn't seem to be an issue with this repo. Feel free to reopen if you think something is wrong with this repo.

jbsoum commented 1 year ago

It did indeed! Thanks for the tip! Would have never thought to do that otherwise. Have been fixing a series of other bugs, and finally have something resembling a working config. Thank you!