ubuntu22.04 - libuboot.h

44 views
Skip to first unread message

Darko Komljenović

unread,
Jul 1, 2024, 9:50:35 AMJul 1
to swupdate
Hi,

I am trying to build the swupdate2024.05.2 for ubuntu 22.04 but i get the error 
```
include/swupdate_vars.h:10:10:
fatal error: libuboot.h: No such file or directory
  10 | #include <libuboot.h>
```
But i don't see an option how to build without that header as it is referenced in swupdate_vars.h and that is referenced in 5 other files

my defconfig is:
```
CONFIG_SW_VERSIONS_FILE="/etc/swu/sw-versions"
CONFIG_SOCKET_CTRL_PATH="/run/swupdate/sockinstctrl"
CONFIG_SOCKET_PROGRESS_PATH="/run/swupdate/swupdateprog"
# CONFIG_MTD is not set
# CONFIG_LUA is not set
CONFIG_WEBSERVER=y
CONFIG_MONGOOSESSL=y
CONFIG_SIGNED_IMAGES=y
CONFIG_ARCHIVE=y
CONFIG_RAW=y
CONFIG_SHELLSCRIPTHANDLER=y
CONFIG_DOCKER=y
```

What am i missing? how to build now swupdate without libubootenv?

Stefano Babic

unread,
Jul 1, 2024, 10:04:06 AMJul 1
to Darko Komljenović, swupdate
On 01.07.24 15:46, Darko Komljenović wrote:
> Hi,
>
> I am trying to build the swupdate2024.05.2 for ubuntu 22.04 but i get
> the error
> ```
> include/swupdate_vars.h:10:10:fatal error: libuboot.h: No such file or
> directory
>   10 | #include <libuboot.h>
> ```
> But i don't see an option how to build without that header

libubootenv is now mandatory - you need to install it to build SWUpdate.

Best regards,
Stefano Babic

> as it is
> referenced in swupdate_vars.h and that is referenced in 5 other files
>
> my defconfig is:
> ```
> CONFIG_SW_VERSIONS_FILE="/etc/swu/sw-versions"
> CONFIG_SOCKET_CTRL_PATH="/run/swupdate/sockinstctrl"
> CONFIG_SOCKET_PROGRESS_PATH="/run/swupdate/swupdateprog"
> # CONFIG_MTD is not set
> # CONFIG_LUA is not set
> CONFIG_WEBSERVER=y
> CONFIG_MONGOOSESSL=y
> CONFIG_SIGNED_IMAGES=y
> CONFIG_ARCHIVE=y
> CONFIG_RAW=y
> CONFIG_SHELLSCRIPTHANDLER=y
> CONFIG_DOCKER=y
> ```
>
> What am i missing? how to build now swupdate without libubootenv?
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/8bcaf066-16c0-4aa9-8e42-ca1f6253e0d6n%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/8bcaf066-16c0-4aa9-8e42-ca1f6253e0d6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Darko Komljenović

unread,
Jul 1, 2024, 10:39:25 AMJul 1
to swupdate
Hi,

```
apt install libjson-c-dev libcurl4-openssl-dev libubootenv-dev
```
```
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libubootenv0.1 amd64 0.3.2-1build1 [12.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libubootenv-dev amd64 0.3.2-1build1 [11.0 kB]
```

yields linker issues

```
/usr/bin/ld: core/built-in.o: in function `swupdate_vars_initialize':
(.text.swupdate_vars_initialize+0x5a): undefined reference to `libuboot_read_config_ext'
/usr/bin/ld: (.text.swupdate_vars_initialize+0x10c): undefined reference to `libuboot_get_namespace'
collect2: error: ld returned 1 exit status

```

Stefano Babic

unread,
Jul 1, 2024, 10:47:06 AMJul 1
to Darko Komljenović, swupdate
Hi Darko,

On 01.07.24 16:39, Darko Komljenović wrote:
> Hi,
>
> ```
> apt install libjson-c-dev libcurl4-openssl-dev libubootenv-dev
> ```
> ```
> Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libubootenv0.1
> amd64 0.3.2-1build1 [12.0 kB]
> Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libubootenv-dev
> amd64 0.3.2-1build1 [11.0 kB]
> ```
>
> yields linker issues
>
> ```
> /usr/bin/ld: core/built-in.o: in function `swupdate_vars_initialize':
> (.text.swupdate_vars_initialize+0x5a): undefined reference to
> `libuboot_read_config_ext'
> /usr/bin/ld: (.text.swupdate_vars_initialize+0x10c): undefined reference
> to `libuboot_get_namespace' > collect2: error: ld returned 1 exit status
>

Well, but this often happens when an official package is mixed with a
last version of another package.....it is not surprising.

Ubuntu 22.04 delivers SWUpdate 2021.11-1.

You can of course build last SWUpdate on Ubuntu 2022.04, but then you
should also download and compile yourself libubootenv.

Best regards,
Stefano Babic

> ```
> https://groups.google.com/d/msgid/swupdate/8bcaf066-16c0-4aa9-8e42-ca1f6253e0d6n%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/8bcaf066-16c0-4aa9-8e42-ca1f6253e0d6n%40googlegroups.com> <https://groups.google.com/d/msgid/swupdate/8bcaf066-16c0-4aa9-8e42-ca1f6253e0d6n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/swupdate/8bcaf066-16c0-4aa9-8e42-ca1f6253e0d6n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/103c0c73-2764-4ea2-a0ce-bddae1e0efa6n%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/103c0c73-2764-4ea2-a0ce-bddae1e0efa6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Fabio Estevam

unread,
Jul 3, 2024, 11:08:13 AMJul 3
to Stefano Babic, Darko Komljenović, swupdate
Hi Darko,

On Mon, Jul 1, 2024 at 11:47 AM Stefano Babic
<stefan...@swupdate.org> wrote:

> You can of course build last SWUpdate on Ubuntu 2022.04, but then you
> should also download and compile yourself libubootenv.

To manually build libubootenv:

git clone https://github.com/sbabic/libubootenv.git
cd libubootenv
git checkout v0.3.5
mkdir build
cmake -B build
cmake --build build
sudo cmake --install build

Regards,

Fabio Estevam

Mark Jonas

unread,
Jul 5, 2024, 2:42:48 AMJul 5
to Fabio Estevam, Stefano Babic, Darko Komljenović, swupdate
Hi,

> > should also download and compile yourself libubootenv.
>
> To manually build libubootenv:
>
> git clone https://github.com/sbabic/libubootenv.git
> cd libubootenv
> git checkout v0.3.5
> mkdir build
> cmake -B build
> cmake --build build
> sudo cmake --install build

Alternatively you can use a ready made build container.

https://gitlab.com/toertel/docker-image-swupdate-contribute
https://hub.docker.com/r/toertel/swupdate-contribute/tags

Cheers,
Mark

Stefano Babic

unread,
Jul 5, 2024, 2:48:02 AMJul 5
to Mark Jonas, Fabio Estevam, Stefano Babic, Darko Komljenović, swupdate
Hi Mark,
Maybe we can add this information and the link to your container into
the documentation - if you think it is a good idea, just send a patch
for it.

Best regards,
Stefano

Darko Komljenović

unread,
Jul 5, 2024, 3:27:08 AMJul 5
to swupdate
Hi,

i solved this as i am using also packer to generate a VM for easier testing,

i am using gitlab-ci to generate me a debian package which then packer installs in the VM every day:

swupdate part of gitlab-ci: 

#GENERATE BINARIES
build::hiatus::swupdate:
  stage: build-packages
  image: ubuntu:22.04
  before_script:
    - apt-get update; apt-get install -y gcc make libarchive-dev libconfig-dev libssl-dev wget zlib1g-dev libjson-c-dev libcurl4-openssl-dev
    #libubootenv dependancy
    - apt-get install -y cmake libyaml-dev
  script:
    - cd src/swupdate/
    - export MAINDIR=$(pwd)
