"Fossies" - the Fresh Open Source Software Archive

Member "n2n-3.1.1/doc/Building.md" (31 Mar 2022, 6472 Bytes) of package /linux/misc/n2n-3.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) GitHub Flavored Markdown source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 This document describes the process for compiling n2n in several different
    2 scenarios.
    3 
    4 There are some configuration options available during the build process,
    5 which are documented in the [Build time Configuration](BuildConfig.md) page.
    6 
    7 Also of use are the steps used for the automated Continuous Integration
    8 process, which can be found in the [Github actions config file](../.github/workflows/tests.yml)
    9 
   10 # Git submodules
   11 
   12 If you are compiling with the UPnP libraries, it is possible that your
   13 operating system or your build system do not include binaries for the
   14 required libraries.
   15 
   16 Using these libraries can cause issues with some build systems, so be
   17 aware that not all combinations are supportable.
   18 
   19 To make this scenario simpler, the required source code has been added
   20 to this repository as git `submodules` which require one extra step to
   21 complete their checkout.
   22 
   23 So the very first time after cloning the n2n git repo, you should run
   24 this command in the n2n directory to fetch the submodules:
   25 
   26 ```bash
   27 git submodule update --init --recursive
   28 ```
   29 
   30 # Build on macOS
   31 
   32 In order to use n2n on macOS, you first need to install support for TUN/TAP interfaces:
   33 
   34 ```bash
   35 brew tap homebrew/cask
   36 brew cask install tuntap
   37 ```
   38 
   39 If you are on a modern version of macOS (i.e. Catalina), the commands above will ask you to enable the TUN/TAP kernel extension in System Preferences → Security & Privacy → General.
   40 
   41 For more information refer to vendor documentation or the [Apple Technical Note](https://developer.apple.com/library/content/technotes/tn2459/_index.html).
   42 
   43 Note that on the newest MacOS versions and on Apple Silicon, there may be
   44 increasing security restrictions in the OS that make installing the TUN/TAP
   45 kernel extension difficult.  Alternative software implementations to avoid
   46 these difficulties are being discussed for future n2n versions.
   47 
   48 # Build on Windows
   49 
   50 The following document some possible windows compile recipes.  Of them, the
   51 MinGW build process is more tested as it is more friendly to open source
   52 development.
   53 
   54 ## Visual Studio
   55 
   56 ### Requirements
   57 In order to build with Vidual Studio on Windows the following tools should be installed:
   58 
   59 - Visual Studio. For a minimal install, the command line only build tools can be
   60   downloaded and installed from https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017.
   61 
   62 - CMake (From https://cmake.org/download/)
   63 
   64   NOTE: You should always use the official cmake stable release as otherwise
   65   you may have issues finding libraries (e.g: the installed OpenSSL library).
   66   If you still have problems, you can try invoking it with `C:\Program Files\CMake\bin\cmake`.
   67 
   68 - (optional) The OpenSSL library.  This optional library can be enabled as
   69   per the steps in the [Build time Configuration](BuildConfig.md)
   70 
   71   Pre-built OpenSSL binaries can be downloaded from
   72   https://slproweb.com/products/Win32OpenSSL.html.
   73   The full version is required, i.e. not the "Light" version. The Win32
   74   version of it is usually required for a standard build.
   75 
   76 ### CLI steps
   77 
   78 In order to build from the command line, open a terminal window change to
   79 the directory where the git checkout of this repository is and run the
   80 following commands:
   81 
   82 Building using `cmake` works as follows:
   83 
   84 ```batch
   85 cmake -E make_directory build
   86 cd build
   87 
   88 rem Append any options to the next line
   89 cmake ..
   90 
   91 cmake --build . --config Release
   92 ```
   93 
   94 The compiled `.exe` files should now be available in the `build\Release` directory.
   95 
   96 ## MinGW
   97 
   98 These steps were tested on a fresh install of Windows 10 Pro with all patches
   99 applied as of 2021-09-29.
  100 
  101 - Install Chocolatey (Following instructions on https://chocolatey.org/install)
  102 - from an admin cmd prompt
  103     - `choco install git mingw make`
  104 - All the remaining commands must be run from inside a bash shell ("C:\Program Files\Git\usr\bin\bash.exe")
  105     - `git clone $THIS_REPO`
  106     - `cd n2n`
  107     - `./scripts/hack_fakeautoconf.sh`
  108     - `make`
  109     - `make test`
  110 
  111 Due to limitations in the Windows environment, the normal autotools steps have
  112 been emulated by the `hack_fakeautoconf` - This currently results in the
  113 version number reported by the compiled software being inaccurate.
  114 
  115 Note: MinGW builds have had a history of incompatibility reports with other OS
  116 builds (for example [#617](https://github.com/ntop/n2n/issues/617) and [#642](https://github.com/ntop/n2n/issues/642))
  117 However, if the tests pass, you should have a high confidence that your build
  118 will be compatible.
  119 
  120 ## Run on Windows
  121 
  122 In order to run n2n on Windows, you will need the following:
  123 
  124 - The TAP drivers should be installed into the system. They can be installed from
  125   http://build.openvpn.net/downloads/releases, search for "tap-windows".
  126 
  127 - If OpenSSL has been linked dynamically, the corresponding `.dll` file should be available
  128   onto the target computer.
  129 
  130 The `edge.exe` program reads the `edge.conf` file located into the current directory if no option is provided.
  131 
  132 The `supernode.exe` program reads the `supernode.conf` file located into the current directory if no option is provided.
  133 
  134 Example [edge.conf](../packages/etc/n2n/edge.conf.sample)
  135 and [supernode.conf](../packages/etc/n2n/supernode.conf.sample) are available.
  136 
  137 See `edge.exe --help` and `supernode.exe --help` for a full list of supported options.
  138 
  139 # Cross compiling on Linux
  140 
  141 ## Using the Makefiles and Autoconf
  142 
  143 The Makefiles are all setup to allow cross compiling of this code.  You
  144 will need to have the cross compiler, binutils and any additional libraries
  145 desired installed for the target architecture.  Then you can run the `./configure`
  146 with the appropriate CC and AR environment and the right `--host` option.
  147 
  148 If compiling on Debian or Ubuntu, this can be as simple as the following example:
  149 
  150 ```
  151 HOST_TRIPLET=arm-linux-gnueabi
  152 sudo apt-get install binutils-$HOST_TRIPLET gcc-$HOST_TRIPLET
  153 ./autogen.sh
  154 export CC=$HOST_TRIPLET-gcc
  155 export AR=$HOST_TRIPLET-ar
  156 ./configure --host $HOST_TRIPLET
  157 make
  158 ```
  159 
  160 A good starting point to determine the host triplet for your destination platform
  161 can be found by copying the `./config.guess` script to it and running it on the
  162 destination.
  163 
  164 This is not a good way to produce binaries for embedded environments (like OpenWRT)
  165 as they will often use a different libc environment.
  166 
  167 # N2N Packages
  168 
  169 There are also some example package build recipes included with the source.
  170 
  171 - [Debian](../packages/debian/README)
  172 - [RPM](../packages/rpm)
  173 - [OpenWRT](../packages/openwrt/README.md)