Skip to content

Commit 38983fe

Browse files
committed
Introduced apt build-dep
1 parent 7c7f834 commit 38983fe

File tree

1 file changed

+98
-114
lines changed

1 file changed

+98
-114
lines changed

docs/src/code/building-linuxcnc.adoc

+98-114
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@
55

66
== Introduction
77

8-
This document describes how to build the LinuxCNC software and
9-
documentation from source. This is primarily useful if you are a
10-
developer who is modifying LinuxCNC. It can also be useful if you're
11-
a user who is testing developer branches, though then you also have
12-
the option of just installing Debian packages from the buildbot:
13-
http://buildbot.linuxcnc.org
8+
This document describes how to build the LinuxCNC software from source.
9+
This is primarily useful if you are a developer who is modifying LinuxCNC.
10+
It can also be useful if you're a user who is testing developer branches,
11+
though then you also have the option of just installing Debian packages from the buildbot
12+
(http://buildbot.linuxcnc.org) or as a regular package from your Linux
13+
distribution (https://tracker.debian.org/pkg/linuxcnc).
14+
Admittedly, this section also exists since LinuxCNC is a community effort.
15+
Buildbots and distributions only distribute what is considered safe.
16+
So, new developments, or you porting LinuxCNC to some new Linux disribution
17+
or a developers' reaction to you reporting a problem will see no buildbot
18+
to help, or that help is delayed, pending someone else's review.
19+
20+
The LinuxCNC documentation is distributed together with all the other files of the source tree.
21+
You can also build that, but skipping that to just use the regularly rebuilt online verions saves some time.
22+
But please seriously consider to contribute ot the documentation.
23+
Everyone always finds something to improve - and if you only leave a "FIXME".
1424

1525
[[Quick-Start]]
1626
=== Quick Start
@@ -25,10 +35,9 @@ $ ./configure --with-realtime=uspace
2535
$ make
2636
----
2737

28-
That will probably fail! That doesn't make you a bad person, it just
29-
means you should read this whole document to find out how to fix your
30-
problems. Especially the section on <<Satisfying-Build-Dependencies,
31-
Satisfying Build Dependencies>>.
38+
That will probably fail! That doesn't make you a bad person,
39+
it just means you should read this whole document to find out how to fix your problems.
40+
Especially the section on <<Satisfying-Build-Dependencies, Satisfying Build Dependencies>>.
3241

3342
If you are running on a realtime-capable system (such as an install from
3443
the LinuxCNC Live/Install Image, see the <<sub:realtime,Realtime>> section
@@ -50,11 +59,8 @@ on <<Setting-up-the-environment,Setting up the test environment>>.
5059

5160
== Supported Platforms
5261

53-
The LinuxCNC project targets modern Debian-based distributions, including
54-
Debian, Ubuntu, and Mint.
55-
56-
We continuously test on the platforms listed at
57-
http://buildbot.linuxcnc.org.
62+
The LinuxCNC project targets modern Debian-based distributions, including Debian, Ubuntu, and Mint.
63+
We continuously test on the platforms listed at http://buildbot.linuxcnc.org.
5864

5965
LinuxCNC builds on most other Linux distributions, though dependency
6066
management will be more manual and less automatic. Patches to improve
@@ -63,36 +69,34 @@ portability to new platforms are always welcome.
6369
[[sub:realtime]]
6470
=== Realtime
6571

66-
LinuxCNC is a machine tool controller, and it requires a realtime platform
67-
to do this job. This version of LinuxCNC supports three realtime platforms
72+
LinuxCNC is a machine tool controller, and it requires a realtime platform to do this job.
73+
FIXME: Give a reference to a section to read this up.
74+
This version of LinuxCNC supports three realtime platforms
6875

6976
RTAI::
70-
From https://www.rtai.org. A Linux kernel with the RTAI patch is
71-
available from the Debian archive at https://linuxcnc.org. See
72-
<<cha:getting-linuxcnc,Getting LinuxCNC>> for installation instructions.
77+
From https://www.rtai.org.
78+
A Linux kernel with the RTAI patch is available from the Debian archive at https://linuxcnc.org.
79+
See <<cha:getting-linuxcnc,Getting LinuxCNC>> for installation instructions.
7380

7481
Xenomai::
75-
From https://xenomai.org. You will have to compile or obtain a Xenomai
76-
kernel yourself.
82+
From https://xenomai.org. You will have to compile or obtain a Xenomai kernel yourself.
7783

7884
Preempt-RT::
79-
From https://rt.wiki.kernel.org. A Linux kernel with the
80-
Preempt-RT patch is occasionally available from the Debian
81-
archive at https://www.debian.org, and from the wayback machine at
82-
https://snapshot.debian.org.
85+
From https://rt.wiki.kernel.org.
86+
A Linux kernel with the Preempt-RT patch is occasionally available from the Debian archive at https://www.debian.org, and from the wayback machine at https://snapshot.debian.org.
8387

84-
To make use of the realtime capabilities of LinuxCNC, certain parts of
85-
LinuxCNC need to run with root privileges. To enable root for these
86-
parts, run this extra command after the `make` that builds LinuxCNC:
88+
To make use of the realtime capabilities of LinuxCNC, certain parts of LinuxCNC need to run with root privileges.
89+
To enable root for these parts, run this extra command after the `make` that builds LinuxCNC:
8790

8891
-----
8992
$ sudo make setuid
9093
-----
9194

95+
FIXME: This does not belong here. Focus should be on building.
9296
=== Non-realtime
9397

94-
LinuxCNC can also be built and run on non-realtime platforms, such as
95-
a regular install of Debian or Ubuntu without any special realtime kernel.
98+
LinuxCNC can also be built and run on non-realtime platforms,
99+
such as a regular install of Debian or Ubuntu without any special realtime kernel.
96100

97101
In this mode LinuxCNC is not useful for controlling machine tools,
98102
but it is useful for simulating the execution of G-code and for testing the non-realtime parts of the system
@@ -165,18 +169,15 @@ The most commonly used arguments are:
165169
The `make` command takes two useful optional arguments.
166170

167171
Parallel compilation::
168-
`make` takes an optional argument `-jN` (where N is a number).
169-
This enables parallel compilation with N simultaneous processes, which
170-
can significantly speed up your build.
172+
`make` takes an optional argument `-j` _N_ (where _N_ is a number).
173+
This enables parallel compilation with N simultaneous processes, which can significantly speed up your build.
171174
+
172-
A useful value for N is the number of CPUs in your build system. You can
173-
discover the number of CPUs by running `nproc`.
175+
A useful value for _N_ is the number of CPUs in your build system.
176+
You can discover the number of CPUs by running `nproc`.
174177

175178
Building just a specific target::
176-
If you want to build just a specific part of LinuxCNC, you can name
177-
the thing you want to build on the `make` command line. For example,
178-
if you are working on a component named `froboz`, you can build its
179-
executable by running:
179+
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.
180+
For example, if you are working on a component named `froboz`, you can build its executable by running:
180181
+
181182
-----
182183
$ cd linuxcnc-source-dir/src
@@ -185,32 +186,31 @@ $ make ../bin/froboz
185186

186187
=== Building Debian Packages
187188

188-
When building Debian packages, the LinuxCNC programs are compiled from
189-
source and then stored in a Debian package, complete with dependency
190-
information. This takes more time, and the programs can't be used until
191-
the Debian package is installed on a target machine.
189+
When building Debian packages, the LinuxCNC programs are compiled from source and then stored in several Debian packages.
190+
This packages separate different parts, like the documentation from the executables, and come with a description
191+
of themselves that describes what the package is providing and what other packages are also required to be installed
192+
to make use of what the package provides, i.e. the run-time dependencies.
193+
The programs can't be used until the Debian package is installed on a target machine.
192194

193-
This build mode is primarily useful when packaging the software for
194-
delivery to end users, and when building the software for a machine
195-
that doesn't have the build environment installed, or that doesn't have
196-
internet access.
195+
To build packages is primarily useful when packaging the software for delivery to end users.
196+
Developers among themselves exchange only the source code.
197+
Also, when building the software for a machine that doesn't have the build environment installed,
198+
or that doesn't have internet access, one happily accepts a prebuilt package.
197199

198-
Building Debian packages requires the `dpkg-buildpackage` tool, from the
199-
`dpkg-dev` package:
200+
Building Debian packages requires the `dpkg-buildpackage` tool, from the `dpkg-dev` package.
201+
But when building a Debian package, is generally expected to have all scripts in place that would commonly be expected.
202+
This has been formally manifested as a virtual "build-essential" package:
200203

201204
----
202-
$ sudo apt-get install dpkg-dev
205+
$ sudo apt-get install build-essential
203206
----
204207

205-
Building Debian packages also requires that all build dependencies are
206-
installed, as described in the section <<Satisfying-Build-Dependencies,
207-
Satisfying Build Dependencies>>.
208+
Building Debian packages also requires that all package-specific build dependencies are installed,
209+
as described in the section <<Satisfying-Build-Dependencies,Satisfying Build Dependencies>>.
208210

209-
Once those prerequisites are met, building the Debian packages consists
210-
of two steps.
211+
Once those prerequisites are met, building the Debian packages consists of two steps.
211212

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

215215
----
216216
$ cd linuxcnc-source-dir/debian
@@ -235,7 +235,7 @@ $ dpkg-buildpackage -b -uc
235235
[NOTE]
236236
====
237237
`dpkg-buildpackage` needs to run from the `linuxcnc-source-dir` directory, *not* from `linuxcnc-source-dir/debian`. +
238-
`dpkg-buildpackage` takes an optional argument `-jN` (where N is a number). This enables to run multiple jobs simultaneously.
238+
`dpkg-buildpackage` takes an optional argument ``-j``_N_ (where _N_ is a number). This enables to run multiple jobs simultaneously.
239239
====
240240

241241
[[debian-configure-arguments]]
@@ -252,38 +252,32 @@ The regular values for this argument are:
252252
Skip building documentation.
253253

254254
`uspace`::
255-
Configure the Debian package for Preempt-RT realtime or for
256-
non-realtime (these two are compatible).
255+
Configure the Debian package for Preempt-RT realtime or for non-realtime (these two are compatible).
257256

258257
`noauto`::
259258
`rtai`::
260259
`xenomai`::
261-
Normally, the lists of RTOSes for uspace realtime to support is detected
262-
automatically. However, if you wish, you may specify one or more of these
263-
after `uspace` to enable support for these RTOSes. Or, to disable
264-
autodetection, specify `noauto`.
260+
Normally, the lists of RTOSes for uspace realtime to support is detected automatically.
261+
However, if you wish, you may specify one or more of these after `uspace` to enable support for these RTOSes.
262+
Or, to disable autodetection, specify `noauto`.
265263
+
266-
If you want just the traditional RTAI "kernel module" realtime, use
267-
`-r` or `$KERNEL_VERSION` instead.
264+
If you want just the traditional RTAI "kernel module" realtime, use `-r` or `$KERNEL_VERSION` instead.
268265

269266
`rtai=<package name>`::
270-
If the development package for rtai lxrt does not start with
271-
"rtai-modules", or if the first such package listed by apt-cache search
272-
is not the desired one, then explicitly specify the package name.
267+
If the development package for rtai lxrt does not start with "rtai-modules",
268+
or if the first such package listed by apt-cache search is not the desired one,
269+
then explicitly specify the package name.
273270

274271
`-r`::
275272
Configure the Debian package for the currently running RTAI kernel.
276-
You must be running an RTAI kernel on your build machine for this
277-
to work!
273+
You must be running an RTAI kernel on your build machine for this to work!
278274

279275
`$KERNEL_VERSION`::
280-
Configure the debian package for the specified RTAI kernel version
281-
(for example "3.4.9-rtai-686-pae"). The matching kernel headers
282-
debian package must be installed on your build machine (for example
283-
"linux-headers-3.4.9-rtai-686-pae"). Note that you can _build_
284-
LinuxCNC in this configuration, but if you are not running the
285-
matching RTAI kernel you will not be able to _run_ LinuxCNC, including
286-
the test suite.
276+
Configure the debian package for the specified RTAI kernel version (for example "3.4.9-rtai-686-pae").
277+
The matching kernel headers debian package must be installed on your build machine (for example "linux-headers-3.4.9-rtai-686-pae").
278+
Note that you can _build_ LinuxCNC in this configuration,
279+
but if you are not running the matching RTAI kernel you will not be able to _run_ LinuxCNC,
280+
including the test suite.
287281

288282
[[Satisfying-Build-Dependencies]]
289283
==== Satisfying Build Dependencies
@@ -315,25 +309,23 @@ and it should be fine, but it reports missing build-deps only after patches in d
315309
are applied (if any), and if you are new to Linux and git version management,
316310
for a clean start it may be preferable to check first.
317311

318-
Hereto, install the `dpkg-checkbuilddeps` program by running:
312+
The `dpkg-checkbuilddeps` (also from the dpkg-dev package that is installed as part of the build-essential dependencies)
313+
program can be ask `dpkg-checkbuilddeps` to do its job
314+
(note that it needs to run from the `linuxcnc-source-dir` directory, *not* from `linuxcnc-source-dir/debian`):
319315

320316
-----
321-
$ sudo apt-get install dpkg-dev
317+
$ dpkg-checkbuilddeps
322318
-----
323319

324-
Finally ask `dpkg-checkbuilddeps` to do its job (note that it needs to
325-
run from the `linuxcnc-source-dir` directory, *not* from `linuxcnc-source-dir/debian`):
320+
It will emit a list of packages that are required to build LinuxCNC on your system, but that are not installed yet.
321+
You can now install missing build-dependencies
326322

327-
-----
328-
$ dpkg-checkbuilddeps
329-
-----
323+
manually:: Install them all with `sudo apt-get install`, followed by the package names.i
324+
You can rerun `dpkg-checkbuilddeps` any time you want, to list any missing packages, which has no effect on the source tree.
330325

331-
It will emit a list of packages that are required to build LinuxCNC
332-
on your system, but that are not installed yet. Install them all with
333-
`sudo apt-get install`, followed by the package names.
326+
automated:: Run `sudo apt build-dep .` .
334327

335-
You can rerun `dpkg-checkbuilddeps` any time you want, to list any
336-
missing packages, which has no effect on the source tree.
328+
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_.
337329

338330
==== Options for `dpkg-buildpackage`
339331

@@ -384,25 +376,20 @@ sudo dpkg -i ../linuxcnc*.deb
384376
[[Setting-up-the-environment]]
385377
== Setting up the environment
386378

387-
This section describes the special steps needed to set up a machine to
388-
run the LinuxCNC programs, including the tests.
379+
This section describes the special steps needed to set up a machine to run the LinuxCNC programs, including the tests.
389380

390381
=== Increase the locked memory limit
391382

392-
LinuxCNC tries to improve its realtime latency by locking the memory it
393-
uses into RAM. It does this in order to prevent the operating system from
394-
swapping LinuxCNC out to disk, which would have bad effects on latency.
383+
LinuxCNC tries to improve its realtime latency by locking the memory it uses into RAM.
384+
It does this in order to prevent the operating system from swapping LinuxCNC out to disk, which would have bad effects on latency.
395385

396386
Normally locking memory into RAM is frowned upon, and the operating system
397387
places a strict limit on how much memory a user is allowed to have locked.
398388

399-
When using the Preempt-RT realtime platform LinuxCNC runs with enough
400-
privilege to raise its memory lock limit itself. When using the RTAI
401-
realtime platform it does not have enough privilege, and the user must
402-
raise the memory lock limit.
389+
When using the Preempt-RT realtime platform LinuxCNC runs with enough privilege to raise its memory lock limit itself.
390+
When using the RTAI realtime platform it does not have enough privilege, and the user must raise the memory lock limit.
403391

404-
If LinuxCNC displays the following message on startup, the problem is
405-
your system's configured limit on locked memory:
392+
If LinuxCNC displays the following message on startup, the problem is your system's configured limit on locked memory:
406393

407394
-----
408395
RTAPI: ERROR: failed to map shmem
@@ -418,8 +405,8 @@ The file should contain the following line:
418405
* - memlock 20480
419406
-----
420407

421-
Log out and log back in to make the changes take effect. Verify that
422-
the memory lock limit is raised using the following command:
408+
Log out and log back in to make the changes take effect.
409+
Verify that the memory lock limit is raised using the following command:
423410

424411
-----
425412
$ ulimit -l
@@ -434,17 +421,14 @@ way to get started. However, there are other options to consider.
434421

435422
=== Fork us on Github
436423

437-
The LinuxCNC project git repo is at https://github.com/LinuxCNC/linuxcnc.
438-
github is a popular git hosting service and code sharing website.
439-
You can easily (and for no cost) create a fork of our git repo at github,
440-
and use that to track and publish your changes.
424+
FIXME: This needs more content.
441425

442-
After creating your own github fork of LinuxCNC, clone it to your
443-
development machine and proceed with your hacking as usual.
426+
The LinuxCNC project git repo is at https://github.com/LinuxCNC/linuxcnc.
427+
GitHub is a popular git hosting service and code sharing website.
428+
You can easily (and for no cost) create a fork of our git repo at GitHub, and use that to track and publish your changes.
429+
After creating your own GitHub fork of LinuxCNC, clone it to your development machine and proceed with your hacking as usual.
444430

445-
We of the LinuxCNC project hope that you will share your changes with
446-
us, so that the community can benefit from your work. Github makes this
447-
sharing very easy: after you polish your changes and push them to your
448-
github fork, send us a Pull Request.
431+
We of the LinuxCNC project hope that you will share your changes with us, so that the community can benefit from your work.
432+
Github makes this sharing very easy: after you polish your changes and push them to your github fork, send us a Pull Request.
449433

450434
// vim: set syntax=asciidoc:

0 commit comments

Comments
 (0)