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

Compilation issue with zephyr #426

Closed
mtreddy opened this issue Oct 5, 2022 · 9 comments · Fixed by #431
Closed

Compilation issue with zephyr #426

mtreddy opened this issue Oct 5, 2022 · 9 comments · Fixed by #431

Comments

@mtreddy
Copy link

mtreddy commented Oct 5, 2022

When building for zephyr I am seeing compilation issues as following.

CMake Error at lib/CMakeLists.txt:43 (add_dependencies)
add_dependencies called with incorrect number of arguments
-- at line number 42 --
add_dependencies(${ZEPHYR_CURRENT_LIBRARY} ${OFFSETS_H_TARGET})
-- if I change this to --
add_dependencies(${ZEPHYR_CURRENT_LIBRARY} DEPENDS ${OFFSETS_H_TARGET})

It proceeds further but it fails with "TARGET SOURCE no files found".

Any cluse what should be in "${ZEPHYR_CURRENT_LIBRARY} DEPENDS ${OFFSETS_H_TARGET) "supposed to be?

@arnopo
Copy link
Collaborator

arnopo commented Oct 6, 2022

Hello,
Could you give more details to help to reproduce?
Zephyr version used ( or the sha1), your own updates, the build command used....

In addition could you send a Pull request with the fix you propose?

@carlocaione : do you detect this issue in your Zephyr environment?

Thanks,

@carlocaione
Copy link
Collaborator

I'm not seeing that. @mtreddy how are you compiling it?

@mtreddy
Copy link
Author

mtreddy commented Oct 6, 2022

Hi ,
Zephyr version I am using is
commit 4f8d78ceeb436e82f528511998515f6fc137c6cd (tag: zephyr-v3.0.0, tag: v3.0.0)
Here are the steps I used:

  1. Pull zephyr v3.0.0 . Built it for qemu_crotexm3
  2. pulled libmetal and built against zephyr I pulled in step-1 for qemu_cortexm3
  3. then pulled open-amp and switched to branch tag: v2022.04.0,
  4. Followed build commands as "make ./ -DWITH_ZEPHYR=on -DBOARD=qemu_cortex_m3 -DCMAKE_INCLUDE_PATH=/src/prog/rtos/libmetal/build/lib/include -DCMAKE_LIBRARY_PATH=/src/prog/rtos/libmetal/build/lib -DWITH_STATIC_LIB=on -DWITH_APPS=on -Bbuild --debug-output"
  5. I have added DEPENDS to move past first errro "add_dependencies(${ZEPHYR_CURRENT_LIBRARY} DEPENDS ${OFFSETS_H_TARGET})"
  6. Below is the error I am seeing. I copy pasted last part.

Returning to /User_data/home/tmarri/src/prog/rtos/open-amp/apps
Called from: [1] /User_data/home/tmarri/src/prog/rtos/open-amp/apps/CMakeLists.txt
Returning to /User_data/home/tmarri/src/prog/rtos/open-amp
Called from: [1] /User_data/home/tmarri/src/prog/rtos/open-amp/CMakeLists.txt
-- Configuring done
CMake Error at /User_data/home/tmarri/src/kw/zephyr/zephyrproject/zephyr/cmake/extensions.cmake:421 (add_library):
No SOURCES given to target: app
Call Stack (most recent call first):
/User_data/home/tmarri/src/kw/zephyr/zephyrproject/zephyr/cmake/app/boilerplate.cmake:671 (zephyr_library_named)
cmake/syscheck.cmake:8 (include)
CMakeLists.txt:19 (include)

CMake Generate step failed. Build files cannot be regenerated correctly.
tmarri@vm-swbuild03:~/src/prog/rtos/open-amp$

@mtreddy
Copy link
Author

mtreddy commented Oct 6, 2022

I'm not seeing that. @mtreddy how are you compiling it?

@carlocaione , looks like we responded same time. Pl see my message above.

@mtreddy
Copy link
Author

mtreddy commented Oct 6, 2022

This time I have pulled zypherproject and SDK sephyr-sdk-0.15.0 . And I still see the issue. Could you pl let me know which version zephyr you use?

