Bug report: in-place build exposes fixup headers, breaking static_assert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When building with the recommended build.sh script, it seems that some
header files that override system headers get installed into the
build/include directory. I'm guessing these are intended to be used
while building rdma-core itself, but have the effect of interfering
with other software that is specifying this include directory to build
against rdma-core libraries.

The case I ran into is that an assert.h file is added that #defines
static_assert to an empty macro. Apart from silently disabling the
static assertions in users' code, this breaks compilation of C++11
code, because the arguments to static_assert may contain a comma (such
as in a list of template arguments), leading to errors because the
preprocessor splits on the comma and sees more than two arguments to
the macro.

To reproduce, try building this Dockerfile:

FROM quay.io/pypa/manylinux2010_x86_64

RUN yum install -y \
        wget cmake3 ninja-build libnl3-devel

RUN wget https://github.com/linux-rdma/rdma-core/releases/download/v31.0/rdma-core-31.0.tar.gz
-O /tmp/rdma-core-31.0.tar.gz
RUN tar -C /tmp -zxf /tmp/rdma-core-31.0.tar.gz
RUN cd /tmp/rdma-core-31.0 && ./build.sh

RUN echo -e "#include <cassert>\n#include <vector>" > simple.cpp
RUN g++ -std=c++11 -c simple.cpp -I /tmp/rdma-core-31.0/build/include


The compiler output starts with:

In file included from
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_iterator.h:66,
                 from
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_algobase.h:67,
                 from /opt/rh/devtoolset-8/root/usr/include/c++/8/vector:60,
                 from simple.cpp:2:
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/ptr_traits.h:115:71:
error: macro "static_assert" passed 3 arguments, but takes just 2
    "pointer type defines element_type or is like SomePointer<T, Args>");

When I changed my build process to do an out-of-place install the
problem went away.

Regards
Bruce
-- 
Bruce Merry
Senior Science Processing Developer
SARAO



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux