Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMakeLists.txt: set required std version to gnu++14 #504

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

LocutusOfBorg
Copy link
Contributor

New googletest 1.13.0 defaults to gnu++14, so makes this package FTBFS when building testsuite with this error:

In file included from /usr/include/gtest/gtest-message.h:57,
from /usr/include/gtest/gtest-assertion-result.h:46,
from /usr/include/gtest/gtest.h:64,
from /build/1st/dlt-daemon-2.18.9/tests/gtest_dlt_user.cpp:27:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
270 | #error C++ versions less than C++14 are not supported.
| ^~~~~

Thanks Adrian Bunk bunk@debian.org for the report and the fix!

New googletest 1.13.0 defaults to gnu++14, so makes this package FTBFS when building testsuite with this error:

In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from /build/1st/dlt-daemon-2.18.9/tests/gtest_dlt_user.cpp:27:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~

Thanks Adrian Bunk <bunk@debian.org> for the report and the fix!
@minminlittleshrimp minminlittleshrimp self-assigned this Jul 19, 2023
@minminlittleshrimp
Copy link
Collaborator

minminlittleshrimp commented Jul 19, 2023

Hello @LocutusOfBorg
Thank you for your interest in dlt topic.

There are some reasons for DLT team to keep googletest version 1.11.0. First, we need to make sure dlt backward compatible. Furthermore, no new macros from googletest 1.13.0 are used in our test suite. Hence, googletest 1.11.0 is still good to be used for our current test binaries.

For the unit tests in dlt, we build a convenient option for users, say WITH_DLT_UNIT_TESTS.
You could trigger cmake with this option before make. However, with current implementation, you need to do:

$ git submodule init
$ git submodule update

before you could use the option. This happens due to our recent activity of refactor and optimize dlt unit tests. This submodule initialization process will be automatically triggered in the future, and we are working for that, I will update soon in a PR.

Hello @michael-methner, what do think about this case?

Regards
DLT team

@minminlittleshrimp
Copy link
Collaborator

Hello @LocutusOfBorg
I raise my PR for submodule at #505, please kindly have a look and leave your comment.
Thank you,
DLT team

@LocutusOfBorg
Copy link
Contributor Author

Hello, as Debian maintainer, I can't use submodules, and I have to use whatever is provided by apt.
No embedded libraries whenever possible. Is my PR breaking the old googletest?

@LocutusOfBorg
Copy link
Contributor Author

btw I checked with my pr, and the code compiles also on old googletest e.g. 1.11.0-3

@minminlittleshrimp
Copy link
Collaborator

minminlittleshrimp commented Jul 26, 2023

Hello @LocutusOfBorg

I do not have good experience in Debian, so please support me a little bit.
I am trying to verify the case in my docker container deb bulleye

root@lum3hc-VirtualBox:~# apt-cache show libgtest-dev
Package: libgtest-dev
Source: googletest
Version: 1.10.0.20201025-1.1
Installed-Size: 1352
Maintainer: Steve M. Robbins <smr@debian.org>
Architecture: amd64
Replaces: googletest (<= 1.8.0-8)
Depends: googletest (= 1.10.0.20201025-1.1)
Conflicts: googletest (<= 1.8.0-8)
Description: Google's framework for writing C++ tests
Description-md5: 0f57efc74cf16270a96fc2540e04fd16
Multi-Arch: same
Homepage: https://github.com/google/googletest
Tag: devel::lang:c++, devel::library, implemented-in::c++, role::devel-lib
Section: libdevel
Priority: optional
Filename: pool/main/g/googletest/libgtest-dev_1.10.0.20201025-1.1_amd64.deb
Size: 225672
MD5sum: 673424c541720ea9727ffd158cc75460
SHA256: be9a0c957007d668a13d3e7874a7ca1d7f9310487b7965b680f329aa91514182

root@lum3hc-VirtualBox:~# apt-cache show dlt-daemon  
Package: dlt-daemon
Version: 2.18.6-1+deb11u1
Installed-Size: 283
Maintainer: Aigars Mahinovs <aigarius@debian.org>
Architecture: amd64
Depends: libc6 (>= 2.17)
Suggests: dlt-tools
Description: Diagnostic Log and Trace logging daemon
Description-md5: 15fd83b1fa60acc99b55161d8f999b70
Multi-Arch: foreign
Homepage: https://at.projects.genivi.org/wiki/display/PROJ/Diagnostic+Log+and+Trace
Tag: role::shared-lib
Section: libs
Priority: optional
Filename: pool/main/d/dlt-daemon/dlt-daemon_2.18.6-1+deb11u1_amd64.deb
Size: 104196
MD5sum: 6b23309b8f6dbeae7caaca6c30340c12
SHA256: 2118974148ed35937498a5cf55572da0c55aef76008471d2b48d782399ff02f7

root@lum3hc-VirtualBox:~# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@lum3hc-VirtualBox:~#  

I could not get the version I want, does it mean that I need to apt install the correct Deb dist. (say, Deb Sid) to have correct version?
And how can I reproduce your case? I mean, Is by cloning and building dlt-daemon locally in Deb docker possible?
I follow this link https://pkgs.org/search/?q=dlt-daemon

Thank you
Minh

@minminlittleshrimp
Copy link
Collaborator

minminlittleshrimp commented Jul 27, 2023

Hello all,

I could successfully reproduce the issue on Debian:Sid docker container.
Please kindly check below build logs:

In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_daemon_common.cpp:27:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~
In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_user.cpp:27:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~
In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_common.cpp:27:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~
In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from /home/lum3hc/work/docker/dlt-daemon/tests/dlt_env_ll_unit_test.cpp:25:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.

The information of my dev environment:

# apt-cache show cmake
Package: cmake
Version: 3.27.1-1
Installed-Size: 35654
Maintainer: Debian CMake Team <pkg-cmake-team@lists.alioth.debian.org>
Architecture: amd64
Depends: libarchive13 (>= 3.3.3), libc6 (>= 2.34), libcurl4 (>= 7.16.2), libexpat1 (>= 2.0.1), libgcc-s1 (>= 3.0), libjsoncpp25 (>= 1.9.5), librhash0 (>= 1.2.6), libstdc++6 (>= 13.1), libuv1 (>= 1.38.0), zlib1g (>= 1:1.1.4), cmake-data (= 3.27.1-1), procps
Recommends: gcc, make
Suggests: cmake-doc, cmake-format, elpa-cmake-mode, ninja-build
Description: cross-platform, open-source make system
Description-md5: b60d0479b91d22665e465b5cec287c83
Multi-Arch: foreign
Homepage: https://cmake.org/
Tag: devel::buildtools, implemented-in::c++, interface::commandline,
 interface::text-mode, role::program, scope::utility,
 uitoolkit::ncurses, works-with::software:source
Section: devel
Priority: optional
Filename: pool/main/c/cmake/cmake_3.27.1-1_amd64.deb
Size: 10266216
MD5sum: d5583bcacdd294ee8771c7941f78a17a
SHA256: 93d51e8dfb6aecaefc43a8e932cf05f6456b5e5d7a9aba7125a34a8fb6f343dd

# apt-cache show libgtest-dev
Package: libgtest-dev
Source: googletest
Version: 1.13.0-5
Installed-Size: 1453
Maintainer: Steve M. Robbins <smr@debian.org>
Architecture: amd64
Depends: googletest (= 1.13.0-5)
Description: Google's framework for writing C++ tests
Description-md5: 0f57efc74cf16270a96fc2540e04fd16
Multi-Arch: same
Homepage: https://github.com/google/googletest
Tag: devel::lang:c++, devel::library, implemented-in::c++, role::devel-lib
Section: libdevel
Priority: optional
Filename: pool/main/g/googletest/libgtest-dev_1.13.0-5_amd64.deb
Size: 242796
MD5sum: 8606a9547e6259d619da2323734b713e
SHA256: f60af447d52e7f668c3774c7e27dac275b6a801ca00782bbbd96e02ba000a36a

