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

Build does not work on macOS #8

Open
edwardalee opened this issue Jun 24, 2024 · 3 comments
Open

Build does not work on macOS #8

edwardalee opened this issue Jun 24, 2024 · 3 comments

Comments

@edwardalee
Copy link
Contributor

On macOS, following the instructions in the docs pointed to here, I get cmake errors running lfc:

(.venv) ~/git/lf-zephyr-workspace/apps/HelloWorld % pwd
/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld
(.venv) ~/git/lf-zephyr-workspace/apps/HelloWorld % lfc --version
lfc 0.7.3-SNAPSHOT 345df42a9 2024-06-13
(.venv) ~/git/lf-zephyr-workspace/apps/HelloWorld % lfc src/HelloWorld.lf 
lfc: info: Generating code for: file:/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src/HelloWorld.lf
lfc: info: Generation mode: STANDALONE
lfc: info: Generating sources into: /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld
lfc: info: Target Configuration:
      - single-threaded: true
      - platform: PlatformOptions[platform=zephyr, board=Option[setByUser=false, value=null], port=Option[setByUser=false, value=null], baudRate=Option[setByUser=false, value=0], flash=Option[setByUser=false, value=false], userThreads=Option[setByUser=false, value=0]]
Cleaning /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/include

Cleaning /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/build
--- Current working directory: /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/build
--- Executing command: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld -DCMAKE_INSTALL_BINDIR=bin -DLF_FILE_SEPARATOR="/" -DLF_SOURCE_DIRECTORY="/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src" -DLF_PACKAGE_DIRECTORY="/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld" -DLF_SOURCE_GEN_DIRECTORY="/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld" /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld
-- Application: /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld
-- CMake version: 3.29.6
-- Found Python3: /Users/edwardlee/git/lf-zephyr-workspace/.venv/bin/python3.10 (found suitable exact version "3.10.13") found components: Interpreter
-- Cache files will be written to: /Users/edwardlee/Library/Caches/zephyr
-- Zephyr version: 3.4.0 (/Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
Loading Zephyr default modules (Freestanding).
CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:49 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:52 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:55 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:58 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:61 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:73 (math):
  math cannot parse the expression: "( << 16) + ( << 8) + ()": syntax error,
  unexpected exp_SHIFTLEFT (4).
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/version.cmake:74 (math):
  math cannot parse the expression: "( << 24) + ( << 16) + ( << 8) + ()":
  syntax error, unexpected exp_SHIFTLEFT (4).
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


-- Board: qemu_cortex_m3
-- Found host-tools: zephyr 0.16.3 (/opt/zephyr-sdk-0.16.3)
-- Found toolchain: zephyr 0.16.3 (/opt/zephyr-sdk-0.16.3)
-- Found Dtc: /opt/homebrew/bin/dtc (found suitable version "1.7.0", minimum required is "1.4.6")
-- Found BOARD.dts: /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/boards/arm/qemu_cortex_m3/qemu_cortex_m3.dts
-- Generated zephyr.dts: /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/build/zephyr/dts.cmake
Parsing /Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/Kconfig
-- Configuring incomplete, errors occurred!
/Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/scripts/kconfig/kconfig.py: Kconfig.zephyr:8: Could not open '/Users/edwardlee/git/lf-zephyr-workspace/apps/HelloWorld/src-gen/HelloWorld/VERSION' (in 'osource "${APPLICATION_SOURCE_DIR}/VERSION"') (EISDIR: Is a directory)
CMake Error at /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/kconfig.cmake:343 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /Users/edwardlee/Dropbox/Projects/Zepher/lf-zephyr-workspace/deps/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:159 (include_boilerplate)
  CMakeLists.txt:12 (find_package)


lfc: error: CMake failed with error code 1
lfc: error: Compilation was unsuccessful.
lfc: fatal error: Aborting due to 2 previous errors.
@erlingrj
Copy link
Collaborator

Thanks for the report. Will look at it now

@erlingrj
Copy link
Collaborator

This might be due to a mismatch between the Zephyr version you are using (v3.4.0) and the SDK version you have installed (v0.16.3).

My docs in the handbook have not been explicit enough on exactly which versions to install. I am currently working on doing an update to Zephyr v3.7.0 which uses SDK v0.16.8. Will notify when this is ready and you can test it out on your macbook.

@erlingrj
Copy link
Collaborator

Update:

This appears to be a bug in the Zephyr CMake system which arise only on macOS when there is a file/folder named version in the root of the project. I have filed an issue with Zephyr here: zephyrproject-rtos/zephyr#78501

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