Nek5000 / gslib

sparse communication library
Other
26 stars 26 forks source link

Fix expected identifier bug on clang builds #46

Open chapman39 opened 7 months ago

chapman39 commented 7 months ago

Hi,

I am trying to build gslib using mvapich2 installed with clang and I get the following error:

 /opt/local/include/mpich-mp/mpi.h:116:56: error: expected identifier

 static const MPI_Datatype mpich_mpi_char
 MPICH_ATTR_TYPE_TAG(char)

                = MPI_CHAR;

                                                        ^

 /opt/local/include/mpich-mp/mpi.h:24:106: note: expanded from macro
 'MPICH_ATTR_TYPE_TAG'

 #    define MPICH_ATTR_TYPE_TAG(type)
 __attribute__((type_tag_for_datatype(MPI,type)))

Turns out this error has affected others before trying to build on apple machines - all the way back in 2015: https://lists.mcs.anl.gov/pipermail/nek5000-users/2015-May/003325.html

The problem is nek5000 has #defined MPI to be 1, but the mpich header file 'mpi.h' uses the symbol 'MPI' (for a completely different reason).

I have a branch locally that resolves this problem. All that needs to be done is change the macro name MPI to something more specific, such as GSLIB_USE_MPI.

chapman39 commented 7 months ago

If I'm allowed to create a pull request I'd be happy to upload the fix.

stgeke commented 7 months ago

Sure, please go ahead.

chapman39 commented 6 months ago

I'll need permission first

$git push --set-upstream origin bugfix/chapman39/mvapich2-clang-expected-identifier

ERROR: Permission to Nek5000/gslib.git denied to chapman39.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
stgeke commented 6 months ago

You cannot directly push to the repo. Instead please create a PR.

chapman39 commented 6 months ago

I'm not able to create a PR

stgeke commented 6 months ago

I don't see why the following will not work: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/committing-changes-to-a-pull-request-branch-created-from-a-fork