Build LXC 3.0.4 RPMs on Oracle Linux 8 Fails

Hi,

Build of LXC 3.0.x on Oracle Linux 8 is failing as shown below (this example is LXC 3.0.4). Any thoughts on how to get this build to succeed ? Thanks!

utils.c: In function ‘do_sha1_hash’:
utils.c:350:38: error: pointer targets in passing argument 3 of ‘EVP_DigestFinal_ex’ differ in signedness [-Werror=pointer-sign]
EVP_DigestFinal_ex(mdctx, md_value, md_len);
^~~~~~
In file included from utils.c:334:
/usr/include/openssl/evp.h:548:12: note: expected ‘unsigned int *’ but argument is of type ‘int *’
__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md,
^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:2251: liblxc_la-utils.lo] Error 1
make[3]: Leaving directory ‘/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-master/uekulele/lxc/rpmbuild/BUILD/lxc-3.0.4/src/lxc’
make[2]: *** [Makefile:429: all-recursive] Error 1
make[2]: Leaving directory ‘/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-master/uekulele/lxc/rpmbuild/BUILD/lxc-3.0.4/src’
make[1]: *** [Makefile:368: all] Error 2
make[1]: Leaving directory ‘/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-master/uekulele/lxc/rpmbuild/BUILD/lxc-3.0.4/src’
make: *** [Makefile:523: all-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.bV6Bx6 (%build)

I have a working solution for this now. A couple of changes were needed to the lxc.spec file to get LXC 3.0.4 to build on Oracle Linux 8. Comments on any ramifications or drawbacks of these spec file changes are welcomed.

The changes were made using the following sed commands:

sudo sed -i ‘s/_smp_mflags}/_smp_mflags} CFLAGS="-fPIC"/’ lxc.spec
sudo sed -i ‘/^%prep/i %define debug_package %{nil}’ lxc.spec

This results in the following changes:

++++++ change 1 +++++++++++++

%description devel
The %{name}-devel package contains header files and library needed for
development of the Linux containers.

%define debug_package %{nil} <-- This line is added
%prep

+++++++++++++++++++++++++

++++++ Change 2 +++++++++++

make %{?_smp_mflags} CFLAGS="-fPIC" <-- CFLAGS="-fPIC" is added to the make line

+++++++++++++++++++++++++

Quora describes the “-fPIC” flag.

Well this is one recipe for getting LXC 3.0.4 build on Oracle Linux 8. Comments welcome and invited. Thanks, Gilbert

As an added bonus, here is a lxc-templates.spec file that I created for building an lxc-templates RPM for lxc 3.0.4 on Oracle Linux 8. Comments welcome and invited in particular for ways to improve this spec file or make it more “elegant.” And that covers my current solution for Oracle Linux 8, Thanks, Gilbert

[ubuntu@oracle81 lxc-templates]$ cat lxc-templates.spec

+++++++++++++ begin spec file +++++++++++++++++++++++++++++
Name: lxc-templates
Version: 3.0.4
Release: 1%{?dist}
Summary: Provides templates for LXC containers

License: LGPLv2+
URL: https://linuxcontainers.org/
Source0: https://linuxcontainers.org/downloads/lxc/lxc-templates-3.0.4.tar.gz

BuildRequires: automake
BuildRequires: gcc
BuildRequires: make
BuildRequires: rpmdevtools
BuildRequires: git

%define debug_package %{nil}

%description
Provides templates for LXC containers

%prep
%autosetup

%build
%configure
%make_build

%install
rm -rf $RPM_BUILD_ROOT
%make_install

%files

