digitalmars.D.ldc - Snap packages for LDC 1.2.0
- Joseph Rushton Wakeling (118/118) May 01 2017 Hello all :-)
Hello all :-) Stable snap packages for LDC 1.2.0 have been available since before the official 1.2.0 release announcement 1 week ago. However, since there's more than just the availability of the packages to announce, I thought I'd write up some notes for the forums. Please report any issues using the package here: https://github.com/ldc-developers/ldc2.snap Enjoy, and please do let me know how you get on if you try these packages :-) Thanks & best wishes, -- Joe What are snap packages? ----------------------- Snaps are one of a number of next-gen packaging schemes that are designed to provide secure, containerized applications in a distro-neutral manner. A good general overview is provided on the main project website: https://snapcraft.io/ In practice, this means that the LDC snap package provides a reliable way to install LDC on multiple different distros. The LDC snap package is a 'classic' snap, meaning that its confinement rules allow access to the host system in order to access e.g. the host compiler toolchain, and development libraries installed using the regular host package manager. More information on classic snaps is available here: https://insights.ubuntu.com/2017/01/09/how-to-snap-introducing-classic-confinement/ https://snapcraft.io/docs/reference/confinement Installing ---------- It should be possible to install snap packages on any distro with a sufficiently up to date version of the `snapd` daemon (which manages both installing and running these packages). Installation instructions for different distros are available here: https://snapcraft.io/docs/core/install Once snapd is installed, log off and back on again to make sure that your PATH environment variable is set to include the location of any installed snap applications. Then, to install the LDC snap: sudo snap install --classic ldc2 Alternatively, on systems not supporting `sudo`, just run the `snap install ...` command as root. The `--classic` flag is necessary in order to grant permission for the classic confinement used by the snap (see above). The `ldc2` snap package is currently available for i386 and amd64 architectures, with plans to add more supported architectures over time. The installed package will auto-update over time, but can be manually updated by running: sudo snap refresh ldc2 The snap package makes available not only the `ldc2` compiler itself but also the DMD-alike `ldmd2` compiler interface, and the `ldc-profdata` and `ldc-prune-cache` tools. By default these can be run using the command `ldc2.command`, e.g. `ldc2.ldmd2`. This namespacing helps to avoid clashes between snap commands. However, the package also defines aliases that allow for use of the regular commands. For example: sudo snap alias ldc2 ldmd2 will enable the `ldmd2` alias, allowing the `ldmd2` command to be used directly instead of `ldc2.ldmd2`. Type: snap aliases for a complete list of the available aliases, and which ones are currently enabled. The command snap list can be used to list all currently installed snap packages, while snap info [name] will give information on a specific snap package (whether installed or not); so e.g. `snap info ldc2` will give you information on the LDC snap package. Running ------- The compiler can be invoked using the normal `ldc2` and `ldmd2` commands (although see above regarding aliases if you want to use `ldmd2`). It uses the host system's C compiler for linking, so on most Linux distros it will require GCC to be installed. Tracks and channels ------------------- The snap store allows multiple different versions of the snap package to be made available on user demand: https://snapcraft.io/docs/reference/channels In brief, snap packages are distributed via channels, named `edge`, `beta`, `candidate` and `stable`. By default packages are installed from `stable`, but it is possible to request installation (and updates) from one of the other channels, e.g.: sudo snap refresh --candidate ldc2 will ensure that you have the latest version installed from the `candidate` channel, and that updates will be installed from that channel instead of `stable`. In addition, the snap store also defines release _tracks_, which are used to define long-term-support release versions. For example, if you want to guarantee you are installing from the 1.2.x release series of LDC, you can type: sudo snap install --classic --channel=1.2/stable ldc2 or, to switch to tracking that track and channel: sudo snap refresh --channel=1.2/stable New tracks will be defined for each new minor release series of LDC: for example, a 1.3 track is already defined in preparation for the upcoming 1.3.0 release. Without any specific requirements, it is recommended to just install from the `stable` channel (with no track specified), as this will keep you up to date with the latest stable LDC releases. However, you can use the choice of track to ensure that you only receive updates for a given minor release series of LDC. Alternatively, you can switch between tracks and channels as needed, if you want to try out different versions of the compiler. Known issues ------------ Given the current state of `snapd` support in distros, the `ldc2` snap package is expected to work on: * Ubuntu 14.04, 16.04, 16.10 and 17.04 (and current development versions) * Debian Testing and Unstable * OpenSUSE Leap Link-time optimization (the `-flto=full` option) is not expected to work on Ubuntu 14.04 or on OpenSUSE, but should work fine on Debian and on later Ubuntu releases.
May 01 2017