#local repository on gitlab
    - 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/swupdate/2024.05.2/swupdate-2024.05.2.tar.gz -nv'
    - 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/swupdate/2024.05.2/libubootenv-0.3.5.tar.gz -nv'
    - tar -xvf swupdate-2024.05.2.tar.gz
    - tar -xvf libubootenv-0.3.5.tar.gz
#####CUSTOM DEFCONFIG 
    - cp swupdate/defconfig swupdate-2024.05.2/
    - cd libubootenv-0.3.5/
    - mkdir build && cd build && cmake .. && cmake --build . -- -j$(nproc) && cmake --install .
    - cp /usr/local/lib/libubootenv.* ${MAINDIR}/swupdate-2024.05.2/
    - cd ${MAINDIR}/swupdate-2024.05.2/
    - make defconfig
    - make -j$(nproc)
  artifacts:
    paths:
      - src/swupdate/swupdate-2024.05.2/swupdate
      - src/swupdate/swupdate-2024.05.2/libubootenv*
    expire_in: 1 day

#GENERATE DEBIAN PACKAGE
build::hiatus::swupdate-deb:
  needs: ["build::hiatus::swupdate"]
  stage: build-deb
  image: ubuntu:22.04
  variables:
    PACKAGE_NAME: "swupdate"
    PACKAGE_VERSION: $VERSION_TAG
    PACKAGE_DEPENDANCY: "libarchive-dev, libconfig-dev, libssl-dev, zlib1g-dev"
    DEB_PKG: ${PACKAGE_NAME}_${PACKAGE_VERSION}
  script:
    - cd src/swupdate/debian-package
    - /bin/bash -c "mkdir -p ${DEB_PKG}/usr/{bin,lib/systemd/system,share/swupdate/www}"
    - /bin/bash -c "mkdir -p ${DEB_PKG}/var/lib/swupdate"
    - cp ../swupdate-2024.05.2/swupdate ${DEB_PKG}/usr/bin
    - cp -r ../swupdate-web/www/* ${DEB_PKG}/usr/share/swupdate/www
    - cp ../swupdate-2024.05.2/libubootenv.* ${DEB_PKG}/usr/lib
    - cp ../swupdate/swupdate.service ${DEB_PKG}/usr/lib/systemd/system
    - cp ../swupdate/sw_update_pub_key.pem ${DEB_PKG}/var/lib/swupdate
    - /bin/bash ./helper_generate_deb.sh generate
    - cp -v *.deb $CI_PROJECT_DIR
  artifacts:
    paths:
      - swupdate_*.deb
    expire_in: 1 day


helper_generate_deb.sh: https://pastebin.com/F8UuEvGR
swupdate.service: https://pastebin.com/nUWezNy4
swupdate-web: copy from swupdate git 

Darko Komljenović

unread,
Jul 5, 2024, 3:28:38 AMJul 5
to swupdate
Hi,

What i am not getting, is this used for building swupdate, or to run swupdate inside a container?

If it is for building how does it solve the issue that libubootenv is build as .so, and the swupdate is linked against .so, not .a
I tried deleting the .so to force it to use libubootenv.a but it created some different problems :D

Thanks,
DK

Mark Jonas

unread,
Jul 5, 2024, 12:51:56 PMJul 5
to Darko Komljenović, swupdate
Hi Darko,

> What i am not getting, is this used for building swupdate, or to run swupdate inside a container?
>
> If it is for building how does it solve the issue that libubootenv is build as .so, and the swupdate is linked against .so, not .a
> I tried deleting the .so to force it to use libubootenv.a but it created some different problems :D

The container is intended to compile (build) SWUpdate.

It cannot cross-compile SWUpdate. That is, it just compiles it for
amd64 (aka Intel 64 bit). This is not a problem because the idea is
that you can use it to test your patches either manually or in CI/CD
before sending them to the mailing list. That's why the runtest.sh
script is included.

Cheers,
Mark
Reply all
Reply to author
Forward
0 new messages