I set up a workstation with Ubuntu 18.04 LTS and discovered that the device-tree-compiler is out of date:
CMake Error at /home/apboie/projects/zephyr/zephyr/cmake/extensions.cmake:1111 (message):
Assertion failed: The detected dtc version is unsupported.
The version was found to be 1.4.5
But the minimum supported version is 1.4.6
See https://docs.zephyrproject.org/latest/getting_started/
for how to use the SDK's dtc alongside a custom toolchain.
However, the provided link gives no information about using an alternate dtc binary. I have the Zephyr SDK 0.10 set up.
The SDK supposedly has a binary, but I can't seem to get the build to use it. If I do "sudo apt remove device-tree-compiler" it removes it, and then I get this when I try to build:
The version was found to be 0.5.7
But the minimum supported version is 1.4.6
I don't know where it is getting this 0.5.7 version of dtc
The SDK supposedly has a binary, but I can't seem to get the build to use it
Strange, this works perfectly well for me. I have dtc 1.4.5 in my system, but the build correctly uses the one in my SDK:
$ ~/bin/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/dtc --version
Version: DTC 1.4.7-g78e113e8-dirty
@andrewboie note that you need to set:
ZEPHYR_SDK_INSTALL_DIR="/home/carles/bin/zephyr-sdk"
for the build system to find your dtc.
This is documented here:
https://docs.zephyrproject.org/latest/getting_started/index.html#set-up-a-toolchain
If you want, you can use the SDK host tools (such as OpenOCD) with a different toolchain by keeping the ZEPHYR_SDK_INSTALL_DIR environment variable set to the Zephyr SDK installation directory, while setting ZEPHYR_TOOLCHAIN_VARIANT appropriately for a non-SDK toolchain.
It doesn't mention dtc, but the concept is documented.
I have ZEPHYR_SDK_INSTALL_DIR set, but it still couldn't find it.
I had to download dtc manually compile and install it. Then I was able to run sanitycheck.
@andrewboie I am puzzled then because it should search first CMAKE_PREFIX_PATH and then PATH. And it is being added to CMAKE_PREFIX_PATH according to:
https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/toolchain/zephyr/0.10.0/host-tools.cmake#L9
Can you please double-check that your ZEPHYR_SDK_INSTALL_DIR is pointing to a correct installation of 0.10.0?
@andrewboie do you happen to have DTC set in your environment?
@andrewboie do you happen to have DTC set in your environment?
I thought about that but even then find_program should give precedence to the CMAKE_PREFIX_PATH according to CMake doc.
This must have something weird but transitory in my environment when I was setting up this workstation, seems to be fine now. Sorry for the noise!
@carlescufi @andrewboie FYI, I'm seeing the same misbehavior (not finding the dtc in the Zephyr SDK). I also observed a new user following the getting started instructions on a clean Ubuntu system and having the same problem.
For this to work properly you need to set two environment variables:
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
I had misspelled ZEPHYR_TOOCHAIN_VARIANT (left off the L), doh. For the "new user" they only set the ZEPHYR_SDK_INSTALL_DIR variable and not ZEPHYR_TOOLCHAIN_VARIANT.
I'm reopening this.
People are still reporting this issue on the mailing list.
Same problem here. I tried to build the sample(hello world) on RISCV qemu. But the DTC:FILEPATH link to the local dtc.
//zephyr/build-example/CMakeCache.txt
...
DTC:FILEPATH=/usr/local/dtc
So I manually replaced it with /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/dtc, and it worked. But I failed to reproduce it. It seems there might be an unexpected condition which makes it link to local dtc in cmake files.
This typically happens only if you already have a build folder that has found a system-wide DT. The solution is to completely remove the build folder and run CMake again. This has been confirmed several times, so closing this unless @yenWu still sees the issue even after removing the full build folder.
Issue is closed but just as an update, I think whoever is seeing this issue must have moved the SDK location after installation.
For example on my system, the dtc path right now is /opt/zephyr-sdk-0.10/sysroots/x86_64-pokysdk-linux/usr/bin/dtc. On trying to execute the file I just see:
tavish@resurgam:~ $ /opt/zephyr-sdk-0.10/sysroots/x86_64-pokysdk-linux/usr/bin/dtc
bash: /opt/zephyr-sdk-0.10/sysroots/x86_64-pokysdk-linux/usr/bin/dtc: No such file or directory
tavish@resurgam:~ $ file /opt/zephyr-sdk-0.10/sysroots/x86_64-pokysdk-linux/usr/bin/dtc
/opt/zephyr-sdk-0.10/sysroots/x86_64-pokysdk-linux/usr/bin/dtc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /opt/zep, for GNU/Linux 3.2.0, BuildID[sha1]=9a0e353686d13fed7e6496f553c3838571239bd2, stripped
The dynamic linker/loader path is different than it should be because I must have moved it after installation:
tavish@resurgam:~ $ readelf -a /opt/zephyr-sdk-0.10/sysroots/x86_64-pokysdk-linux/usr/bin/dtc | grep interp
[ 1] .interp PROGBITS 0000000000400238 00000238
[Requesting program interpreter: /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2]
Most helpful comment
This typically happens only if you already have a build folder that has found a system-wide DT. The solution is to completely remove the build folder and run CMake again. This has been confirmed several times, so closing this unless @yenWu still sees the issue even after removing the full build folder.