cppagent icon indicating copy to clipboard operation
cppagent copied to clipboard

Ubuntu 20.04: Error building test package

Open shaurabhsingh opened this issue 1 year ago • 25 comments

Agent build is successful when you skip the test package build and running the tests:

conan create cppagent -pr cppagent/conan/profiles/gcc --build=missing -c tools.build:skip_test=True -tf=""

If the test package build is tried it fails at CXX object CMakeFiles/agent_test_lib.dir/agent_test_helper.cpp.o.

image

It errors out with the following:

image

Note: I haven't included the entire log as it is massive and I did not capture it. Let me know if that is needed.

shaurabhsingh avatar Feb 28 '24 07:02 shaurabhsingh

Looks like a compiler (gcc) issue. Sometimes the LTE versions rev the version of the compiler.

I need to check the build. Was this intel or arm arch?

wsobel avatar Feb 28 '24 08:02 wsobel

Its intel x86_64

shaurabhsingh avatar Feb 28 '24 08:02 shaurabhsingh

That’s what I figured. This Week from if possible and will use virt processor if necessary.

wsobel avatar Feb 28 '24 08:02 wsobel

What version of ubuntu?

wsobel avatar Mar 10 '24 20:03 wsobel

I tested and it built. Can you tell me what version of GCC you were using?

just did:

conan build ../cppagent -of . -pr ../cppagent/conan/profiles/gcc --build=missing -s build_type=Release

wsobel avatar Mar 10 '24 22:03 wsobel

Built fine. What version of GCC?

wsobel avatar Mar 11 '24 02:03 wsobel

Cannot reproduce. Tried with gcc 11 and 12, compiles fine. gcc 12 has a few warnings in the date lib. nothing functional.

All tests past for both. Started clean each time–complete builds of all dependencies.

wsobel avatar Mar 11 '24 03:03 wsobel

I have built on ARM 22.04 using GCC 9.5, 11, and 12 with no problems. All tests past.

I will close this unless we can understand. Earlier versions of 9 did not have full C++ 17 support. 9.5 should be available on all platforms. We may need to add documentation for building on rPis.

wsobel avatar Mar 11 '24 14:03 wsobel

To my knowledge, Ubuntu 20.04 does not have the correct version of the GCC compiler. If I remember correctly, the refactor back in version 2.2.0.6 required a 22.04+ Ubuntu version as it would not be compatible with the earlier version of the compiler in 20.04.

skibum1869 avatar Mar 20 '24 05:03 skibum1869

The docker image and the CI/CD build use 22.04. The necessary line is as follows:

sudo apt install -y build-essential cmake gcc-11 g++-11 python3 autoconf automake

This from the .github/workflows/build.yml. As you can see, we install g++ 11 explicitly. This should work on any 22.04 instance. Make sure you do an apt update as well to get the lastest build info.

wsobel avatar Mar 20 '24 23:03 wsobel

How could I get this building to support ubuntu 20.04? Since it's LTE, the latest version of gcc/g++ at least provided by the official focal repositories is 10. If I can't build or run the latest version on 20.04, which tag would build successfully for 20.04?

johnathan-arsenault avatar Apr 01 '24 18:04 johnathan-arsenault

The issue is the version of g++. Ubuntu LTE has many versions of g++ available, you just need to apt get the right version.

Did you see the line above? Install version 11 and it should work. This should also be the default since it is what builds in the docker image.

Did you try doing the apt get?

wsobel avatar Apr 01 '24 20:04 wsobel

Ubuntu 20.04 official focal repositories only go up to gcc and g++ 10.5.0. If I build a local copy of gcc and g++ 11, will the build process package those dependent libraries?

johnathan-arsenault avatar Apr 02 '24 13:04 johnathan-arsenault

Conan will pull in all the dependencies.

wsobel avatar Apr 02 '24 13:04 wsobel

Theoretically, I could build on 22.04 and then run on 20.04? if so, it looks like the proper libc6 shared libraries are not being copied over when packaging with cpack

johnathan-arsenault avatar Apr 02 '24 14:04 johnathan-arsenault

It is surprising this is an issue. In Docker I have never had this problem when running in a clean instance.

See the docker file. In release all it does is apt-get update

There are no dependencies.

I need more information to understand how to reproduce this issue. When I did a build according to the instructions it worked fine.

wsobel avatar Apr 02 '24 14:04 wsobel

This is the build environment for 22.04:

RUN  apt-get update \
  && apt-get install -y \
       autoconf \
       automake \
       build-essential \
       cmake \
       git \
       python3 \
       python3-pip \
       rake \
       ruby \
  && rm -rf /var/lib/apt/lists/* \
  && pip install conan

We do not specify the version of g++ or gcc so it must be the default in build-essential. I assume it was updated because we first do the apt-get update.

wsobel avatar Apr 02 '24 14:04 wsobel

If I build in 22.04, can I then run the package in 20.04? The issue is the majority of our machines are on 20.04, with the newer ones being 22.04. I've tried going back in the older releases, but am hitting other roadblocks there with just building on 20.04.

johnathan-arsenault avatar Apr 02 '24 14:04 johnathan-arsenault

This is the error I get when attempting to run a 22.04 built binary on 20.04

agent/bin/agent: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found (required by /home/edge/agent3/bin/../lib/libagent_lib.so) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/edge/agent3/bin/../lib/libagent_lib.so) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/edge/agent3/bin/../lib/libagent_lib.so) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/edge/agent3/bin/../lib/libagent_lib.so) agent/bin/agent: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/edge/agent3/bin/../lib/libagent_lib.so) agent/bin/agent: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /home/edge/agent3/bin/../lib/libagent_lib.so) agent/bin/agent: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/edge/agent3/bin/../lib/libboost_log.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /home/edge/agent3/bin/../lib/libboost_log.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/edge/agent3/bin/../lib/libboost_log.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/edge/agent3/bin/../lib/libboost_log.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/edge/agent3/bin/../lib/libboost_log.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/edge/agent3/bin/../lib/libboost_iostreams.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/edge/agent3/bin/../lib/libboost_thread.so.1.82.0) agent/bin/agent: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/edge/agent3/bin/../lib/libboost_program_options.so.1.82.0)

johnathan-arsenault avatar Apr 02 '24 18:04 johnathan-arsenault

If I can put together an example for 20.04 in docker, would that be helpful?

wsobel avatar Apr 02 '24 19:04 wsobel

I built using docker and 20.04:

agent@64b38cf0a8f3:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"

Using the following dockerfile:

Dockerfile20.txt

See if you can build using this file.

wsobel avatar Apr 02 '24 20:04 wsobel

I can reproduce the error with the following docker build command docker build -t mtc-agent:latest --build-arg WITH_TESTS=true --build-arg WITH_TESTS_ARG= .

How much value do the tests provide? is this something that can be safely skipped?

johnathan-arsenault avatar Apr 03 '24 02:04 johnathan-arsenault

They can be skipped for a production build. The CI/CD runs tests on all three platforms. For the docker builds we usually skip just because of the time it takes on dual platform.

wsobel avatar Apr 03 '24 03:04 wsobel

Skipping the tests, it does build on 20.04, and I can confirm that it works. Is this something that should be investigated on why the tests are not able to be built on 20.04? I understand if not, as 20.04 will be EOL next year, but it is peculiar.

johnathan-arsenault avatar Apr 03 '24 18:04 johnathan-arsenault

I'll look into why the tests fail on 20. I'll see if it can be fixed in the next release.

wsobel avatar Apr 03 '24 19:04 wsobel