zephyrproject-rtos / eclipse-plugin

Zephyr Eclipse Plugin
Eclipse Public License 2.0
16 stars 18 forks source link

Unable to build cross-compile Zephyr project using eclipse-plugin #24

Closed musamaanjum closed 4 years ago

musamaanjum commented 4 years ago

I'm successful in building qemu_riscv64 though west using command line. (I've built riscv64-zephyr-elf toolchain from github.com/riscv/riscv-gnu-toolchian)

export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
export CROSS_COMPILE=/opt/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-
west build -b qemu_riscv64 samples/hello_world
west build -t run

It means the environment on my Ubuntu 18.04 is perfectly fine.

If I create a default project in Eclipse using Zephyr's plugin and Zephyr's SDK, the project builds and runs fine. But when I select the cross-compile in this project's settings instead of ZEPHYR SDK, build fails.

I'm creating qemu_riscv64 hello_world application in Eclipse (2020-03) through the Zephyr Application option in Create Project. After selecting the ZEPHYR_BASE, I'm setting ZEPHYR_TOOLCHAIN_VARIANT to cross-compile and CROSS_COMPILE to /opt/riscv64-zephyr-elf/bin/riscv64-zephyr-elf- while creating project. When I build this project, I get the following error:

----- Generating CMake files for board qemu_riscv64 in build
/usr/local/bin/cmake -DBOARD=qemu_riscv64 -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /var/workspace/ecclipse_zephyr/riscv64
-- Application: /var/workspace/ecclipse_zephyr/riscv64
-- Zephyr version: 2.2.99 (/var/repos/zephyrproject/zephyr)
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.6") 
-- Board: qemu_riscv64
-- Found west: /var/mentor/.local/bin/west (found suitable version "0.7.2", minimum required is "0.7.1")
CMake Error at /var/repos/zephyrproject/zephyr/cmake/generic_toolchain.cmake:64 (include):
  include could not find load file:

    /var/repos/zephyrproject/zephyr/cmake/toolchain/cross-compiler/generic.cmake
-- Found BOARD.dts: /var/repos/zephyrproject/zephyr/boards/riscv/qemu_riscv64/qemu_riscv64.dtsCall Stack (most recent call first):

  /var/repos/zephyrproject/zephyr/cmake/app/boilerplate.cmake:484 (include)
  CMakeLists.txt:3 (include)

CMake Error at /var/repos/zephyrproject/zephyr/cmake/dts.cmake:146 (message):
  command failed with return code: No such file or directory
Call Stack (most recent call first):
  /var/repos/zephyrproject/zephyr/cmake/app/boilerplate.cmake:485 (include)
-- Configuring incomplete, errors occurred!  CMakeLists.txt:3 (include)

----- Done generating CMake files for board qemu_riscv64 in build

This error is coming because of the execution of line 64 in generic_toolchain.cmake. This means the correct cmake file isn't being created when I build through eclipse.

dcpleung commented 4 years ago

The fix is in. You will need to go to your project's properties (right click on your project -> properties), and re-select cross compiler under Zephyr->Toolchain.

musamaanjum commented 4 years ago

How much time does it take until the plugin is updated in its repo (https://builds.zephyrproject.org/eclipse-plugin/) to be updated in the Eclipse? I've just checked and there are no updates available for this plugin.

dcpleung commented 4 years ago

We are trying to setup automatic update from CI at this time. Please wait a few more days.

dcpleung commented 4 years ago

The updated plugin has been uploaded to the site. Could you try again?

musamaanjum commented 4 years ago

I've updated the plugin to version 0.2.99.202005131737 and it works fine. Thank you.