/usr/share/lxc/config/alpine.common.conf
/usr/share/lxc/config/alpine.userns.conf
/usr/share/lxc/config/archlinux.common.conf
/usr/share/lxc/config/archlinux.userns.conf
/usr/share/lxc/config/centos.common.conf
/usr/share/lxc/config/centos.userns.conf
/usr/share/lxc/config/debian.common.conf
/usr/share/lxc/config/debian.userns.conf
/usr/share/lxc/config/fedora.common.conf
/usr/share/lxc/config/fedora.userns.conf
/usr/share/lxc/config/gentoo.common.conf
/usr/share/lxc/config/gentoo.moresecure.conf
/usr/share/lxc/config/gentoo.userns.conf
/usr/share/lxc/config/opensuse.common.conf
/usr/share/lxc/config/opensuse.userns.conf
/usr/share/lxc/config/openwrt.common.conf
/usr/share/lxc/config/oracle.common.conf
/usr/share/lxc/config/oracle.userns.conf
/usr/share/lxc/config/plamo.common.conf
/usr/share/lxc/config/plamo.userns.conf
/usr/share/lxc/config/sabayon.common.conf
/usr/share/lxc/config/sabayon.userns.conf
/usr/share/lxc/config/slackware.common.conf
/usr/share/lxc/config/slackware.userns.conf
/usr/share/lxc/config/sparclinux.common.conf
/usr/share/lxc/config/sparclinux.userns.conf
/usr/share/lxc/config/ubuntu-cloud.common.conf
/usr/share/lxc/config/ubuntu-cloud.lucid.conf
/usr/share/lxc/config/ubuntu-cloud.userns.conf
/usr/share/lxc/config/ubuntu.common.conf
/usr/share/lxc/config/ubuntu.lucid.conf
/usr/share/lxc/config/ubuntu.userns.conf
/usr/share/lxc/config/voidlinux.common.conf
/usr/share/lxc/config/voidlinux.userns.conf
/usr/share/lxc/templates/lxc-alpine
/usr/share/lxc/templates/lxc-altlinux
/usr/share/lxc/templates/lxc-archlinux
/usr/share/lxc/templates/lxc-centos
/usr/share/lxc/templates/lxc-cirros
/usr/share/lxc/templates/lxc-debian
/usr/share/lxc/templates/lxc-fedora
/usr/share/lxc/templates/lxc-fedora-legacy
/usr/share/lxc/templates/lxc-gentoo
/usr/share/lxc/templates/lxc-openmandriva
/usr/share/lxc/templates/lxc-opensuse
/usr/share/lxc/templates/lxc-oracle
/usr/share/lxc/templates/lxc-plamo
/usr/share/lxc/templates/lxc-pld
/usr/share/lxc/templates/lxc-sabayon
/usr/share/lxc/templates/lxc-slackware
/usr/share/lxc/templates/lxc-sparclinux
/usr/share/lxc/templates/lxc-sshd
/usr/share/lxc/templates/lxc-ubuntu
/usr/share/lxc/templates/lxc-ubuntu-cloud
/usr/share/lxc/templates/lxc-voidlinux

%changelog

  • Tue Oct 22 2019 ubuntu

+++ End spec file ++++++++++++++++++++++++++++++++++++

Note that all of this is “built-in” to Orabuntu-LXC which is a tool for deploying LXC Linux Containers across multiple linux hosts multiple linux distros over OpenvSwitch networks that span all the physical and VM hosts on which the containers on all these heterogenous hosts can communicate with each other over the same network no matter where they are located, no matter whether it is VM or physical host, and no matter what particular Linux distribution or flavor.

There is no Oracle Linux 8 yet as a container image at http://us.images.linuxcontainers.org/
You may request to have it added, since Oracle Linux 8 was released at the end of July 2019.
It helps to try out a system container with Oracle Linux 8 and have it compile LXC for testing.

LXC has generic only compilation instructions at https://github.com/lxc/lxc#building-lxc

The errors that you get, relate to the openssl library (the part about *EVP).

1 Like

Thanks simos. This thread applies only to the task of install LXC 3.0.4 on Oracle Linux 8 physical or VM hosts. However, it is useful to know that Oracle Linux 8 container images are not yet available. Thanks!

If there was an Oracle Linux 8 container image, it would be enough to replicate the issue you are facing.
It is common to use system containers for specific Linux distributions/versions to test whether something works or not. For the purposes of the compilation, it would be just fine to use such a container image.

