Skip to content
Snippets Groups Projects

Fixed config.h pathing for all files so that out-of-source builds work

Closed Josh Borrow requested to merge fix_config_h_pathing into master

Fixes issue #549 (closed). Let's have Jenkins check this one...

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • mentioned in issue #549 (closed)

  • 161 file changes?

  • Author Developer

    Yes, to get this to work I needed to change the ../config.h in all files to config.h

  • Author Developer

    It's just:

    sed -i "s/\.\.\/config\.h/config\.h/g" ./*.{h,c}
    sed -i "s/\.\.\/config\.h/config\.h/g" ./*/*/*.{h,c}

    for these changes

  • 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 from srcdir. The default include path is:

    DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)

    srcdir is the top of the source tree and top_builddir your out of tree head. So yes use ../../config.h, or whatever moves from . to srcdir.

  • Author Developer

    I don't think I'm using any nonstandard includes... I think the problem is that examples/Cooling/CoolingRates/cooling_rates.c picks up the config.h header fine with #include "../../../config.h", but then it tries to include swift.h, and the pathing for that gets messed up and it cannot find ../config.h as it is looking one level above?

  • Author Developer

    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 have config.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 into swift.h.

  • Author Developer

    Okay, thanks Peter. I'll remove this and delete my branch.

  • closed

Please register or sign in to reply
Loading