A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://linuxcnc.org/docs/devel/html/code/building-linuxcnc.html below:

Building LinuxCNC

There are two ways to build LinuxCNC: The developer-friendly "run in place" mode and the user-friendly Debian packaging mode.

4.1. Building for Run In Place

In a Run-In-Place build, the LinuxCNC programs are compiled from source and then run directly from within the build directory. Nothing is installed outside the build directory. This is quick and easy, and suitable for rapid iteration of changes. The LinuxCNC test suite runs only in a Run-In-Place build. Most LinuxCNC developers primarily build using this mode.

Building for Run-In-Place follows the steps in the Quick Start section at the top of this document, possibly with different arguments to src/configure and make.

4.1.1. src/configure arguments

The src/configure script configures how the source code will be compiled. It takes many optional arguments. List all arguments to src/configure by running this:

$ cd linuxcnc-source-dir/src
$ ./configure --help

The most commonly used arguments are:

--with-realtime=uspace

Build for any realtime platform, or for non-realtime. The resulting LinuxCNC executables will run on both a Linux kernel with Preempt-RT patches (providing realtime machine control) and on a vanilla (un-patched) Linux kernel (providing G-code simulation but no realtime machine control).

If development files are installed for Xenomai (typically from package libxenomai-dev) or RTAI (typically from a package with a name starting "rtai-modules"),
support for these real-time kernels will also be enabled.
--with-realtime=/usr/realtime-$VERSION

Build for the RTAI realtime platform using the older "kernel realtime" model. This requires that you have an RTAI kernel and the RTAI modules installed in /usr/realtime-$VERSION. The resulting LinuxCNC executables will only run on the specified RTAI kernel. As of LinuxCNC 2.7, this produces the best realtime performance.

--enable-build-documentation

Build the documentation, in addition to the executables. This option adds significantly to the time required for compilation, as building the docs is quite time consuming. If you are not actively working on the documentation you may want to omit this argument.

--disable-build-documentation-translation

Disable building the translated documentation for all available languages. The building of the translated documentation takes a huge amount of time, so it is recommend to skip that if not really needed.

4.1.2. make arguments

The make command takes two useful optional arguments.

Parallel compilation

make takes an optional argument -j N (where N is a number). This enables parallel compilation with N simultaneous processes, which can significantly speed up your build.

A useful value for N is the number of CPUs in your build system.

You can discover the number of CPUs by running nproc.

Building just a specific target

If you want to build just a specific part of LinuxCNC, you can name the thing you want to build on the make command line. For example, if you are working on a component named froboz, you can build its executable by running:

$ cd linuxcnc-source-dir/src
$ make ../bin/froboz
4.2. Building Debian Packages

When building Debian packages, the LinuxCNC programs are compiled from source and then stored in a Debian package, complete with dependency information. This process by default also includes the building of the documentation, which takes its time because of all the I/O for many languages, but that can be skipped. LinuxCNC is then installed as part of those packages on the same machines or on whatever machine of the same architecture that the .deb files are copied to. LinuxCNC cannot be run until the Debian packages are installed on a target machine and then the executables are available in /usr/bin and /usr/lib just like other regular software of the system.

This build mode is primarily useful when packaging the software for delivery to end users, and when building the software for a machine that does not have the build environment installed, or that does not have internet access.

To build packages is primarily useful when packaging the software for delivery to end users. Developers among themselves exchange only the source code, likely supported by the LinuxCNC GitHub repository referenced below. Also, when building the software for a machine that doesn’t have the build environment installed, or that doesn’t have internet access, one happily accepts a prebuilt package.

Building Debian packages is performed with the dpkg-buildpackage tool that is provided by the dpkg-dev package. Its execution comes with a series of prerequisites that are detailed below: * general build infrastructure shall be installed, i.e. compilers, etc. * build-time dependencies are to be installed, i.e. header files for external code libraries used, as described in the section Satisfying Build Dependencies. * file in debian folder need to be complete that describe the package

Build tools have been gathered as a virtual package named build-essential. To install it, run:

$ sudo apt-get install build-essential

Once those prerequisites are met, building the Debian packages consists of two steps.

The first step is generating the Debian package scripts and meta-data from the git repo by running this:

$ cd linuxcnc-dev
$ ./debian/configure

Note

The debian/configure script is different from the src/configure script!

The debian/configure accepts arguments depending on the platform you are building on/for, see the debian/configure arguments section. It defaults to LinuxCNC running in user space ("uspace"), expecting the preempt_rt kernel to minimize latencies.

Once the Debian package scripts and meta-data are configured, build the package by running dpkg-buildpackage:

$ dpkg-buildpackage -b -uc

Note

dpkg-buildpackage needs to run from the root of the source tree, which you mave have named linuxcnc-source-dir, not from within linuxcnc-source-dir/debian.
dpkg-buildpackage takes an optional argument ``-j``N (where N is a number). This enables to run multiple jobs simultaneously.

4.2.1. LinuxCNC’s debian/configure arguments

The LinuxCNC source tree has a debian directory with all the info about how the Debian package shall be built, but some key files within are only distributed as templates. The debian/configure script readies those build instructions for the regular Debian packaging utilities and must thus be run prior to dpkg-checkbuilddeps or dpkg-buildpackage.

The debian/configure script takes a single argument which specifies the underlying realtime or non-realtime platform to build for. The regular values for this argument are:

no-docs

Skip building documentation.

uspace

Configure the Debian package for Preempt-RT realtime or for non-realtime (these two are compatible).

noauto
rtai
xenomai

Normally, the lists of RTOSes for uspace realtime to support is detected automatically. However, if you wish, you may specify one or more of these after uspace to enable support for these RTOSes. Or, to disable autodetection, specify noauto.

If you want just the traditional RTAI "kernel module" realtime, use -r or $KERNEL_VERSION instead.

rtai=<package name>

If the development package for RTAI, lxrt, does not start with "rtai-modules", or if the first such package listed by apt-cache search is not the desired one, then explicitly specify the package name.

-r

Configure the Debian package for the currently running RTAI kernel. You must be running an RTAI kernel on your build machine for this to work!

$KERNEL_VERSION

Configure the Debian package for the specified RTAI kernel version (for example "3.4.9-rtai-686-pae"). The matching kernel headers Debian package must be installed on your build machine, e.g. "linux-headers-3.4.9-rtai-686-pae". Note that you can build LinuxCNC in this configuration, but if you are not running the matching RTAI kernel you will not be able to run LinuxCNC, including the test suite.

4.2.2. Satisfying Build Dependencies

On Debian-based platforms we provide packaging meta-data that knows what external software packages need to be installed in order to build LinuxCNC. These are referred to as the build dependencies of LinuxCNC, i.e. those packages that need to be available such that

You can use this meta-data to easily list the required packages missing from your build system. First, go to the source tree of LinuxCNC and initiate its default self-configuration, if not already performed:

$ cd linuxcnc-dev
$ ./debian/configure

This will prepare the file debian/control that contains lists of Debian packages to create with the runtime dependencies for those packages and for our cause also the build-dependencies for those to-be-created packages.

The most straightforward way to get all build-dependencies installed is to just execute (from the same directory):

which will install all the dependencies required, not yet installed, but available. The . is part of the command line, i.e. an instruction to retrieve the dependencies for the source tree at hand, not for dependencies of another package. This completes the installation of build-dependencies.

The remainder of this section describes a semi-manual approach. The list of dependencies in debian/control is long and it is tedious to compare the current state of packages already installed with it. Debian systems provide a program called dpkg-checkbuilddeps that parses the package meta-data and compares the packages listed as build dependencies against the list of installed packages, and tells you what’s missing.

First, install the dpkg-checkbuilddeps program by running:

$ sudo apt-get install dpkg-dev

This generates the file debian/control in a user-readable yaml-format which lists the build-dependencies close to the top. You can use this meta-data to easily list the required packages missing from your build system. You may decide to manually inspecting those files if you have a good understanding what is already installed.

Alternatively, Debian systems provide a program called dpkg-checkbuilddeps that parses the package meta-data and compares the packages listed as build dependencies against the list of installed packages, and tells you what’s missing. Also, dpkg-buildpackage would inform you about what is missing, and it should be fine. However, it reports missing build-deps only after patches in the directory debian/patches have been automatically applied (if any). If you are new to Linux and git version management, a clean start may be preferable to avoid complications.

The dpkg-checkbuilddeps (also from the dpkg-dev package that is installed as part of the build-essential dependencies) program can be asked to do its job (note that it needs to run from the linuxcnc-source-dir directory, not from linuxcnc-source-dir/debian):

It will emit a list of packages that are required to build LinuxCNC on your system but are not installed, yet. You can now install missing build-dependencies

manually

Install them all with sudo apt-get install, followed by the package names. You can rerun dpkg-checkbuilddeps any time you want, to list any missing packages, which has no effect on the source tree.

automated

Run sudo apt build-dep . .

If in doubt about what a particular package of a build-dep may be providing, check out the package’s description with ``apt-cache show`` packagename.

4.2.3. Options for dpkg-buildpackage

For a typical Debian package to build, you would run dpkg-buildpackage without any arguments. As introduced above, the command has two extra options passed to it. Like for all good Linux tools, the man page has all the details with man dpkg-buildpackage.

-uc

Do not digitally sign the resulting binaries. You would want to sign your packages with a GPG key of yours only if you would wanted to distribute them to others. Having that option not set and then failing to sign the package would not affect the .deb file.

-b

Only compiles the architecture-dependent packages (like the linuxcnc binaries and GUIs). This is very helpful to avoid compiling what is hardware-independent. For LinuxCNC this is the documentation, which is available online anyway.

If you happen to run into difficulties while compiling, check the LinuxCNC forum online.

Currently emerging is the support for the DEB_BUILD_OPTIONS environment variable. Set it to

nodocs

to skip building the documentation, preferably instead use the -B flag to dpkg-buildpackage.

nocheck

to skip self-tests of the LinuxCNC build process. This saves some time and reduces the demand for a few software packages that may not be available for your system, i.e. the xvfb in particular. You should not set this option to gain some extra confidence in your build to perform as expected unless you are running into mere technical difficulties with the test-specific software dependencies.

An environment variable can be set together with the execution of the command, e.g.

DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -uc -B

would combine all the options introduced in this section.

4.2.4. Installing self-built Debian packages

A Debian package can be recognised by its .deb extension. The tool installing it, dpkg is part of every Debian installation. The .deb files created by dpkg-buildpackage are found in the directory above the linuxcnc-source-dir, i.e. in ... To see what files are provided in a package, run

dpkg -c ../linuxcnc-uspace*.deb

The version of LinuxCNC will be part of the file name, which is meant to be matched by the asterisk. There may be too many files listed to fit on your screen. If you cannot scroll up in your terminal then add | more to that command to have its output passed through a so-called "pager". Quit with "q".

To install the packages, run

sudo dpkg -i ../linuxcnc*.deb

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4