### Install Libabigail Binaries and Documentation Source: https://github.com/git/libabigail/blob/master/doc/website/mainpage.txt Run the make install command to install the compiled binaries and documentation to the specified prefix. ```bash make install ``` -------------------------------- ### Analyze Linux Kernel Tree for KMI Source: https://github.com/git/libabigail/blob/master/doc/manuals/abidw.md This example demonstrates the process of checking out a Linux kernel, building it, installing modules, and then using `abidw` with the `--linux-tree` option to serialize the Kernel Module Interface (KMI). ```default $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git $ cd linux && git checkout v4.5 $ make allyesconfig all $ mkdir build-output $ make INSTALL_MOD_PATH=./build-output modules_install $ cp vmlinux build-output/modules/4.5.0 $ abidw --linux-tree build-output/modules/4.5.0 > build-output/linux-4.5.0.kmi ``` -------------------------------- ### Configure Libabigail Installation Source: https://github.com/git/libabigail/blob/master/doc/website/mainpage.txt Run the configure script to set the installation prefix. Replace with your desired installation directory. ```bash ../configure --prefix= ``` -------------------------------- ### Check application ABI compatibility with abicompat Source: https://context7.com/git/libabigail/llms.txt This snippet shows the setup for using `abicompat` to verify ABI compatibility. It involves compiling an example application and two versions of a shared library it depends on. ```bash # Compile example application and two library versions g++ -g -Wall -shared -o libtest-0.so test0.cc # original library g++ -g -Wall -shared -o libtest-1.so test1.cc # updated library g++ -g -Wall -o test-app -L. -ltest-0 test-app.cc ``` -------------------------------- ### Configure and Build Libabigail from Tarball Source: https://github.com/git/libabigail/blob/master/doc/website/mainpage.txt Steps to configure, build, and install Libabigail after extracting the tarball. Ensure the specified installation prefix exists and is writable. ```bash mkdir build cd build ../configure --prefix=/where/you/want/to/install/libabigail make all install ``` -------------------------------- ### Compare Libraries and Their Dependencies Source: https://github.com/git/libabigail/blob/master/doc/manuals/abidiff.md This example demonstrates how to compare two libraries along with their respective dependencies. It uses flags to specify directories where dependent binaries can be found. ```bash abidiff --follow-dependencies \ --added-binaries-dir1 /some/where \ --added-binaries-dir2 /some/where/else \ foo bar ``` -------------------------------- ### Build Linux Kernel for Comparison Source: https://github.com/git/libabigail/blob/master/doc/manuals/kmidiff.md Example of cloning a specific kernel version and building it with allyesconfig. This prepares the kernel for KMI comparison. ```bash git clone -b v4.5 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux/v4.5 cd linux/v4.5 make allyesconfig all ``` -------------------------------- ### List installed libraries Source: https://github.com/git/libabigail/blob/master/README-DOCKER.md Lists the contents of the Spack environment's view directory, showing installed libraries and binaries. ```bash ls /opt/abigail-env/.spack-env/view/ ``` -------------------------------- ### Example abipkgdiff Output Source: https://github.com/git/libabigail/blob/master/doc/manuals/abipkgdiff.md This is an example of the default report kind emitted by the `abidiff` tool when comparing two Linux Kernel packages. ```default $ abidiff libtest-v0.so libtest-v1.so Functions changes summary: 0 Removed, 1 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 function with some indirect sub-type change: [C]'function void fn(C&)' at test-v1.cc:13:1 has some indirect sub-type changes: parameter 1 of type 'C&' has sub-type changes: in referenced type 'struct C' at test-v1.cc:7:1: type size hasn't changed 1 data member change: type of 'leaf* C::m0' changed: in pointed to type 'struct leaf' at test-v1.cc:1:1: type size changed from 32 to 64 bits 1 data member insertion: 'char leaf::m1', at offset 32 (in bits) at test-v1.cc:4:1 $ ``` -------------------------------- ### Compare multiple packages as sets with abipkgdiff Source: https://context7.com/git/libabigail/llms.txt This example shows how to use `abipkgdiff` to compare two sets of packages. This is useful when you need to compare multiple libraries or components that are distributed together. ```bash abipkgdiff \ --set1 libfoo-1.0.rpm libbar-1.0.rpm \ --set2 libfoo-2.0.rpm libbar-2.0.rpm ``` -------------------------------- ### Install with Spack in Ubuntu Container Source: https://github.com/git/libabigail/blob/master/README-DOCKER.md Installs packages using Spack within the Ubuntu Libabigail container. Assumes source code is bound to /src. ```bash spack install ``` -------------------------------- ### Example abipkgdiff Output (Leaf Changes Only) Source: https://github.com/git/libabigail/blob/master/doc/manuals/abipkgdiff.md This is an example of the typical output of `abipkgdiff` and `abidiff` when comparing two binaries, using the `--leaf-changes-only` option. ```default $ abidiff libtest-v0.so libtest-v1.so Functions changes summary: 0 Removed, 1 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 function with some indirect sub-type change: [C]'function void fn(C&)' at test-v1.cc:13:1 has some indirect sub-type changes: parameter 1 of type 'C&' has sub-type changes: in referenced type 'struct C' at test-v1.cc:7:1: type size hasn't changed 1 data member change: type of 'leaf* C::m0' changed: in pointed to type 'struct leaf' at test-v1.cc:1:1: type size changed from 32 to 64 bits ``` -------------------------------- ### Shell into Ubuntu Libabigail Container Source: https://github.com/git/libabigail/blob/master/README-DOCKER.md Starts an interactive bash session inside the Ubuntu Libabigail container. ```bash docker run -it ghcr.io/woodard/libabigail-ubuntu-22.04 bash ``` -------------------------------- ### Detect Added/Removed Functions in Libraries Source: https://github.com/git/libabigail/blob/master/doc/manuals/abidiff.md This example demonstrates how to detect added or removed functions between two library versions by compiling and comparing them using abidiff. It shows the source code for two versions of a library and the commands to compile and compare them. ```c++ // Compile this with: // g++ -g -Wall -shared -o libtest-v0.so test-v0.cc struct S0 { int m0; }; void foo(S0& /*parameter_name*/) { // do something with parameter_name. } ``` ```c++ // Compile this with: // g++ -g -Wall -shared -o libtest-v1.so test-v1.cc struct S0 { char inserted_member; int m0; }; void bar(S0& /*parameter_name*/) { // do something with parameter_name. } ``` ```bash g++ -g -Wall -shared -o libtest-v0.so test-v0.cc g++ -g -Wall -shared -o libtest-v1.so test-v1.cc abidiff libtest-v0.so libtest-v1.so; echo "exit code: $?" ``` -------------------------------- ### Install Kernel Modules Source: https://github.com/git/libabigail/blob/master/doc/manuals/kmidiff.md Installs the built kernel modules into a specified directory, typically a subdirectory of the kernel source tree, for kmidiff to access. ```bash mkdir build/modules make modules_install INSTALL_MOD_DIR=build/modules ``` -------------------------------- ### Generate Build System Information Source: https://github.com/git/libabigail/blob/master/doc/website/mainpage.txt Run this command in the root of your local Libabigail Git repository to generate necessary build-system-related configuration files. ```bash autoreconf -i ``` -------------------------------- ### Prepare Build Directory from Git Repository Source: https://github.com/git/libabigail/blob/master/doc/website/mainpage.txt Commands to create a build directory within the local Libabigail Git repository to store compilation outputs. ```bash cd libabigail mkdir build ``` -------------------------------- ### Suppression Specification Examples Source: https://context7.com/git/libabigail/llms.txt Examples of suppression file syntax for filtering ABI change reports. These directives can suppress changes to types, functions, or variables based on name, regex, or specific conditions. ```ini # mylib.abignore # Suppress all changes to a private/opaque struct by name [suppress_type] type_kind = struct name = FooPrivateType ``` ```ini # Suppress changes to any type matching a regex [suppress_type] type_kind = struct name_regexp = ^.*PrivateImpl$ ``` ```ini # Suppress data member insertions into padding at known safe offsets [suppress_type] name = S has_data_member_inserted_between = {offset_after(member0), offset_of(member1)} has_data_member_inserted_at = end ``` -------------------------------- ### Build Ubuntu Libabigail Docker Image Source: https://github.com/git/libabigail/blob/master/README-DOCKER.md Builds the Ubuntu 22.04 base image for Libabigail. Use this command in the root of the repository. ```bash docker build -f docker/Dockerfile.ubuntu -t ghcr.io/woodard/libabigail-ubuntu-22.04 . ``` -------------------------------- ### Build Libabigail Package Source: https://github.com/git/libabigail/blob/master/doc/website/mainpage.txt Execute the make command to compile the Libabigail package after configuration. ```bash make ``` -------------------------------- ### Get Summary Statistics with abidiff Source: https://context7.com/git/libabigail/llms.txt Obtain only summary statistics of ABI changes using the --stat option with abidiff. ```bash # Summary statistics only abidiff --stat libtest-v0.so libtest-v1.so ``` -------------------------------- ### Compile libraries and application Source: https://github.com/git/libabigail/blob/master/doc/manuals/abicompat.md Commands to compile the initial and modified shared libraries, and then compile the application and link it against the initial library. ```bash g++ -g -Wall -shared -o libtest-0.so test0.cc g++ -g -Wall -shared -o libtest-1.so test1.cc ``` ```bash g++ -g -Wall -o test-app -L. -ltest-0.so test-app.cc ``` -------------------------------- ### Basic fedabipkgdiff Invocation Source: https://github.com/git/libabigail/blob/master/doc/manuals/fedabipkgdiff.md Use this command to initiate ABI comparison for specified Fedora package versions (NVR). Ensure the necessary environment variables for suppression files are configured if needed. ```bash fedabipkgdiff [option] ... ``` -------------------------------- ### Detect Another Sub-type Change in Function Source: https://github.com/git/libabigail/blob/master/doc/manuals/abidiff.md Shows another example of detecting ABI changes related to sub-types within a function. This snippet is incomplete in the source. ```default $ cat -n test-v0.cc 1 // Compile this with: 2 // g++ -g -Wall -shared -o libtest-v0.so test-v0.cc 3 4 struct S0 5 { 6 int m0; 7 }; 8 9 void 10 foo(S0& /*parameter_name*/) 11 { 12 // do something with parameter_name. 13 } $ $ cat -n test-v1.cc 1 // Compile this with: 2 // g++ -g -Wall -shared -o libtest-v1.so test-v1.cc 3 4 struct S0 5 { ``` -------------------------------- ### Suppression Specification Section Example Source: https://github.com/git/libabigail/blob/master/doc/manuals/suppression-specifications.md Sections group properties for suppression. The section name is enclosed in square brackets. Properties within a section are defined as key-value pairs. ```default [section_name] property1_name = property1_value property2_name = property2_value ``` -------------------------------- ### Show identical binaries with abipkgdiff Source: https://context7.com/git/libabigail/llms.txt Use `abipkgdiff` with the `--show-identical-binaries` option to list all compared binaries, including those that have identical ABIs. This provides a complete overview of the comparison results. ```bash abipkgdiff --show-identical-binaries libfoo-old.rpm libfoo-new.rpm ``` -------------------------------- ### Build Fedora Libabigail Docker Image Source: https://github.com/git/libabigail/blob/master/README-DOCKER.md Builds the Fedora base image for Libabigail. Use this command in the root of the repository. ```bash docker build -f docker/Dockerfile.fedora -t ghcr.io/woodard/libabigail-fedora . ``` -------------------------------- ### Suppress undefined symbols with abidw Source: https://context7.com/git/libabigail/llms.txt This example shows how to use `abidw` to generate an ABI representation while excluding undefined symbols from the output. This can help in focusing on the defined interface of a library. ```bash abidw --drop-undefined-syms /usr/lib64/libfoo.so > libfoo.abi ``` -------------------------------- ### Self-check Example for abipkgdiff Source: https://github.com/git/libabigail/blob/master/doc/manuals/abipkgdiff.md Use the --self-check option to test the underlying Libabigail library by comparing binaries against their ABIXML representations. This is useful for regression testing during Libabigail development. ```bash $ abipkgdiff --self-check --d1 mesa-libGLU-debuginfo-9.0.1-3.fc33.x86_64.rpm mesa-libGLU-9.0.1-3.fc33.x86_64.rpm ==== SELF CHECK SUCCEEDED for 'libGLU.so.1.3.1' ==== $ ``` -------------------------------- ### Compile 64-bit Shared Library with GCC Source: https://github.com/git/libabigail/blob/master/tests/data/test-lookup-syms/test1.c.compiling.txt Use this command to compile a 64-bit shared library. Ensure you have the necessary source files and version script. ```bash gcc -g -shared -Wl,--version-script=test1.version-script -o test1.so test1.c ```