Opened 6 months ago

Last modified 6 months ago

#70073 new defect

libminc uses wrong mpich includes and needs a fix to compiler choice

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: Cc:
Port: libminc

Description

  1. Old compilers fails:
    /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/testdir/minc2-large-attribute.c: In function ‘test_3D_image’:
    /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/testdir/minc2-large-attribute.c:144: error: ‘for’ loop initial declaration used outside C99 mode
    make[2]: *** [testdir/CMakeFiles/minc2-large-attribute.dir/minc2-large-attribute.c.o] Error 1
    . . .
    In file included from /opt/local/include/hdf5.h:21,
                     from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/libsrc/minc.h:170,
                     from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/ezminc/minc_1_rw.h:28[ 82%] Built target minc2-create-test-images
    ,
                     from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/ezminc/minc_1_simple.h:18,
                     from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/ezminc/minc_1_simple_rw.h:18,
                     from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/libminc-2.4.06/ezminc/minc_1_simple_rw.cpp:18:
    /opt/local/include/H5public.h:39:21: error: cinttypes: No such file or directory
    make[2]: *** [ezminc/CMakeFiles/minc_io.dir/minc_1_simple_rw.cpp.o] Error 1
    make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_libminc/libminc/work/build'
    make[1]: *** [ezminc/CMakeFiles/minc_io.dir/all] Error 2
    

Then, portfile hardcodes mpich includes, which in reality may be different.

pre-configure {
    # Figure out HDF5's mpi include directory
    set mpl_include_dir ""
    if {![catch {set result [active_variants hdf5 openmpi]}]} {
        if {$result} {
            set mpl_include_dir "-I${prefix}/include/openmpi-mp"
        }
    }
    if {![catch {set result [active_variants hdf5 mpich]}]} {
        if {$result} {
            set mpl_include_dir "-I${prefix}/include/mpich-mp"
        }
    }
    if {$mpl_include_dir ne ""} {
        configure.cflags-append ${mpl_include_dir}
    }
}

However, this gonna work only for mpich-default subport.

Change History (2)

comment:1 in reply to:  description Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to barracuda156:

  1. Old compilers fails:

Which old compilers? gcc-4.2?

error: ‘for’ loop initial declaration used outside C99 mode

This suggests your compiler defaults to C89 mode, like gcc-4.2.

/opt/local/include/H5public.h:39:21: error: cinttypes: No such file or directory

H5public.h contains:

#ifdef __cplusplus
#include <cinttypes>
#else
#include <inttypes.h>
#endif

So it requires <cinttypes> (from C++11) when in C++ mode and <inttypes.h> (from C99) when in C mode; any port including this file should use configure.cxx_standard 2011 or configure.c_standard 1999 as appropriate, and if it doesn't already add its own -std flags, add configure.cxxflags-append -std=c++11 or configure.cflags-append -std=gnu99 as appropriate.

comment:2 Changed 6 months ago by barracuda156

Yes, gcc-4.2 (and yet older will also fail, obviously).

Note: See TracTickets for help on using tickets.