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

Zephyr doesn't build if x86_64 SDK toolchain isn't install #22616

Closed
galak opened this issue Feb 7, 2020 · 7 comments · Fixed by #22681
Closed

Zephyr doesn't build if x86_64 SDK toolchain isn't install #22616

galak opened this issue Feb 7, 2020 · 7 comments · Fixed by #22681
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@galak
Copy link
Collaborator

galak commented Feb 7, 2020

If using the Zephyr SDK and only having one arch toolchain (for example ARM) installed on a x86-host system we get the following:

root@9b2eebb80c9e:~/zephyr/samples/hello_world/build# cmake -DBOARD=frdm_k64f ..
-- Zephyr version: 2.1.99
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.6") 
-- Selected BOARD frdm_k64f
-- Found west: /usr/local/bin/west (found suitable version "0.7.0", minimum required is "0.6.0")
CMake Error at /root/zephyr/cmake/compiler/gcc/generic.cmake:8 (message):
  Zephyr was unable to find the toolchain.  Is the environment misconfigured?

  User-configuration:

  ZEPHYR_TOOLCHAIN_VARIANT: zephyr

  Internal variables:

  CROSS_COMPILE: /root/zephyr-sdk/x86_64-zephyr-elf/bin/x86_64-zephyr-elf-

  TOOLCHAIN_HOME: /root/zephyr-sdk

Call Stack (most recent call first):
  /root/zephyr/cmake/generic_toolchain.cmake:70 (include)
  /root/zephyr/cmake/app/boilerplate.cmake:462 (include)
  CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!
@galak galak added the bug The issue is a bug, or the PR is fixing a bug label Feb 7, 2020
@galak galak added the priority: medium Medium impact/importance bug label Feb 7, 2020
@galak
Copy link
Collaborator Author

galak commented Feb 7, 2020

There's an assumption baked into cmake/toolchain/zephyr/0.11/generic.cmake about having the x86 toolchain installed.

@galak
Copy link
Collaborator Author

galak commented Feb 8, 2020

Seems like we could move setting of CROSS_COMPILE_TARGET_${ARCH} into target.cmake, but we'd have an issue with ARM64. A few options on how we could possibly handle this -- we could move ARM64 boards into their own board/arm64 or board/aarch64 dir than early in boilerplate.cmake we could remap the setting of ARCH and have a SUB_ARCH or something that we can use to distinguish arm v aarch64.

@galak
Copy link
Collaborator Author

galak commented Feb 8, 2020

@carlocaione, @stephanosio @ioannisg @andrewboie @andyross @nashif @dcpleung adding you guys as a FYI to this discussion as there a bit of how do we handle architecture variants in play here. I could see xtensa & risc-v wanting something similar.

@andrewboie
Copy link
Contributor

Why is it unconditionally checking for the x86_64 toolchain? It should be checking for the toolchain used to build the board, this seems like a straightforward bug and not something that requires a lot of discussion.

IOW it's not clear to me what the problem is, can you perhaps rephrase your problem statement?

@galak
Copy link
Collaborator Author

galak commented Feb 8, 2020

There are two files in play, generic.cmake and target.cmake

We we do cmake -DBOARD=foobar we effectively determine the 'ARCH' based on the parent dir of the board. Early on before Kconfig, we are parsing generic.cmake which is doing set(CROSS_COMPILE_TARGET x86_64-${TOOLCHAIN_VENDOR}-elf). While we can move setting of CROSS_COMPILE_TARGET to be ARCH aware, at this point of cmake parsing we only know ARCH, and so for something like aarch64 we only know we are ARM, not aarch64. Similar for xtensa, we know we are xtensa but not S1000 or intel_apl_adsp. So we need some means purely based on the board selection to know the "more specific arch".

The two ideas I have so far are either encoding something in the path or encoding something in a cmake file that the we can get to from boards///.

@andrewboie
Copy link
Contributor

at first glance we might need a CONFIG_ARCH and CONFIG_SUB_ARCH or something so the toolchain to use is completely ambiguous early on 🤔

@dcpleung
Copy link
Member

dcpleung commented Feb 9, 2020

Have you looked at xtools/generic.cmake? It simply looks for any toolchain available under the directory, and could provide a quick workaround for the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants