From d3ecba1f62b80517daa923d4ceb1fd1e55c4ba4c Mon Sep 17 00:00:00 2001 From: HoJeong Go Date: Fri, 1 Dec 2023 14:55:43 +0900 Subject: [PATCH] doc: Add build instruction on AlpineLinux --- doc/installing.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/doc/installing.md b/doc/installing.md index b2b703cc7d0..97a8d22d1b2 100644 --- a/doc/installing.md +++ b/doc/installing.md @@ -225,6 +225,58 @@ sudo -E PATH=${PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} $(go env GOPATH)/bin/inc If `newuidmap/newgidmap` tools are present on your system and `/etc/subuid`, `etc/subgid` exist, they must be configured to allow the root user a contiguous range of at least 10M UID/GID. ``` +### Other distros: AlpineLinux + +The overall procedure follows the Ubuntu's one. +You can get development resources required to build Incus on your AlpineLinux via following command: + +```sh +apk add acl-dev autoconf automake eudev-dev gettext-dev go intltool libcap-dev libtool libuv-dev linux-headers lz4-dev tcl-dev sqlite-dev lxc-dev make xz +``` + +To take advantage of all the necessary features of Incus, you must install additional packages. +You can reference the list of packages you need to use specific function from [LXD package definition in AlpineLinux aports repository](https://gitlab.alpinelinux.org/alpine/infra/aports/-/blob/master/community/lxd/APKBUILD). +Also you can find the package you need with the binary name from [AlpineLinux packages contents filter](https://pkgs.alpinelinux.org/contents). + +```sh +# Install `depends` +apk add acl attr ca-certificates cgmanager dbus dnsmasq lxc iproute2 iptables netcat-openbsd rsync squashfs-tools shadow-uidmap tar xz + +# Install `depends` for vms +apk add qemu-system-x86_64 qemu-chardev-spice qemu-hw-usb-redirect qemu-hw-display-virtio-vga qemu-img qemu-ui-spice-core ovmf sgdisk util-linux-misc virtiofsd +``` + +After preparing the source from release tarball or git repository, you need follow the below steps to avoid known issues during build time: + +```sh +# cc1: error: /usr/local/include: No such file or directory [-Werror=missing-include-dirs] +mkdir -p /usr/local/include + +# paste output `export` commands on console to set required environment variables +make deps + +# gettext.cgo2.c:(.text+0x2b9): undefined reference to `libintl_gettext' +# - related issue: https://github.com/gosexy/gettext/issues/1 +export CGO_LDFLAGS="$CGO_LDFLAGS -L/usr/lib -lintl" +export CGO_CPPFLAGS="-I/usr/include" + +make +``` + +You can continue to `From source: Install` and `Machine setup` section to finalise setting up your Incus instance. +If you still encounter issues, the following details may help you: + +#### `make`: gettext.cgo2.c:(.text+0x2b9): undefined reference to `libintl_gettext' + +If you didn't installed `libintl` from package manager, the location of required library and header file can be different. +You can find the default location of `libintl.h` and `libintl.so` file from [AlpineLinux packages contents filter](https://pkgs.alpinelinux.org/contents?file=libintl*&path=&name=gettext-dev&branch=edge). +Also according to [GNU gettext FAQ: integrating undefined](https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined), the `-lintl` flag should be located at the near end of the link command line. + +```sh +export CGO_LDFLAGS="$CGO_LDFLAGS -L/directory/path/to/lib -lintl" +export CGO_CPPFLAGS="-I/directory/path/to/header" +``` + (installing-manage-access)= ## Manage access to Incus