ninja: error: loading 'build.ninja': No such file or directory

Created on 29 Aug 2018  ·  23Comments  ·  Source: ninja-build/ninja

environment :Mac
Install ninja with the brew intsall ninja command
then on terminal execute ninja occur ninja: error: loading 'build.ninja': No such file or directory 。
➜ ~ ninja
ninja: error: loading 'build.ninja': No such file or directory
➜ ~

Why is this problem still occurring when you have successfully installed ninja?

Most helpful comment

I got how to work use gn gen out/Default , then you will find build.ninja file in /out/Default
run ninja under /out/Default

All 23 comments

Are you just running ninja with no arguments?

@mydongistiny yes ! Need to take parameters?

I got the same. I have install using apt-get install ninja-build on ubuntu 18.04.

The error occurs with or without arguments

I have the same issue and also using apt-get install ninja-build on ubuntu 18.04.

on windows too.

Depending on what project you're building and what arguments you are using you may need to set

GYP_GENERATORS=ninja

Nobody is giving any other information about full command, project you're trying to build etc. There's a few reasons why you could get this error.

even i have come across this issue.
when i was trying to download fuse

and i get the same error when i give the command ninja or apt-get install ninja
screenshot from 2018-10-10 21-22-06

@ThanushreeEG what was the output of meson --reconfigure? Did it run ninja for you?

@AmjadHD Have you solved this problem? I am also meet this error on Windows.

@ThanushreeEG Does the build.ninja file exist in the CWD though? If not, this sound's like a Meson bug to me.

To answer the original question:

Why is this problem still occurring when you have successfully installed ninja?

Because Ninja needs a build definition file in the current working directory.

Same problem on ubuntu 18.04

```damien@Earth2:~$ sudo ninja -v
ninja: error: loading 'build.ninja': No such file or directory
damien@Earth2:~$ meson --reconfigure
Error during basic setup:

Must specify at least one directory name.
```

@hyperfraise It seems you're running meson in your home directory.

I too encounter the same problem when I tried to build LLVM on windows.

cmake -G ninja ../llvm

+1 tried on two mac and install from brew or source, all get error loading

[Solved] Generate build.ninja file first and execute the binary. It works.

I got how to work use gn gen out/Default , then you will find build.ninja file in /out/Default
run ninja under /out/Default

I got how to work use gn gen out/Default , then you will find build.ninja file in /out/Default
run ninja under /out/Default

In this case, same error happened. ninja: error: loading 'build.ninja': No such file or directory
We can use -f FILE specify input build file.

I got how to work use gn gen out/Default , then you will find build.ninja file in /out/Default
run ninja under /out/Default

What is gn, and how can we get it?

same problem~

qingdujun@MacBook-Pro src % gn gen out/Release
ERROR at //third_party/fontconfig/fontconfig.gni:7:1: Assertion failed.
assert(is_linux)
^-----
See //third_party/fontconfig/BUILD.gn:6:1: whence it was imported.
import("//third_party/fontconfig/fontconfig.gni")
^-----------------------------------------------
See //headless/BUILD.gn:200:7: which caused the file to be included.
      "//third_party/fontconfig",
      ^-------------------------




qingdujun@MacBook-Pro src % autoninja -C out/Release/ headless_shell
ninja: Entering directory `out/Release/'
ninja: error: loading 'build.ninja': No such file or directory
Traceback (most recent call last):
  File "/Users/qingdujun/repos/workspace/depot_tools/ninjalog_uploader_wrapper.py", line 118, in <module>
    sys.exit(main())
  File "/Users/qingdujun/repos/workspace/depot_tools/ninjalog_uploader_wrapper.py", line 76, in main
    config = LoadConfig()
  File "/Users/qingdujun/repos/workspace/depot_tools/ninjalog_uploader_wrapper.py", line 31, in LoadConfig
    'chromium-build-stats.appspot.com'),
  File "/Users/qingdujun/repos/workspace/depot_tools/ninjalog_uploader.py", line 44, in IsGoogler
    _, content = h.request('https://'+server+'/should-upload', 'GET')
  File "/Users/qingdujun/.vpython-root/867170/lib/python2.7/site-packages/httplib2/__init__.py", line 1659, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/Users/qingdujun/.vpython-root/867170/lib/python2.7/site-packages/httplib2/__init__.py", line 1399, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/Users/qingdujun/.vpython-root/867170/lib/python2.7/site-packages/httplib2/__init__.py", line 1355, in _conn_request
    response = conn.getresponse()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1108, in getresponse
    raise ResponseNotReady()
httplib.ResponseNotReady

Building on Mac only works without headless.gn.

The reason for that is that the headless windowing system (ozone's headless platform in particular) that we use on Linux/Win and is configured in headless.gn isn't yet supported on Mac.

On Wed, Aug 9, 2017, 17:04 brandon.kobel via headless-dev headle...@chromium.org wrote:
When attempting to build the headless-shell on mac and performing the following step from Usage as a C++ library:

In case of building Chromium, try generating build.ninja with gn gen out/Default in directory src.

the same problem on ubuntu 18.04

Was this page helpful?
0 / 5 - 0 ratings