# apt-cache show dlt-daemon  
Package: dlt-daemon
Version: 2.18.9-2
Installed-Size: 308
Maintainer: Aigars Mahinovs <aigarius@debian.org>
Architecture: amd64
Depends: libc6 (>= 2.34)
Suggests: dlt-tools
Description: Diagnostic Log and Trace logging daemon
Description-md5: 58557a5349b9c836414a2c4fad9c8063
Multi-Arch: foreign
Homepage: https://github.com/COVESA/dlt-daemon
Tag: role::shared-lib
Section: libs
Priority: optional
Filename: pool/main/d/dlt-daemon/dlt-daemon_2.18.9-2_amd64.deb
Size: 112596
MD5sum: e64f6736c9cc991ba9bfc9db5251058c
SHA256: 1422647765469ebb2c0696d915d89ce3eb40a7f1596fb722e416b44410bedc59

# cat /etc/os-release      
PRETTY_NAME="Debian GNU/Linux bookworm/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

# apt-cache show git       
Package: git
Version: 1:2.40.1-1
Installed-Size: 44963
Maintainer: Jonathan Nieder <jrnieder@gmail.com>
Architecture: amd64
Provides: git-completion, git-core
Depends: libc6 (>= 2.34), libcurl3-gnutls (>= 7.56.1), libexpat1 (>= 2.0.1), libpcre2-8-0 (>= 10.34), zlib1g (>= 1:1.2.2), perl, liberror-perl, git-man (>> 1:2.40.1), git-man (<< 1:2.40.1-.)
Recommends: ca-certificates, patch, less, ssh-client
Suggests: gettext-base, git-daemon-run | git-daemon-sysvinit, git-doc, git-email, git-gui, gitk, gitweb, git-cvs, git-mediawiki, git-svn
Breaks: bash-completion (<< 1:1.90-1), cogito (<= 0.18.2+), dgit (<< 5.1~), git-buildpackage (<< 0.6.5), git-el (<< 1:2.32.0~rc2-1~), gitosis (<< 0.2+20090917-7), gitpkg (<< 0.15), guilt (<< 0.33), openssh-client (<< 1:6.8), stgit (<< 0.15), stgit-contrib (<< 0.15)
Description: fast, scalable, distributed revision control system
Description-md5: c1f968556452a190fe359bffd151c012
Multi-Arch: foreign
Homepage: https://git-scm.com/
Tag: devel::lang:perl, devel::library, devel::rcs, implemented-in::c,
 implemented-in::perl, implemented-in::shell, interface::text-mode,
 network::client, network::server, protocol::ssh, protocol::tcp,
 role::devel-lib, role::program, works-with::file,
 works-with::software:source, works-with::vcs
Section: vcs
Priority: optional
Filename: pool/main/g/git/git_2.40.1-1_amd64.deb
Size: 7268968
MD5sum: 678610b96aa63aef6682814608d9d650
SHA256: ef21377d38d790f12a99fe199ea352e9089a8bb29ebfd00a4665917e77b2665a

I checked and I could use git submodule here, hence I applied my patch in #505
It is obviously that whenever there is a gtest version installed, gtest will take that one as default.
Hence, I modified my patch in the PR, this time if there is gtest version greater than 1.11.0, it will use submodule instead.
I tested with and without libgtest-dev pkg installed, both cases are good to go.
So, @michael-methner and DLT teeam please kindly review #505
Also Gtest version for dlt-daemon is limited to 1.11.0.
Regards

@minminlittleshrimp
Copy link
Collaborator

Hello @michael-methner
Personally I think if we update c++ standard from 11 to 14, we need to be careful since docs say there might be conflicts!
In that case, it requires an official Major release for this update, when DLT team needs to check and resolve all possible conflicts before releasing.
Please correct me if I am misunderstanding anywhere.
Thank you

@michael-methner michael-methner merged commit ae20488 into COVESA:master Aug 2, 2023
@LocutusOfBorg LocutusOfBorg deleted the patch-2 branch August 7, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants