evmar / n2

n2 ("into"), a ninja compatible build system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

n2 missing file building lldb

keith opened this issue · comments

In LLVM, building lldb with a build directory generated with:

cmake ../llvm -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_PROJECTS='lldb;clang' -DLLDB_ENABLE_PYTHON=true -DLLDB_ENABLE_SWIG=true -DLLDB_INCLUDE_TESTS=true -DLLVM_ENABLE_RUNTIMES=libcxx

Running

ninja lldb

eventually fails (after building ~4k files) with:

n2: error: build.ninja:95047: input tools/lldb/CMakeFiles/lldb-python missing

This failure doesn't happen with ninja

I reproduced this with llvm. Build files look like:

build tools/lldb/CMakeFiles/lldb-python: ...
  command = mkdir unrelated_directory

build tools/lldb/CMakeFiles/lldb-python.util: CUSTOM_COMMAND tools/lldb/CMakeFiles/lldb-python ...

So one step claims it writes a file, and then the next step claims it uses it. I need to dig into why Ninja even accepts this.

I really appreciate you taking the time to try out n2 and file a bug report!

I pushed a fix for this that is kind of scary to me, so if you try it out let me know if you run into anything else funny.

$ ninja -C ~/projects/llvm-project-16.0.0.src/build lldb | cat
Python script sym-linking LLDB Python API
Running utility command for lldb-python
n2: ran 2 tasks, now up to date

$ touch /Users/evmar/projects/llvm-project-16.0.0.src/lldb/source/DataFormatters/TypeCategory.cpp
$ ninja -C ~/projects/llvm-project-16.0.0.src/build lldb | cat                                   
Building CXX object tools/lldb/source/DataFormatters/CMakeFiles/lldbDataFormatters.dir/TypeCategory.cpp.o
Linking CXX static library lib/liblldbDataFormatters.a
Linking CXX shared library lib/liblldb.16.0.0.dylib
Creating library symlink lib/liblldb.dylib
Python script sym-linking LLDB Python API
Running utility command for lldb-python
Linking CXX executable bin/lldb
n2: ran 7 tasks, now up to date

Ha, thanks!