dini2@dini2:/tmarri/src/open-amp$ cmake ./ -DWITH_ZEPHYR=on -DBOARD=qemu_cortex_m3 -DCMAKE_INCLUDE_PATH=/tmarri/src/libmetal/build/lib/include/ -DCMAKE_LIBRARY_PATH=~/tmarri/src/libmetal/build/lib/ -Bbuild
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: /home/dini2/tmarri/src/open-amp
-- Cache files will be written to: /home/dini2/.cache/zephyr
-- Zephyr version: 3.2.99 (/home/dini2/tmarri/src/zephyrproject/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: qemu_cortex_m3
-- Found host-tools: zephyr 0.15.0 (/home/dini2/tmarri/src/zephyr-sdk-0.15.0)
-- Found toolchain: zephyr 0.15.0 (/home/dini2/tmarri/src/zephyr-sdk-0.15.0)
-- Found BOARD.dts: /home/dini2/tmarri/src/zephyrproject/zephyr/boards/arm/qemu_cortex_m3/qemu_cortex_m3.dts
-- Generated zephyr.dts: /home/dini2/tmarri/src/open-amp/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/dini2/tmarri/src/open-amp/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/dini2/tmarri/src/open-amp/build/zephyr/dts.cmake
Parsing /home/dini2/tmarri/src/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/dini2/tmarri/src/open-amp/build/zephyr/.config'
No change to configuration in '/home/dini2/tmarri/src/open-amp/build/zephyr/.config'
No change to Kconfig header in '/home/dini2/tmarri/src/open-amp/build/zephyr/include/generated/autoconf.h'
-- open-amp version: 1.2.0 (/home/dini2/tmarri/src/open-amp)
-- Host: Linux/x86_64
-- Target: Generic/arm
-- Machine: cortexm
-- C_FLAGS : -Wall -Wextra
-- Found Libmetal: /home/dini2/tmarri/src/libmetal/build/lib/libmetal.a
-- Looking for include file stdatomic.h
-- Looking for include file stdatomic.h - found
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
CMake Error at lib/CMakeLists.txt:42 (add_dependencies):
add_dependencies called with incorrect number of arguments

-- Configuring incomplete, errors occurred!
See also "/home/dini2/tmarri/src/open-amp/build/CMakeFiles/CMakeOutput.log".
See also "/home/dini2/tmarri/src/open-amp/build/CMakeFiles/CMakeError.log".
dini2@dini2:/tmarri/src/open-amp$ vi lib/CMakeLists.txt
dini2@dini2:
/tmarri/src/open-amp$ cmake ./ -DWITH_ZEPHYR=on -DBOARD=qemu_cortex_m3 -DCMAKE_INCLUDE_PATH=/tmarri/src/libmetal/build/lib/include/ -DCMAKE_LIBRARY_PATH=/tmarri/src/libmetal/build/lib/ -Bbuild
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: /home/dini2/tmarri/src/open-amp
-- Cache files will be written to: /home/dini2/.cache/zephyr
-- Zephyr version: 3.2.99 (/home/dini2/tmarri/src/zephyrproject/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: qemu_cortex_m3
-- Found host-tools: zephyr 0.15.0 (/home/dini2/tmarri/src/zephyr-sdk-0.15.0)
-- Found toolchain: zephyr 0.15.0 (/home/dini2/tmarri/src/zephyr-sdk-0.15.0)
-- Found BOARD.dts: /home/dini2/tmarri/src/zephyrproject/zephyr/boards/arm/qemu_cortex_m3/qemu_cortex_m3.dts
-- Generated zephyr.dts: /home/dini2/tmarri/src/open-amp/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/dini2/tmarri/src/open-amp/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/dini2/tmarri/src/open-amp/build/zephyr/dts.cmake
Parsing /home/dini2/tmarri/src/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/dini2/tmarri/src/open-amp/build/zephyr/.config'
No change to configuration in '/home/dini2/tmarri/src/open-amp/build/zephyr/.config'
No change to Kconfig header in '/home/dini2/tmarri/src/open-amp/build/zephyr/include/generated/autoconf.h'
-- open-amp version: 1.2.0 (/home/dini2/tmarri/src/open-amp)
-- Host: Linux/x86_64
-- Target: Generic/arm
-- Machine: cortexm
-- C_FLAGS : -Wall -Wextra
-- Configuring done
CMake Error at /home/dini2/tmarri/src/zephyrproject/zephyr/cmake/modules/extensions.cmake:418 (add_library):
No SOURCES given to target: app
Call Stack (most recent call first):
/home/dini2/tmarri/src/zephyrproject/zephyr/cmake/modules/kernel.cmake:209 (zephyr_library_named)
/home/dini2/tmarri/src/zephyrproject/zephyr/cmake/modules/zephyr_default.cmake:117 (include)
/home/dini2/tmarri/src/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
/home/dini2/tmarri/src/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
/home/dini2/tmarri/src/zephyrproject/zephyr/cmake/app/boilerplate.cmake:25 (find_package)
cmake/syscheck.cmake:8 (include)
CMakeLists.txt:18 (include)

CMake Generate step failed. Build files cannot be regenerated correctly.

@mtreddy
Copy link
Author

mtreddy commented Oct 7, 2022

When I printed the messages for "${ZEPHYR_CURRENT_LIBRARY} ${OFFSETS_H_TARGET} "and in lib/CMakeLists.txt

if (WITH_ZEPHYR)
zephyr_library_named(${OPENAMP_LIB})
message(STATUS "openamp_li :${OPENAMP_LIB}")
message(STATUS "zephyr_cur: ${ZEPHYR_CURRENT_LIBRARY} ")
message(STATUS "offset_h: ${OFFSETS_H_TARGET}")
add_dependencies(${ZEPHYR_CURRENT_LIBRARY} ${OFFSETS_H_TARGET})
zephyr_library_sources(${_sources})
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

in the output there is no value assigned to OFFSETS_H_TARGET

-- openamp_li :open_amp
-- zephyr_cur: open_amp
-- offset_h:
CMake Error at lib/CMakeLists.txt:45 (add_dependencies):
add_dependencies called with incorrect number of arguments

--

that could be why config is failing.

@carlocaione
Copy link
Collaborator

Zephyr is already shipping its own libmetal and openamp shims (see https://github.com/zephyrproject-rtos/libmetal and https://github.com/zephyrproject-rtos/open-amp) so you should not pull anything from the official repos since both are already correctly integrated in zephyr.

Please see the samples in https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc for the correct way to integrate openamp with Zephyr.

@mtreddy
Copy link
Author

mtreddy commented Oct 10, 2022

Thanks for the help. I am able to build in Zephyr tree it self using " west build -b mps2_an521 samples/subsys/ipc/rpmsg_service" . BTW there is typo in README it say ZEPHRY it should be ZEPHYR.

@arnopo
Copy link
Collaborator

arnopo commented Oct 13, 2022

Hi,
Thanks @carlocaione for your help. As you mentioned and as it partially explained at the beginning of the README Zephyr section in the README.md, the zephyr environment as to be used in this case
I will clean the second part that involves too much cross-dependency between OpenAMP and Zephyr

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

Successfully merging a pull request may close this issue.

3 participants