## Bug #1988

### MAUS build error

100%

**Description**

Trying to build latest MAUS version to analysis new MC production for LiH scattering paper.

Get the following build error.

GSL has built correctly and the individual line runs in terminal. However the scons build fails.

**Files**

#### Updated by Rogers, Chris almost 5 years ago

If I do

source env.sh grep gsl_eigen_nonsymm_workspace ${MAUS_THIRD_PARTY}/third_party/install/include/gsl/gsl_eigen.h

I get

} gsl_eigen_nonsymm_workspace; gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n); void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w); gsl_eigen_nonsymm_workspace *w); gsl_eigen_nonsymm_workspace * w); gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w); gsl_eigen_nonsymm_workspace *nonsymm_workspace_p;

Is this the same for you?

#### Updated by Nugent, John almost 5 years ago

} gsl_eigen_nonsymm_workspace; gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n); void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w); gsl_eigen_nonsymm_workspace *w); gsl_eigen_nonsymm_workspace * w); gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w); gsl_eigen_nonsymm_workspace *nonsymm_workspace_p;

Looks the same to me. All of the headers appear to be there and the build works when I use the last line of the error log. However when running in scons in the build script it fails. Not sure what to make of it.

#### Updated by Nugent, John almost 5 years ago

Rogers, Chris wrote:

Weird. Try running with single cpu only (i.e. j=1)?

No joy, same issue I'm afraid.

#### Updated by Rogers, Chris almost 5 years ago

When scons runs it could be using a different include path compared to your command line run? So scons includes a system version of GSL rather than the MAUS local version?

Try hard coding the include path into Matrix.h (tho might hit a linker error later on if it links to the wrong gsl library). i.e. instead of

#include <gsl/gsl_eigen.h>

do

#include </path/to/maus/third_party/install/include/gsl/gsl_eigen.h>

#### Updated by Nugent, John almost 5 years ago

`src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator+=(const MAUS::VectorBase<StdType, GslType>&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':`

src/common_cpp/Maths/Vector.cc:343:48: error: 'gsl_vector_complex_add' was not declared in this scope

gsl_vector_complex_add(vector_, rhs.vector_);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator-=(const MAUS::VectorBase<StdType, GslType>&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:361:48: error: 'gsl_vector_complex_sub' was not declared in this scope

gsl_vector_complex_sub(vector_, rhs.vector_);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator*=(const MAUS::VectorBase<StdType, GslType>&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:401:48: error: 'gsl_vector_complex_mul' was not declared in this scope

gsl_vector_complex_mul(vector_, rhs.vector_);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator/=(const MAUS::VectorBase<StdType, GslType>&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:446:48: error: 'gsl_vector_complex_div' was not declared in this scope

gsl_vector_complex_div(vector_, rhs.vector_);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator+=(const StdType&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:470:49: error: 'gsl_vector_complex_add_constant' was not declared in this scope

gsl_vector_complex_add_constant(vector_, rhs);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator-=(const StdType&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:489:50: error: 'gsl_vector_complex_add_constant' was not declared in this scope

gsl_vector_complex_add_constant(vector_, -rhs);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator*=(const StdType&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:508:42: error: 'gsl_vector_complex_scale' was not declared in this scope

gsl_vector_complex_scale(vector_, rhs);

^

src/common_cpp/Maths/Vector.cc: In member function 'MAUS::VectorBase<StdType, GslType>& MAUS::VectorBase<StdType, GslType>::operator/=(const StdType&) [with StdType = gsl_complex; GslType = gsl_vector_complex]':

src/common_cpp/Maths/Vector.cc:524:45: error: 'gsl_vector_complex_scale' was not declared in this scope

gsl_vector_complex_scale(vector_, 1./rhs);

^

scons: *** [src/common_cpp/Maths/Vector.o] Error 1

scons: building terminated because of errors.

FAIL! See logs.x

FAIL Failed to make MAUS using scons. Fatal error - aborting

Now it gets past the first error but encounters a new one. I have hardcoded all references to gsl including for the file giving the error above. Afraid I don't know enough about scons to modify the build script directly.

#### Updated by Rogers, Chris almost 5 years ago

We fixed it, but using a bit of a hack. So the issue was:

${MAUS_THIRD_PARTY}/third_party/install/include /usr/local/include

are both "system includes" according to the MAUS build system. This means they are included by default by gcc. `/usr/local/include`

was included first; so the system version of GSL, which was an incorrect wrong version, was seen by gcc.

We added `-v`

tag to `src/common_py/maus_build_tools/core_builder.py::build_lib_maus_cpp`

using `common_obj_env.Append(CCFLAGS=["-v"])`

so that we could see the gcc include paths. We modified the search path by adding `-I`

tags in the same way.

We first tried to use `-I${MAUS_THIRD_PARTY}/third_party/install/include`

but gcc refused to update the paths that it searches for includes because this was already a system path. We tried adding a soft link from `${MAUS_THIRD_PARTY}/third_party/install/include`

and adding the linked path to the includes but gcc detected the soft link and refused to add it because this was already a system path. So instead we did a hard copy `cp -r ${MAUS_THIRD_PARTY}/third_party/install/include ${MAUS_THIRD_PARTY}/third_party/install/include2`

and added `-I${MAUS_THIRD_PARTY}/third_party/install/include2`

. This worked and we were able to correctly include the MAUS version of GSL.

Victory!

#### Updated by Rogers, Chris almost 5 years ago

**Status**changed from*Open*to*Closed***% Done**changed from*0*to*100*