paboyle / Grid

Data parallel C++ mathematical object library
GNU General Public License v2.0
154 stars 109 forks source link

make install doesn't install all headers due to duplicate Config.h and Version.h #420

Closed RJHudspith closed 1 year ago

RJHudspith commented 1 year ago

Hello,

I pulled the most-recent version of grid (https://github.com/paboyle/Grid/commit/4ca1bf7ccaaa471a51994564adb5e445bc62afd5) as I am developing a code that uses Grid as a library. Unfortunately under

make all install

When copying the header files at the install phase to the $prefix/include/Grid/ folder I get the following error message:

..... /usr/bin/install -c -m 644 ./GridCore.h ./Version.h ./Grid_Eigen_Tensor.h ./DisableWarnings.h ./Grid.h ./GridStd.h ./Namespace.h ./GridQCDcore.h ./Grid_Eigen_Dense.h ./Config.h Config.h Version.h '/home/jamie/PROG/LIBS/GRID_new/include/Grid/.' /usr/bin/install: will not overwrite just-created '/home/jamie/PROG/LIBS/GRID_new/include/Grid/./Config.h' with 'Config.h' /usr/bin/install: will not overwrite just-created '/home/jamie/PROG/LIBS/GRID_new/include/Grid/./Version.h' with 'Version.h' make[2]: *** [Makefile:3064: install-nobase_dist_pkgincludeHEADERS] Error 1

It is obvious that both ./Config.h and Config.h are being copied and this is what install complains about. Likewise with Version.h.

Now this is easily fixed by commenting out Config.h and Version.h on line 74 of Grid/Makefile.am e.g.

HFILES += $(extra_headers) #Config.h Version.h

But, these files were re-added to the Makefile in pull request (#396) as I had previously removed them in my earlier pull request (#377) because they are "... required to compile Hadrons ...". I don't want to provide another fix that breaks someone else's code but as it stands as far as I see it Grid cannot be used as a standalone library without this change.

My configure command was:

./configure CXX=mpic++ CXXFLAGS="-O3 -mavx -mfma -march=native -fopenmp" --prefix=/home/jamie/PROG/LIBS/GRID_new/ --enable-simd=AVX --enable-comms=mpi-auto

Cheers,

Jamie

paboyle commented 1 year ago

weird.. this is working for me and likely auto tools version dependent ? Will look into it.

RJHudspith commented 1 year ago

It might well be. I have version 2.71 of GNU autoreconf and 1.16.5 of GNU automake aclocal. Install is version 8.32 (GNU coreutils).

RJHudspith commented 1 year ago

Ok I think I know what has happened here. I think there was a stale Version.h and Config.h in the Grid directory when I ran bootstrap.sh (to include the right headers after a pull). This means that the find in scripts/filelist was including these in Make.inc and hence the duplicates that it rightly complained about.

To guard against me continually making this mistake I suggest adding the lines:

## guard against the situation when configure may have been called first to avoid double include of Config.h and possible Version.h
if test -a Version.h ; then
    rm -v Version.h
fi
if test -a Config.h ; then
    rm -v Config.h
fi

in scripts/filelist right after

# library Make.inc
cd $home/Grid