Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Ninja can no longer build due to cycling input #774

Open
kylef opened this issue Mar 16, 2020 · 2 comments
Open

Ninja can no longer build due to cycling input #774

kylef opened this issue Mar 16, 2020 · 2 comments
Labels

Comments

@kylef
Copy link
Member

kylef commented Mar 16, 2020

$ mkdir build
$ cd build
$ cmake -GNinja ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Testing dependencies .
-- Setting up tests for production...
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kyle/Projects/apiaryio/drafter/build

$ ninja
ninja: warning: phony target 'src/drafter' names itself as an input; ignoring [-w phonycycle=warn]
ninja: warning: multiple rules generate src/drafter. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]
ninja: error: dependency cycle: src/drafter -> src/CMakeFiles/drafter -> src/drafter
@kylef kylef added the bug label Mar 16, 2020
@kylef
Copy link
Member Author

kylef commented Oct 2, 2020

I’ve spent a bit of time on this, the underlying problem is that the drafter-cli target has an output name of drafter (the binary name is drafter). We also have a custom aggregate target called drafter which runs the targets drafter-cli, libdrafter etc at the same time.

Various package managers script (homebrew, aur, dockerfiles) use make drafter (thus this is expected and depended upon behaviour). make drafter builds everything needed for make install to work.

While this works fine with the makefile generator, under ninja both these parts cause different targets with the same name. This also results in circular reference because the drafter aggregate target which depends on drafter-cli (which ninja calls drafter). This problem manifests differently in newer versions of CMake.

I don’t see an easy solution.

@SMillerDev
Copy link
Contributor

Homebrew is now over to a full CMake build

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants