빌드 - minsuk-jang/teamproject GitHub Wiki


Quick start

  1. Verify that you have the build prerequisites installed.
  2. Clone neovim/neovim.
    • If you want the stable release: git checkout v0.2.0 (or the most-recent tag)
  3. Build Neovim by running make. (On BSD systems use gmake / GNU Make.)
    • Set CMAKE_INSTALL_PREFIX if you want to install to a custom location. See Installing Neovim.

Other notes:

  • Third-party dependencies (libuv, LuaJIT, etc.) are downloaded automatically to .deps/. See FAQ if you have issues.
  • To generate the Makefile without building: make cmake
  • If you plan to develop Neovim, install ninja for faster builds. It will be used automatically.

Now that you have the dependencies, you can try other build targets, explained below.

Running tests

To run all non-legacy (unit + functional) tests:

LC_ALL=C make test

To run only unit tests:

LC_ALL=C make unittest

To run only functional tests:

LC_ALL=C make functionaltest

To run a specific unit test:

TEST_FILE=test/unit/foo.lua make unittest

To run a specific functional test:

TEST_FILE=test/functional/foo.lua make functionaltest

To repeat a test many times:

.deps/usr/bin/busted --filter 'foo' --repeat 1000 test/functional/ui/foo_spec.lua

To run all legacy (Vim) integration tests:

make oldtest

To run a single legacy test, run make with TEST_FILE=test_name.res. E.g. to run test_syntax.vim:

TEST_FILE=test_syntax.res make oldtest
  • The .res extension (instead of .vim) is required.
  • Specify only the test file name, not the full path.

Functional tests

$GDB can be set to run tests under gdbserver. If $VALGRIND is also set, it will add the --vgdb=yes option to valgrind instead of starting gdbserver directly.

Optimized builds

rm -r build
make clean
make CMAKE_BUILD_TYPE=Release

For developers and "edge" users, RelWithDebInfo is recommended over Release as the latter doesn't generate debug info.

To verify the build type after compilation, run ./build/bin/nvim --version | grep ^Build

Debug builds

nvim links statically some libraries, in order to be able to step into some of these functions, you might want to compile them with debug informations as well.

make distclean
VERBOSE=1 DEBUG=1 make deps

Localization

Localization build

A normal build will create .mo files in build/src/nvim/po.

  • If you see msgfmt: command not found, you need to install gettext. On most systems the package is just called gettext.

Localization check

To check the translations for $LANG, run make -C build check-po-$LANG. Examples:

make -C build check-po-de
make -C build check-po-pt_BR
  • Use ninja instead of make if applicable.
  • check-po-$LANG generates a detailed report in ./build/src/nvim/po/check-${LANG}.log. (The report is generated by nvim, not by msgfmt.)

Localization update

To update the src/nvim/po/$LANG.po file with the latest strings, run the following:

make -C build update-po-$LANG
  • Replace make with ninja if applicable.
  • Note: run src/nvim/po/cleanup.vim after updating.

Compiler options

To see the chain of includes, use the -H option (#918):

echo '#include "./src/nvim/buffer.h"' | \
> clang -I.deps/usr/include -Isrc -std=c99 -P -E -H - 2>&1 >/dev/null | \
> grep -v /usr/
  • grep -v /usr/ is used to filter out system header files
  • -save-temps can be added as well to see expanded macros or commented assembly

Xcode and MSVC project files

CMake has a -G option for exporting to multiple project file formats, such as Xcode and Visual Studio.

For example, to use Xcode's static analysis GUI (#167), you need to generate an Xcode project file from the Neovim makefile (where neovim/ is the top-level Neovim source code directory containing the main Makefile):

cmake -G Xcode neovim

then open the resulting project file in Xcode.

Custom Makefile

You can customize the build process locally by creating a local.mk, which is referenced at the top of the main Makefile. It's listed in .gitignore so it can be used across branches. A new target in local.mk overrides the default make-target.

Here's a sample local.mk which adds a target to force a rebuild but does not override the default-target:

all:

rebuild:
	rm -rf build
	make

Third-party dependencies

See #1588.

To build the bundled dependencies using CMake:

mkdir .deps ; cd .deps
cmake ../third-party
make

By default the libraries and headers are placed in .deps/usr. Now you can build Neovim:

mkdir build ; cd build
cmake ..
make

How to build without "bundled" dependencies

  1. Install all dependencies manually.
  2. Create directory build in the root of the repository.
  3. Switch to it and run cmake .. with all necessary options and environment. E.g.:
    • CC=clang CFLAGS=" -O0 -g " cmake .. -DMIN_LOG_LEVEL=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/root -DCLANG_ASAN_UBSAN=ON
  4. Run make.

About CMake

  • cmake.org
  • cmake -LAH prints all variable definitions.
  • build/CMakeCache.txt contains the resolved values of all variables used by CMake.
  • build/compile_commands.json shows the full compiler invocations for each translation unit.

Build prerequisites

General requirements (see #1469):

  • A recent version of Clang, or GCC version 4.4 and above
  • CMake version 2.8.7 and above, built with TLS/SSL support

Platform-specific requirements are listed below.

Ubuntu / Debian

sudo apt-get install libtool libtool-bin autoconf automake cmake g++ pkg-config unzip

Note: libtool-bin is only required for Ubuntu 16.04/Debian Jessie and newer.

CentOS / RHEL / Fedora

If you're using CentOS/RHEL 6 you need at least autoconf version 2.69 for compiling the libuv dependency. See https://github.com/joyent/libuv/issues/1158.

sudo yum -y install libtool autoconf automake cmake gcc gcc-c++ make pkgconfig unzip

openSUSE

sudo zypper install libtool autoconf automake cmake gcc-c++ gettext-tools

Arch Linux

sudo pacman -S base-devel cmake unzip

Nix or NixOS

cd path/to/neovim
nix-shell '<nixpkgs>' -A neovim
patchPhase
cmakeConfigurePhase
buildPhase
installPhase

FreeBSD

sudo pkg install cmake gmake libtool sha automake pkgconf unzip wget

If you get an error regarding a sha256sum mismatch, where the actual sha256sum is e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, then this is your issue (that's the sha256sum of an empty file). Also, make sure you have wget installed. LuaRocks has bad interactions with cURL, at least under FreeBSD, and will die with a PANIC in LuaJIT when trying to install a rock.

OpenBSD

doas pkg_add gmake cmake libtool unzip autoconf-2.69p1 automake-1.15
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.15

The build sometimes fails when using the top level Makefile, apparently due to some third-party component #2445-comment. The following instructions use CMake

mkdir .deps
cd .deps
cmake ../third-party/
gmake
cd ..
mkdir build
cd build
cmake ..
gmake

macOS

  • Install Xcode and Homebrew or MacPorts

  • Install Xcode commandline tools xcode-select --install

  • Install other dependencies:

    Via MacPorts:

    sudo port install libtool autoconf automake cmake pkgconfig gettext
    

    Via Homebrew:

    brew install libtool automake cmake pkg-config gettext
    
  • After this you may need to run make distclean && make before the tests will run.

  • If you see wget certificate errors (for OS X before version 10.10/Yosemite):

    Via MacPorts:

    sudo port install curl-ca-bundle
    echo CA_CERTIFICATE=/opt/local/share/curl/curl-ca-bundle.crt >> ~/.wgetrc
    

    Via Homebrew:

    brew install curl-ca-bundle
    echo CA_CERTIFICATE=$(brew --prefix curl-ca-bundle)/share/ca-bundle.crt >> ~/.wgetrc
    

Windows / MSYS2

From the MSYS2 shell install these packages

pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-libtool mingw-w64-x86_64-cmake \
mingw-w64-x86_64-make mingw-w64-x86_64-perl mingw-w64-x86_64-python2 gperf

Now from the windows console (cmd.exe) setup the PATH and build

set PATH=%PATH%;c:\msys64\mingw64\bin
set CC=gcc

Build using the MinGW Makefiles generator

mkdir .deps
cd .deps
cmake  -G "MinGW Makefiles" ..\third-party\
mingw32-make
cd ..
mkdir build
cd build
cmake -G "MinGW Makefiles" -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" ..
mingw32-make

For 32bit builds adjust the package names and paths accordingly.

⚠️ **GitHub.com Fallback** ⚠️