[swift-users] Bootstrapping ninja and building from source

Lane Schwartz dowobeha at gmail.com
Fri Dec 4 13:22:31 CST 2015


Hi,

First of all, congratulations on the open source release! I'm very excited!

Second, I'm running into trouble building from source, particularly in
regards to getting ninja bootstrapped. I'm on Scientific Linux. I first
used yum to install packages for llvm, llvm-devel, clang, and cmake.

I then did the following, following the README.md in the swift git repo:

 git clone git at github.com:apple/swift.git swift
 git clone git at github.com:apple/swift-llvm.git llvm
 git clone git at github.com:apple/swift-clang.git clang
 git clone git at github.com:apple/swift-lldb.git lldb
 git clone git at github.com:apple/swift-cmark.git cmark
 git clone git at github.com:apple/swift-llbuild.git llbuild
 git clone git at github.com:apple/swift-package-manager.git swiftpm
 git clone git at github.com:apple/swift-corelibs-xctest.git
 git clone git at github.com:apple/swift-corelibs-foundation.git


The README.md also states:

Ninja is the current recommended build system for building Swift and is the
> default configuration generated by CMake. If you're on OS X or don't
> install it as part of your Linux distribution, clone it next to the other
> projects and it will be bootstrapped automatically


 My Linux distro doesn't package ninja, so I also did this:

git clone git at github.com:martine/ninja.git

I then attempted to build swift:

$ ./swift/utils/build-script

Which resulted in errors, and as far as I can tell did not attempt to build
the ninja distro that I downloaded into the ninja directory in my current
working directory:

which: no ninja in
> (/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/lanes/.local/bin:/home/lanes/bin)
> Building the standard library for: swift-stdlib-linux-x86_64
> Running Swift tests for: check-swift-linux-x86_64
> + rm -rf /home/lanes/swift/build/Ninja-DebugAssert/ninja-build
> + cp -r /home/lanes/swift/ninja
> /home/lanes/swift/build/Ninja-DebugAssert/ninja-build
> ++ uname -s
> + [[ Linux == \D\a\r\w\i\n ]]
> + cd /home/lanes/swift/build/Ninja-DebugAssert/ninja-build
> + python ./configure.py --bootstrap
> bootstrapping ninja...
> warning: A compatible version of re2c (>= 0.11.3) was not found; changes
> to src/*.in.cc will not affect your build.
> wrote build.ninja.
> bootstrap complete.  rebuilding...
> [24/24] LINK ninja
> cmark: using standard linker
> + cd /home/lanes/swift/build/Ninja-DebugAssert/cmark-linux-x86_64
> + /usr/bin/cmake -G Ninja -DCMAKE_C_COMPILER:PATH=clang
> -DCMAKE_CXX_COMPILER:PATH=clang++ -DCMAKE_BUILD_TYPE:STRING=Debug
> /home/lanes/swift/cmark
> CMake Error: CMake was unable to find a build program corresponding to
> "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a
> different build tool.
> CMake Error: Error required internal CMake variable not set, cmake may be
> not be built correctly.
> Missing variable is:
> CMAKE_C_COMPILER_ENV_VAR
> CMake Error: Could not find cmake module
> file:/home/lanes/swift/build/Ninja-DebugAssert/cmark-linux-x86_64/CMakeFiles/2.8.11/CMakeCCompiler.cmake
> CMake Error: Error required internal CMake variable not set, cmake may be
> not be built correctly.
> Missing variable is:
> CMAKE_CXX_COMPILER_ENV_VAR
> CMake Error: Could not find cmake module
> file:/home/lanes/swift/build/Ninja-DebugAssert/cmark-linux-x86_64/CMakeFiles/2.8.11/CMakeCXXCompiler.cmake
> -- Configuring incomplete, errors occurred!
> ./swift/utils/build-script: command terminated with a non-zero exit status
> 1, aborting



This leads me to a couple of questions:

* Do I need to first build and install re2c? If so, this should perhaps be
mentioned as a prereq.
* Is there anything differently I should be doing to get the bootstrap
process running successfully?

Thanks,
Lane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151204/e55ad715/attachment-0001.html>


More information about the swift-users mailing list