I’m trying to build libcxx with Ninja, but I don’t understand what this is supposed to be:
-DLLVM_PATH=/path/to/llvm/tree
I found that here:
http://libcxx.llvm.org/docs/BuildingLibcxx.html
What LLVM directory can I find the LLVM tree in? I’m using Windows 10.
Thanks
I believe LLVM_PATH should point to the llvm/ directory at the root of the repository. The section you’re citing is listed as “It is sometimes beneficial to build outside of the LLVM tree.” Are you sure you want to do that?
The “natural” organization (if there is such a thing) is to put the llvm repo at the source root, and store libcxx and/or libcxxabi in llvm/projects/. If this is the case you don’t need to specify LLVM_PATH. If you followed the steps in “Getting Started” http://libcxx.llvm.org/docs/BuildingLibcxx.html#getting-started then in step 4 where you would’ve done “make cxx” you can do “ninja cxx” instead.
Bringing this thread back onto the list, looks like we went off list at
some point.
It's version 2.3 of ninja. This is the latest I could find for Windows.
I can't find the cmake version, but it was built on April 10, 2017, so
I think that's new enough.
Not sure. Are you certain your version of ninja and cmake are new
enough?
I added the Ninja directory to my PATH variable and reopened the
admin Command Prompt. I changed CMAKE_MAKE_PROGRAM to this:
-DCMAKE_MAKE_PROGRAM=ninja
I executed the command again, Ninja still reported an error, now
saying in ninja.exe.log:
usage: ninja [-h] [-f file [file ...]] [-l lineno [lineno ...]]
[-p project [project ...]] [--plugin plugin [plugin
...]]
[--loglevel loglevel] [--logfile logfile]
[file [file ...]]
ninja: error: unrecognized arguments: --version
It seems cmake wants to pass a "--version" argument to its command
to open ninja, which causes ninja to complain.
What can I do?
My ninja version is 1.3.4 and when I run "ninja --version" it reports
"1.3.4". It does not give this error message. When I run "ninja --help"
it shows something very different from the help message you're showing here.
https://ninja-build.org/ claims that the latest version available is "The
last Ninja release is v1.7.2, released 7 Nov 2016." But you said you have
version 2.3.
I think that you have another executable called "ninja" in your PATH. Can
you check it? See if you get different results with binaries from here --
-Brian
Erika: On some Linux distributions, if you want to use the distributions’s package manager, you need to install package “ninja-build” since “ninja” is some ancient database iirc. See https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages
ninja --help
should print something like this:
$ ninja --help
usage: ninja [options] [targets…]
if targets are unspecified, builds the ‘default’ target (see manual).
options:
–version print ninja version (“1.7.2”)
-C DIR change to DIR before doing anything else
-f FILE specify input build file [default=build.ninja]
-j N run N jobs in parallel [default=10, derived from CPUs available]
-k N keep going until N jobs fail [default=1]
-l N do not start new jobs if the load average is greater than N
-n dry run (don’t run commands but act like they succeeded)
-v show all command lines while building
-d MODE enable debugging (use -d list to list modes)
-t TOOL run a subtool (use -t list to list subtools)
terminates toplevel options; further flags are passed to the tool
-w FLAG adjust warnings (use -w list to list warnings)
Those instructions for building libcxx are a bit out of date and incomplete.
If you are planning to develop and build libcxx you’ll need a checkout and build of LLVM. That is required for running libcxx’s tests. After you’ve built LLVM on your system, one of the generated tools is a program called llvm-config. When you run CMake for libcxx you need to set the CMake option “LLVM_CONFIG_PATH” to point to the llvm-config binary, and libcxx’s build system should handle the rest. Libcxx is not tightly bound to LLVM, so when developing libcxx you will not need to update the LLVM sources frequently.
If you just want to build and use libcxx, specifying the LLVM_CONFIG_PATH or LLVM_PATH variables are not required, in the absence of an LLVM source and build tree libcxx will disable the testing functionality in the build, but everything else should work.
-Chris
The libc++ bot does not checkout LLVM: http://green.lab.llvm.org/green/view/Libcxx/job/libcxx_master_cmake/
It is checking out libc++ and lit (svn checkout [http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit
](http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit`)), then run cmake, and the tests can be ran with python path/to/lit/lit.py -v --show-xfail --show-unsupported $WORKSPACE/build/test
I have a patch in review to run the tests against a pre-built libc++.