From d9955e61e593554a18218217eb88214ac10195f8 Mon Sep 17 00:00:00 2001 From: P-A Loizeau <p.-a.loizeau@gsi.de> Date: Wed, 10 Apr 2024 16:26:41 +0200 Subject: [PATCH] Add info about boost archive versions + version checker binary --- README.md | 5 ++ docs/boost_serialization_version.md | 38 ++++++++++++ .../boost_bin_arch_version_checker/README.md | 41 +++++++++++++ .../check_archive_version.cpp | 58 +++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 docs/boost_serialization_version.md create mode 100644 services/boost_bin_arch_version_checker/README.md create mode 100644 services/boost_bin_arch_version_checker/check_archive_version.cpp diff --git a/README.md b/README.md index 52862e43c2..5733228843 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,11 @@ FairRoot: `v18.6.7` Clang-format: `v11.0` +Boost archives being only ensured to be `backward compatible` (and therefore not necessarily +`forward compatible`), care must be taken when writing data and/or parameter files with it +that the versions used when writing and when using/reading are compatible. \ +More information in the [following document](docs/boost_serialization_version.md). + # 5. Further remarks Compiling CbmRoot with multicore support using "make -j", without diff --git a/docs/boost_serialization_version.md b/docs/boost_serialization_version.md new file mode 100644 index 0000000000..d0431fe73f --- /dev/null +++ b/docs/boost_serialization_version.md @@ -0,0 +1,38 @@ +# Boost serialization archive version + +``` +Boost version | BOOST_ARCHIVE_VERSION | Used in + +1.54 | 10 | [Ubuntu Trusty 14.04 LTS default, EOL: 2024-04] +[...] +1.67 | 16 | [Debian 10 Buster 19.07, EOL: 2022-08] +1.68 | 17 | [Fairsoft jun19 and its patch versions] +1.69 | 17 | +1.70 | 17 | +1.71 | 17 | [Ubuntu Focal 20.04 LTS, EOL: 2030-04] +1.72 | 17 | [Fairsoft nov20] +1.73 | 18 | +1.74 | 18 | [Debian 11 Bullseye 21.08, EOL: 2024-07] + [Debian 12 Bookworm 23.07] + [Ubuntu Jammy 22.04 LTS, EOL: 2032-04] +1.75 | 18 | [Fairsoft apr21 and its patch versions] +1.76 | 19 | +1.77 | 19 | +1.78 | 19 | [Fairsoft apr22 and its patch versions] +1.79 | 19 | +1.80 | 19 | [Fairsoft nov22 and its patch versions] +1.81 | 19 | +1.82 | 19 | +1.83 | 19 | [Fairsoft jan24 and its patch versions] +1.84 | 20 | +dev | 20 | +``` + +------------------- +- Based on [the corresponding list in the Flesnet repository](https://github.com/cbm-fles/flesnet/blob/master/doc/boost_serialization.txt) +- List of BOOST_ARCHIVE_VERSION changes: +https://github.com/boostorg/serialization/blob/develop/src/basic_archive.cpp + +# Version checker binary + +See the [README of services/boost_bin_arch_version_checker](../services/boost_bin_arch_version_checker/README.md) diff --git a/services/boost_bin_arch_version_checker/README.md b/services/boost_bin_arch_version_checker/README.md new file mode 100644 index 0000000000..f3c4c5fd3d --- /dev/null +++ b/services/boost_bin_arch_version_checker/README.md @@ -0,0 +1,41 @@ +Standalone binary printing out the BOOST_ARCHIVE_VERSION of a boost binary archive and the minimal version of Fairsoft needed to read it. + +# Caveats + +1. The binary has to fully load/open the file to access the version number +1. `boost` throws an `unsupported version` exception of type `boost::archive::archive_exception` when encountering an archive created with a more recent and non-backward compatible version + +=> !!! Use the newest version of `Fairsoft` or a most up to date version of `boost` to have largest compatibility !!! +=> User will probably want to use another version of `boost` than the one making troubles, therefore the independent compilation + +# Compilation + +With `Fairsoft nov22p1` +``` +g++ check_archive_version.cpp -I/cvmfs/fairsoft.gsi.de/debian10/fairsoft/nov22p1/include/boost/archive/ -L/cvmfs/fairsoft.gsi.de/debian10/fairsoft/nov22p1/lib -Wl,-rpath,/cvmfs/fairsoft.gsi.de/debian10/fairsoft/nov22p1/lib -lboost_serialization -o check_archive_version +``` + +# Usage + +``` +./check_archive_version <PATH TO BOOST BINARY ARCHIVE> +``` + +# Example +``` +> ./check_archive_version /lustre/cbm/online/output/mCBM_24/2914_00_00.rra +trying to check BOOST_ARCHIVE_VERSION of /lustre/cbm/online/output/mCBM_24/2914_00_00.rra +get_library_version() for /lustre/cbm/online/output/mCBM_24/2914_00_00.rra + => 19 +Minimal Fairsoft version: apr22 and its patch versions +``` + +# Pre-compiled version on lustre + +- !!! Subject to changes without warning !!! +- Should work as long as operating under `Debian10` with `cvmfs` available (e.g. `vae23`or `GSI Linux on lxg/lxi`) +- Tested on `vae23` and one lxg machine + +``` +/lustre/cbm/users/ploizeau/tools/boost/check_archive_version +``` diff --git a/services/boost_bin_arch_version_checker/check_archive_version.cpp b/services/boost_bin_arch_version_checker/check_archive_version.cpp new file mode 100644 index 0000000000..78b2f96805 --- /dev/null +++ b/services/boost_bin_arch_version_checker/check_archive_version.cpp @@ -0,0 +1,58 @@ +/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Pierre-Alain Loizeau [committer] */ + +#include <boost/archive/binary_iarchive.hpp> + +#include <fstream> +#include <iostream> +#include <sstream> + +int main(int argc, char* argv[]) +{ + + if (2 != argc) { + std::cout << "This small programm needs a path to a boost archive as input argument!" << std::endl; + return -1; + } + + std::cout << "trying to check BOOST_ARCHIVE_VERSION of " << argv[1] << std::endl; + + std::ifstream ifs(argv[1], std::ios::binary); + if (!ifs) { + std::stringstream msg; + msg << "file \"" << argv[1] << "\" was not found"; + throw std::runtime_error(msg.str()); + } + + boost::archive::binary_iarchive ia(ifs); + unsigned v = ia.get_library_version(); + + std::cout << "get_library_version() for " << argv[1] << "\n => " << v << std::endl; + if (v < 17) { + std::cout << "Any version of Fairsoft supported by Cbmroot should work" << std::endl; + } + else { + switch (v) { + case 17: { + std::cout << "Minimal Fairsoft version: jun19 and its patch versions" << std::endl; + break; + } + case 18: { + std::cout << "Minimal Fairsoft version: apr21 and its patch versions" << std::endl; + break; + } + case 19: { + std::cout << "Minimal Fairsoft version: apr22 and its patch versions" << std::endl; + break; + } + case 20: + default: { + std::cout << "No Fairsoft version supporting this file to date (10/04/2024)" << std::endl; + break; + } + } + } + + return v; +} -- GitLab