Skip to content

error when compiling oshmem_info/param.c #8221

@paklui

Description

@paklui

Thank you for taking the time to read this issue!

Background information

What version of Open MPI are you using? (e.g., v3.0.5, v4.0.2, git branch name and hash, etc.)

tried v4.0.x branch and v4.1.x branch

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

git clone https://github.com/open-mpi/ompi.git -b v4.0.x
git clone https://github.com/open-mpi/ompi.git -b v4.1.x

If you are building/installing from a git clone, please copy-n-paste the output from git submodule status.

no output from 'git submodule status'

Please describe the system on which you are running

  • Operating system/version: Red Hat Enterprise Linux release 8.2
  • Computer hardware: AMD EPYC 7601 32-Core Processor
  • Network type: doesn't matter

Details of the problem

Please describe, in detail, the problem that you are having, including the behavior you expect to see, the actual behavior that you are seeing, steps to reproduce the problem, etc. It is most helpful if you can attach a small program that a developer can use to reproduce your problem.

Note: If you include verbatim output (or a code block), please use a GitHub Markdown code block like below:

When using the recent Cray CCE C compiler, it has some issue with the variable name that is named 'fortran':

[user@host oshmem_info]$ make V=1
depbase=`echo param.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
cc -DHAVE_CONFIG_H -I. -I../../../../oshmem/tools/oshmem_info -I../../../opal/include -I../../../ompi/include -I../../../oshmem/include -I../../../opal/mca/hwloc/hwloc201/hwloc/include/private/autogen -I../../../opal/mca/hwloc/hwloc201/hwloc/include/hwloc/autogen -I../../../ompi/mpiext/cuda/c  -DOPAL_CONFIGURE_USER="\"coe0278\"" -DOPAL_CONFIGURE_HOST="\"tulip\"" -DOPAL_CONFIGURE_DATE="\"Tue Nov 17 00:01:18 UTC 2020\"" -DOMPI_BUILD_USER="\"$USER\"" -DOMPI_BUILD_HOST="\"${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" -DOMPI_BUILD_DATE="\"`../../../../config/getdate.sh`\"" -DOMPI_BUILD_CFLAGS="\"-O3 -DNDEBUG -finline-functions -fno-strict-aliasing \"" -DOMPI_BUILD_CPPFLAGS="\"-I../../../.. -I../../.. -I../../../../opal/include -I../../../../orte/include -I../../../orte/include -I../../../../ompi/include -I../../../../oshmem/include -I/home/users/coe0278/mpi/ompi/build/opal/mca/hwloc/hwloc201/hwloc/include -I/home/users/coe0278/mpi/ompi/opal/mca/hwloc/hwloc201/hwloc/include   \"" -DOMPI_BUILD_CXXFLAGS="\"-O3 -DNDEBUG -finline-functions \"" -DOMPI_BUILD_CXXCPPFLAGS="\"-I../../../.. -I../../.. -I../../../../opal/include -I../../../../orte/include -I../../../../ompi/include  \"" -DOMPI_BUILD_FFLAGS="\"\"" -DOMPI_BUILD_FCFLAGS="\"\"" -DOMPI_BUILD_LDFLAGS="\"  \"" -DOMPI_BUILD_LIBS="\"-lrt -lutil  -lz  -levent_core -levent_pthreads\"" -DOPAL_CC_ABSOLUTE="\"/opt/cray/pe/craype/2.7.4.2/bin/cc\"" -DOMPI_CXX_ABSOLUTE="\"/opt/cray/pe/craype/2.7.4.2/bin/CC\"" -DOSHMEM_PROFILING=1   -DOSHMEM_BUILD_FORTRAN_BINDINGS=0 -I../../../.. -I../../.. -I../../../../opal/include -I../../../../orte/include -I../../../orte/include -I../../../../ompi/include -I../../../../oshmem/include -I/home/users/coe0278/mpi/ompi/build/opal/mca/hwloc/hwloc201/hwloc/include -I/home/users/coe0278/mpi/ompi/opal/mca/hwloc/hwloc201/hwloc/include     -O3 -DNDEBUG -finline-functions -fno-strict-aliasing  -MT param.o -MD -MP -MF $depbase.Tpo -c -o param.o ../../../../oshmem/tools/oshmem_info/param.c &&\
mv -f $depbase.Tpo $depbase.Po
../../../../oshmem/tools/oshmem_info/param.c:66:11: error: expected identifier or '('
    char *fortran;
          ^
../../../../oshmem/tools/oshmem_info/param.c:132:25: error: expected expression
        (void)asprintf(&fortran, "yes (%s)",
                        ^
../../../../oshmem/tools/oshmem_info/param.c:138:17: error: expected identifier or '('
        fortran = strdup("no");
                ^
../../../../oshmem/tools/oshmem_info/param.c:166:56: error: expected expression
    opal_info_out("Fort shmem.fh", "bindings:fortran", fortran);
                                                       ^
../../../../oshmem/tools/oshmem_info/param.c:167:10: error: expected expression
    free(fortran);
         ^
5 errors generated.
make: *** [Makefile:1887: param.o] Error 1

A workaround is to rename the "fortran" variable to something else. I renamed it to fortran_binding instead.

[user@host ompi]$ git diff
diff --git a/oshmem/tools/oshmem_info/param.c b/oshmem/tools/oshmem_info/param.c
index 502c4f52ed..748008f7f2 100644
--- a/oshmem/tools/oshmem_info/param.c
+++ b/oshmem/tools/oshmem_info/param.c
@@ -63,7 +63,7 @@ const char *opal_info_deprecated_value = "deprecated-ompi-info-value";
  */
 void oshmem_info_do_config(bool want_all)
 {
-    char *fortran;
+    char *fortran_binding;
     char *heterogeneous;
     char *memprofile;
     char *memdebug;
@@ -129,13 +129,13 @@ void oshmem_info_do_config(bool want_all)

     /* setup strings that require allocation */
     if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) {
-        (void)asprintf(&fortran, "yes (%s)",
+        (void)asprintf(&fortran_binding, "yes (%s)",
                        (OPAL_HAVE_WEAK_SYMBOLS ? "all" :
                         (OMPI_FORTRAN_CAPS ? "caps" :
                          (OMPI_FORTRAN_PLAIN ? "lower case" :
                           (OMPI_FORTRAN_SINGLE_UNDERSCORE ? "single underscore" : "double underscore")))));
     } else {
-        fortran = strdup("no");
+        fortran_binding = strdup("no");
     }

 #if OMPI_RTE_ORTE
@@ -163,8 +163,8 @@ void oshmem_info_do_config(bool want_all)
     opal_info_out("Built host", "build:host", OMPI_BUILD_HOST);

     opal_info_out("C bindings", "bindings:c", "yes");
-    opal_info_out("Fort shmem.fh", "bindings:fortran", fortran);
-    free(fortran);
+    opal_info_out("Fort shmem.fh", "bindings:fortran", fortran_binding);
+    free(fortran_binding);

     opal_info_out("Wrapper compiler rpath", "compiler:all:rpath",
                   WRAPPER_RPATH_SUPPORT);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions