C++ programs do not compile with libfabric 1.9.0
joerns opened this issue · 3 comments
joerns commented
Upgrading from libfabric 1.7 to 1.9 I notice that C++ programs including libfabric headers do not compile anymore. Consider this test program:
$ cat test.c
#include "rdma/fabric.h"
#include "rdma/fi_atomic.h"
#include "rdma/fi_cm.h"
#include "rdma/fi_collective.h"
#include "rdma/fi_domain.h"
#include "rdma/fi_endpoint.h"
#include "rdma/fi_eq.h"
#include "rdma/fi_errno.h"
#include "rdma/fi_rma.h"
#include "rdma/fi_tagged.h"
#include "rdma/fi_trigger.h"
int main()
{}
This will compile with gcc:
$ gcc test.c -o out-c -I /path/to/libfabric-1.9.0/include
$
But not with g++:
$ g++ test.c -o out-cpp -I /path/to/libfabric-1.9.0/include
In file included from /afs/cern.ch/work/j/joschuma/git/felix/external/libfabric/1.9.0/x86_64-centos7-gcc8-opt/include/rdma/fi_endpoint.h:37,
from /afs/cern.ch/work/j/joschuma/git/felix/external/libfabric/1.9.0/x86_64-centos7-gcc8-opt/include/rdma/fi_atomic.h:37,
from test.c:2:
/afs/cern.ch/work/j/joschuma/git/felix/external/libfabric/1.9.0/x86_64-centos7-gcc8-opt/include/rdma/fi_domain.h:206:8: error: use of enum ‘fi_collective_op’ without previous declaration
enum fi_collective_op;
^~~~~~~~~~~~~~~~
/afs/cern.ch/work/j/joschuma/git/felix/external/libfabric/1.9.0/x86_64-centos7-gcc8-opt/include/rdma/fi_domain.h:231:58: error: use of enum ‘fi_collective_op’ without previous declaration
int (*query_collective)(struct fid_domain *domain, enum fi_collective_op coll,
^~~~~~~~~~~~~~~~
I think you can't forward-declare an enum and need to put the full declaration there.
I am using gcc 8.3.
Thanks, Jörn
shefty commented
This should be fixed in the upstream master. I'll check that the fix was picked into the 1.9.x branch.
shefty commented
The fix was cherry-picked. It won't be available until we release 1.10 or 1.9.1, however.
joerns commented
Thanks Sean, I'll wait for the new release then 👍