Feature #1484

Support out-of-source builds

Added by Deil Christoph over 8 years ago. Updated over 7 years ago.

Status:ClosedStart date:06/28/2015
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.1.0
Duration:

Description

Looks like Gammalib doesn’t support out-of-source builds ... it falls over with the Python extensions:
https://gist.github.com/cdeil/804e727d7b5bd038f8ea

Out-of-source builds are important for developers that want to test multiple compilers / options, or have debug / production builds, switch between branches ... basically everyone that wants to have more than one build.

Possible?


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen over 8 years ago

What are out of source builds?

#2 Updated by Deil Christoph over 8 years ago

An in-source build is if the generated files (object files, library files ... any generated files) are mixed with the source files.

An out-of source build is if the generated files go to a separate folder, leaving the source folder clean.

http://stackoverflow.com/a/1311299/498873
http://www.gnu.org/software/automake/manual/html_node/VPATH-Builds.html
http://voices.canonical.com/jussi.pakkanen/2013/04/16/why-you-should-consider-using-separate-build-directories/

#3 Updated by Knödlseder Jürgen over 7 years ago

  • Status changed from New to In Progress
  • Assigned To set to Knödlseder Jürgen
  • Target version set to 1.1.0

The following should work:

make distclean
mkdir build
cd build
../configure --srcdir=..
make

For the moment it crashes with:
../../pyext/gammalib/app.i:43: Error: Unable to find 'typemap_GFilename.i'
../../pyext/gammalib/model.i:43: Error: Unable to find 'typemap_GFilename.i'
../../pyext/gammalib/model.i:46: Error: Unable to find 'GBase.i'
../../pyext/gammalib/model.i:47: Error: Unable to find 'GContainer.i'
../../pyext/gammalib/model.i:48: Error: Unable to find 'GRegistry.i'
../../pyext/gammalib/model.i:51: Error: Unable to find 'GException.i'
...

#4 Updated by Knödlseder Jürgen over 7 years ago

  • % Done changed from 0 to 50

The following works now:

make distclean
mkdir build
cd build
../configure --srcdir=..
make -j8
make check

however the following still fails:
./configure
make dist
make distcheck
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../../include -I../../../inst/mwl/include -I../../../inst/cta/include -I../../../inst/lat/include -I../../../inst/com/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gammalib/app_wrap.cpp -o build/temp.macosx-10.11-x86_64-2.7/gammalib/app_wrap.o
clang: error: no such file or directory: 'gammalib/app_wrap.cpp'
clang: error: no input files
error: command 'clang' failed with exit status 1

and also the following
../configure
make dist
make distcheck
Making all in pyext
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
make[4]: *** No rule to make target `../test/test_python.py', needed by `all-am'.  Stop.

#5 Updated by Knödlseder Jürgen over 7 years ago

The second problem was solved by adding the .py files to EXTRA_DIST in the test Makefile.am, now we have

../configure
make dist
make distcheck
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../../include -I../../../inst/mwl/include -I../../../inst/cta/include -I../../../inst/lat/include -I../../../inst/com/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gammalib/app_wrap.cpp -o build/temp.macosx-10.11-x86_64-2.7/gammalib/app_wrap.o
clang: error: no such file or directory: 'gammalib/app_wrap.cpp'
clang: error: no input files
error: command 'clang' failed with exit status 1
so the same error is for the build in the source directory.

#6 Updated by Knödlseder Jürgen over 7 years ago

  • % Done changed from 50 to 80

This now works for Gammalib. Merged into devel. Still need to make sure that ctools also supports out of source builds.

#7 Updated by Knödlseder Jürgen over 7 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100

This now also works for ctools.

Also available in: Atom PDF