Fixed config.h pathing for all files so that out-of-source builds work
Fixes issue #549 (closed). Let's have Jenkins check this one...
Merge request reports
Activity
mentioned in issue #549 (closed)
Hmm, what exactly are you using for CFLAGS etc. This is not necessary. The
../config.h
is really a good documenting statement of what we want, as there may be local "config.h" files and we definitely want the one fromsrcdir
. The default include path is:DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
srcdir
is the top of the source tree andtop_builddir
your out of tree head. So yes use../../config.h
, or whatever moves from.
tosrcdir
.I don't think I'm using any nonstandard includes... I think the problem is that
examples/Cooling/CoolingRates/cooling_rates.c
picks up theconfig.h
header fine with#include "../../../config.h"
, but then it tries to includeswift.h
, and the pathing for that gets messed up and it cannot find../config.h
as it is looking one level above?Here's my output:
make[2]: Entering directory `/cosma7/data/dp004/dc-borr1/eagle_12_tests/joshrun/swiftsim/build/eagle/examples/Cooling/CoolingRates' mpicc -DHAVE_CONFIG_H -I. -I../../../../../examples/Cooling/CoolingRates -I../../.. -I/cosma/local/Python/3.6.5/lib/python3.6/site-packages/numpy/core/include/ -I/cosma/local/Python/3.6.5/include/python3.6m/ -I/cosma/local/gsl/2.4/include -I/cosma/local/parallel-hdf5//intel_2019_intel_mpi_2019/1.10.3/include -I/cosma/local/fftw//intel_2019_intel_mpi_2019/3.3.7/include -I/cosma/local/intel/Parallel_Studio_XE_2019/impi/2019.1.144//intel64/include/ -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/daal/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/tbb/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/pstl/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/mkl/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/ipp/include -I/cosma/local/gcc/7.3.0/include -I../../../../../src -I/cosma/local/gcc/7.3.0/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/ipp/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/mkl/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/pstl/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/tbb/include -I/cosma/local/intel/Parallel_Studio_XE_2019/compilers_and_libraries_2019.1.144/linux/daal/include -I/cosma/local/intel/Parallel_Studio_XE_2019/impi/2019.1.144//intel64/include/ -I/cosma/local/parallel-hdf5/intel_2019_intel_mpi_2019/1.10.3/include -qopt-zmm-usage=high -ip -ipo -O3 -ansi-alias -xCORE-AVX512 -pthread -w2 -Wunused-variable -Wshadow -Werror -Wstrict-prototypes -MT cooling_rates-cooling_rates.o -MD -MP -MF .deps/cooling_rates-cooling_rates.Tpo -c -o cooling_rates-cooling_rates.o `test -f 'cooling_rates.c' || echo '../../../../../examples/Cooling/CoolingRates/'`cooling_rates.c In file included from ../../../../../examples/Cooling/CoolingRates/cooling_rates.c(26): ../../../../../src/swift.h(23): catastrophic error: cannot open source file "../config.h" #include "../config.h" ^ compilation aborted for ../../../../../examples/Cooling/CoolingRates/cooling_rates.c (code 4) make[2]: *** [cooling_rates-cooling_rates.o] Error 4 make[2]: Leaving directory `/cosma7/data/dp004/dc-borr1/eagle_12_tests/joshrun/swiftsim/build/eagle/examples/Cooling/CoolingRates' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/cosma7/data/dp004/dc-borr1/eagle_12_tests/joshrun/swiftsim/build/eagle'```
Yes, that is a mess. I've pushed a simple fix to work-around it. We have a big issue (which I'd thought about before, but left for a rainy day) in that if we ever wanted to use SWIFT as an
installed
library (i.e.make install
into a--prefix
) then we cannot haveconfig.h
included in the install. All the consequences of that include file should be part of the compiled state and not have anything further to do. It could be as simple as not including this in all the header files (which are installed), but we need to work through that. If anything in the include file is necessary for other codes to link against us, then those defines would need to be extracted directly intoswift.h
.