Skip to content

rpath wrappers may break passed defines #5192

Description

@Thyre

The tests of Score-P contain one particular check, making sure that defines are properly passed to an instrumented program. The test code looks like this:

/*
 * SPDX-FileCopyrightText: (c) 2024 Forschungszentrum Jülich GmbH <fz-juelich.de>
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */


#include <cstdlib>
#include <cstdio>

// Compile-time comparison of string literals
constexpr bool
is_equal( char const* lhs,
          char const* rhs )
{
    return ( *lhs == *rhs )
           && ( ( *lhs == '\0' )
                || is_equal( lhs + 1, rhs + 1 ) );
}

#ifndef FOO
    #define FOO ""
#endif


int
main( int    argc,
      char** argv )
{
    static_assert( is_equal( FOO, "\'" ) );

    return EXIT_SUCCESS;
}

However, when passed through the rpath wrappers of EasyBuild, this test runs into the static assertion, as FOO is set to an empty string.
For this, we do not need Score-P and can simply run the test case:

[jreuter@Linux easyconfigs]$ ml
No modules loaded
[jreuter@Linux easyconfigs]$ module load GCC/14.3.0 OpenMPI
[jreuter@Linux easyconfigs]$ which g++
/data/EasyBuild-develop/software/GCCcore/14.3.0/bin/g++
[jreuter@Linux easyconfigs]$ g++ '-DFOO="'\''"' test.cpp
[jreuter@Linux easyconfigs]$ ./a.out
[jreuter@Linux easyconfigs]$ ml buildenv
[jreuter@Linux easyconfigs]$ which g++
/data/EasyBuild-develop/software/buildenv/default-foss-2025b/bin/rpath_wrappers/gxx_wrapper/g++
[jreuter@Linux easyconfigs]$ g++ '-DFOO="'\''"' test.cpp
test.cpp: In function ‘int main(int, char**)’:
test.cpp:31:28: error: static assertion failed
   31 |     static_assert( is_equal( FOO, "\'" ) );
      |                    ~~~~~~~~^~~~~~~~~~~~~

Looking at the debug output, FOO is stripped its ':

(2580495) [2026-05-11 16:02:43] found CMD: g++ | original command: /data/EasyBuild-develop/software/GCCcore/14.3.0/bin/g++ | orig args: '"-DFOO="'" test.cpp"'
(2580495) [2026-05-11 16:02:43] python3 -E -O -s -S /data/EasyBuild-develop/software/buildenv/default-foss-2025b/bin/rpath_wrappers/gxx_wrapper/../rpath_args.py g++ '/lib.*,/usr.*,/tmp/eb-n3gr6e5v.*,/data/EasyBuild-develop/build/buildenv/default/foss-2025b.*,.*/lib(64)?/stubs/?.*,.*/stubs/lib(64)?/?.*' '/data/EasyBuild-develop/software/buildenv/default-foss-2025b/lib,/data/EasyBuild-develop/software/buildenv/default-foss-2025b/lib64,,/../lib,/../lib64' "-DFOO="'" test.cpp"'
(2580495) [2026-05-11 16:02:43] rpath_args_out:
CMD_ARGS=('-Wl,-rpath=/data/EasyBuild-develop/software/buildenv/default-foss-2025b/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/buildenv/default-foss-2025b/lib64' '-Wl,-rpath=$ORIGIN' '-Wl,-rpath=$ORIGIN/../lib' '-Wl,-rpath=$ORIGIN/../lib64' '-Wl,--disable-new-dtags' '-Wl,-rpath=/data/EasyBuild-develop/software/ScaLAPACK/2.2.2-gompi-2025b-fb/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/FFTW.MPI/3.3.10-gompi-2025b/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/FFTW/3.3.10-GCC-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/FlexiBLAS/3.4.5-GCC-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/OpenBLAS/0.3.30-GCC-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/OpenMPI/5.0.8-GCC-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/UCC/1.4.4-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/PRRTE/3.0.11-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/PMIx/5.0.8-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/libfabric/2.1.0-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/UCX/1.19.0-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/libevent/2.1.12-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/OpenSSL/3/lib64' '-Wl,-rpath=/data/EasyBuild-develop/software/hwloc/2.12.1-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/libpciaccess/0.18.1-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/libxml2/2.14.3-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/XZ/5.8.1-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/numactl/2.0.19-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/zlib/1.3.1-GCCcore-14.3.0/lib' '-Wl,-rpath=/data/EasyBuild-develop/software/GCCcore/14.3.0/lib64' '-Wl,-rpath=/data/EasyBuild-develop/software/GCCcore/14.3.0/lib' '-DFOO="''"' 'test.cpp')
(2580495) [2026-05-11 16:02:43] running '/data/EasyBuild-develop/software/GCCcore/14.3.0/bin/g++ -Wl,-rpath=/data/EasyBuild-develop/software/buildenv/default-foss-2025b/lib -Wl,-rpath=/data/EasyBuild-develop/software/buildenv/default-foss-2025b/lib64 -Wl,-rpath=$ORIGIN -Wl,-rpath=$ORIGIN/../lib -Wl,-rpath=$ORIGIN/../lib64 -Wl,--disable-new-dtags -Wl,-rpath=/data/EasyBuild-develop/software/ScaLAPACK/2.2.2-gompi-2025b-fb/lib -Wl,-rpath=/data/EasyBuild-develop/software/FFTW.MPI/3.3.10-gompi-2025b/lib -Wl,-rpath=/data/EasyBuild-develop/software/FFTW/3.3.10-GCC-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/FlexiBLAS/3.4.5-GCC-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/OpenBLAS/0.3.30-GCC-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/OpenMPI/5.0.8-GCC-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/UCC/1.4.4-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/PRRTE/3.0.11-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/PMIx/5.0.8-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/libfabric/2.1.0-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/UCX/1.19.0-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/libevent/2.1.12-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/OpenSSL/3/lib64 -Wl,-rpath=/data/EasyBuild-develop/software/hwloc/2.12.1-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/libpciaccess/0.18.1-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/libxml2/2.14.3-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/XZ/5.8.1-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/numactl/2.0.19-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/zlib/1.3.1-GCCcore-14.3.0/lib -Wl,-rpath=/data/EasyBuild-develop/software/GCCcore/14.3.0/lib64 -Wl,-rpath=/data/EasyBuild-develop/software/GCCcore/14.3.0/lib -DFOO="" test.cpp'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions