linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug report: in-place build exposes fixup headers, breaking static_assert
@ 2020-09-09  9:47 Bruce Merry
  2020-09-09 16:06 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce Merry @ 2020-09-09  9:47 UTC (permalink / raw)
  To: linux-rdma

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug report: in-place build exposes fixup headers, breaking static_assert
  2020-09-09  9:47 Bug report: in-place build exposes fixup headers, breaking static_assert Bruce Merry
@ 2020-09-09 16:06 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-09-09 16:06 UTC (permalink / raw)
  To: Bruce Merry; +Cc: linux-rdma

On Wed, Sep 09, 2020 at 11:47:24AM +0200, Bruce Merry wrote:
> 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.

Hm, yes that seems to be the case

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

I'm not sure the inplace mode is intended to be an exact replacement
for install - it works in lots of commonly useful cases. If you want
it to work in your case then use a newer version of devtoolset

devtoolset-9 has a new enough gcc to avoid this fixup

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-09 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09  9:47 Bug report: in-place build exposes fixup headers, breaking static_assert Bruce Merry
2020-09-09 16:06 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).