1 Like

simos Absolutely. Good point. I have been using VMs for this testing but may also start testing the builds in containers as well. Thanks!

I’ve filed https://github.com/lxc/distrobuilder/issues/251 for @monstermunchkin to look at getting us some Oracle 8 builds.

1 Like

So it seems 8 is available based on this URL https://us.images.linuxcontainers.org/ but:

ubuntu@ubuntu-ThinkPad-P72:~/Desktop$ sudo lxc-create -n latest80 -t oracle – --release=8.latest
Host is Ubuntu 19.04
Create configuration file /var/lib/lxc/latest80/config
Yum installing release 8.latest for x86_64
failed: Unsupported release 8
lxc-create: latest80: lxccontainer.c: create_run_template: 1617 Failed to create container from template
lxc-create: latest80: tools/lxc_create.c: main: 327 Failed to create container latest80

It works for me, using LXD 3.18. By default the container only gets the BaseOS repository and you need to enable the rest, if you need them, per http://yum.oracle.com/oracle-linux-8.html

$ lxc launch images:oracle/8 oracle
Creating oracle
Starting oracle                             
$ lxc exec oracle -- /bin/bash
[root@oracle ~]# cat /etc/system-release
Oracle Linux Server release 8.0
[root@oracle ~]# yum repoinfo
Last metadata expiration check: 0:02:38 ago on Sat Oct 26 11:23:37 2019.

Repo-id      : base
Repo-name    : Oracle Linux
Repo-updated : Fri Oct 25 02:53:32 2019
Repo-pkgs    : 2758
Repo-size    : 4.3 G
Repo-baseurl : http://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/
Repo-expire  : 172800 second(s) (last: Sat Oct 26 11:23:37 2019)
Repo-filename: /etc/yum.repos.d/base.repo
[root@oracle ~]# 

Thanks simos. I am not using LXD. I am using LXC. Therefore I do not have the “lxc” command I have the “lxc-create” command. Orabuntu-LXC does not use LXD for a number of good reasons (which is not to say that LXD is also a great software), among them for example VLAN support issues.

This worked: (I just edited this post to reflect that)

sudo lxc-create -t download -n oracle801 – --dist oracle --release 8 --arch amd64

(Note: I had to use “–release 8” because “–release latest” did not work nor did “–release 8.latest”).

And confirming the release info:

ubuntu@ubuntu-ThinkPad-P72:~$ sudo lxc-attach -n oracle801
bash-4.4# cat /etc/oracle-release
Oracle Linux Server release 8.0
bash-4.4#

What you are doing afaik is pulling the Oracle 8 LXC container images from Oracle Corporation repos, which is not the same as what I believe Stephane was talking about - or maybe I am wrong.

If I am working on Ubuntu Linux 19.04 for example, there isn’t any way to activate these various Oracle repos (which I am familiar with so yes I do know about that) if I want to create an Oracle 8 LXC container on Ubuntu Linux host OS.

Well if I am mistaken in this then please LMK it will be appreciated. Thanks, Gilbert

Hi Gilbert,

I showed the Oracle Linux 8 container image working on LXD as indication that the container image is likely OK, since it works on LXD.

The Oracle Linux container images are created with distrobuilder, and the specific downloader/configuration for the Oracle Linux images are at https://github.com/lxc/distrobuilder/blob/master/sources/oraclelinux-http.go (downloads a base ISO and then touches a bit the configuration) and https://github.com/lxc/lxc-ci/blob/master/images/oracle.yaml (main configuration file).

You can add extra repositories to a Oracle Linux 8 container. I am not sure I understand why it would not be possible to add extra repositories if the host is Ubuntu.

By the way, it is also possible to create custom Oracle Linux 8 container images, by adding extra configuration such as enabling by default additional repositories, or adding extra packages.

s/distrowatch/distrobuilder/ :slight_smile:

Thanks, typo fixed. :smile: