Skip to content

cmake failure using ExternalProject and dependancies w/ninja #7760

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

Closed
galak opened this issue May 22, 2018 · 7 comments
Closed

cmake failure using ExternalProject and dependancies w/ninja #7760

galak opened this issue May 22, 2018 · 7 comments
Assignees
Labels
area: Build System 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 May 22, 2018

The following testcase fails:

./scripts/sanitycheck -p lpcxpresso54114_m4 -s samples/subsys/ipc/ipm_mcux/test -N

We get the following error:

-- Build files have been written to: /home/galak/git/zephyr/sanity-out/lpcxpresso54114_m4/samples/subsys/ipc/ipm_mcux/test
ninja: Entering directory `/home/galak/git/zephyr/sanity-out/lpcxpresso54114_m4/samples/subsys/ipc/ipm_mcux/test'
ninja: error: 'ipm_mcux_remote-prefix/src/ipm_mcux_remote-build/zephyr/zephyr.bin', needed by 'zephyr/include/generated/core-m0.inc', missing and no known rule to make it
@galak galak added bug The issue is a bug, or the PR is fixing a bug area: Build System labels May 22, 2018
@nashif nashif added the priority: medium Medium impact/importance bug label May 22, 2018
@SebastianBoe
Copy link
Collaborator

SebastianBoe commented May 23, 2018

This is due to the dependencies being wrong.

I would recommend reading

https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/

and then having a look at how the dependencies are set up.

An example of this working in practice can be seen in the toplevel CMakeLists.txt

  # Use gperf to generate C code (PRIV_STACKS_OUTPUT_SRC_PRE) which implements a
  # perfect hashtable based on PRIV_STACKS
  add_custom_command(
    OUTPUT ${PRIV_STACKS_OUTPUT_SRC_PRE}
    COMMAND
    ${GPERF} -C
    --output-file ${PRIV_STACKS_OUTPUT_SRC_PRE}
    ${PRIV_STACKS}
    DEPENDS priv_stacks ${PRIV_STACKS}
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    )
  add_custom_target(priv_stacks_output_src_pre DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PRIV_STACKS_OUTPUT_SRC_PRE})

@galak
Copy link
Collaborator Author

galak commented May 23, 2018

I've read the link, but not sure I quite follow or understand how the dependancies are wrong in the case of this issue.

@SebastianBoe
Copy link
Collaborator

Pretty sure this is due to the lack of BUILD_BYPRODUCTS. See https://stackoverflow.com/questions/40314785/linking-against-an-externalproject-add-dependency-in-cmake

@SebastianBoe
Copy link
Collaborator

This commit proves that this is related to BUILD_BYPRODUCTS.

SebastianBoe@ea180e1

The patch needs to be cleaned up before it can be usptreamed though.

@nashif nashif added priority: low Low impact/importance bug and removed priority: medium Medium impact/importance bug labels May 27, 2018
@nashif
Copy link
Member

nashif commented May 27, 2018

bug in a sample, this should not be blocking a release, so move to low priority

@galak
Copy link
Collaborator Author

galak commented Sep 18, 2018

@tejlmand Can you take a look at this and see how we should fix it.

@nashif nashif added priority: medium Medium impact/importance bug and removed priority: low Low impact/importance bug labels Sep 18, 2018
nashif added a commit to nashif/zephyr that referenced this issue Sep 19, 2018
Fixed building with ninja adding BUILD_BYPRODUCTS based on suggestion
from @SebastianBoe in issue zephyrproject-rtos#7760.

Fixes zephyrproject-rtos#7760

Signed-off-by: Anas Nashif <[email protected]>
@nashif nashif closed this as completed in 006ca97 Sep 19, 2018
@tejlmand
Copy link
Collaborator

@galak Will do

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

No branches or pull requests

4 participants