compilation problem on a Mac OSX 10.8.5

79 views
Skip to first unread message

Bastien Boussau

unread,
Sep 26, 2013, 8:20:32 AM9/26/13
to biopp-de...@googlegroups.com
Hi, 

I downloaded the libraries from the git yesterday, and tried to compile them. Bpp-core and bpp-seq went fine, but bpp-phyl did not compile:

In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp:40:
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/AbstractSubstitutionModel.h:43:
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/SubstitutionModel.h:51:
In file included from /usr/local/include/Bpp/Numeric/VectorTools.h:44:
/usr/local/include/Bpp/Numeric/NumTools.h:116:50: error: call to function 'operator*' that is neither visible in the template definition nor found by argument-dependent lookup
  template<class T> static T sqr(T a) { return a * a; }
                                                 ^
/Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp:281:45: note: in instantiation of function template specialization
      'bpp::NumTools::sqr<std::vector<double, std::allocator<double> > >' requested here
      MatrixTools::mult(rightEigenVectors_, NumTools::sqr(rate_ * eigenValues_) * VectorTools::exp(eigenValues_ * (rate_ * t)), leftEigenVectors_, d2pijt_);
                                            ^
/usr/local/include/Bpp/Numeric/VectorTools.h:128:16: note: 'operator*' should be declared prior to the call site
std::vector<T> operator*(const std::vector<T>& v1, const std::vector<T>& v2) throw (DimensionException)
               ^
2 warnings and 1 error generated.
make[2]: *** [src/CMakeFiles/bppphyl-shared.dir/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/bppphyl-shared.dir/all] Error 2
make: *** [all] Error 2
 
I suspect the latest version of mac OS X is picky about the order of declarations, or just includes files in a different order compared to other systems. Do you know how I could solve that?
Thanks!
Bastien.

Bastien Boussau

unread,
Sep 26, 2013, 9:23:04 AM9/26/13
to biopp-de...@googlegroups.com
An update: the same problem occurs if I use the stable versions: 
[ 21%] Building CXX object src/CMakeFiles/bppphyl-shared.dir/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp.o
/Users/boussau/Programs/Biopp/Stable/bpp-phyl-2.1.0/src/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp:393:11: warning: implicit conversion changes signedness: 'int' to 'size_type'
      (aka 'unsigned long') [-Wsign-conversion]
    freq_[i] = freqs[i];
    ~~~~~ ^
In file included from /Users/boussau/Programs/Biopp/Stable/bpp-phyl-2.1.0/src/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp:40:
In file included from /Users/boussau/Programs/Biopp/Stable/bpp-phyl-2.1.0/src/Bpp/Phyl/Model/AbstractSubstitutionModel.h:43:
In file included from /Users/boussau/Programs/Biopp/Stable/bpp-phyl-2.1.0/src/Bpp/Phyl/Model/SubstitutionModel.h:51:
In file included from /usr/local/include/Bpp/Numeric/VectorTools.h:44:
/usr/local/include/Bpp/Numeric/NumTools.h:116:50: error: call to function 'operator*' that is neither visible in the template definition nor found by argument-dependent lookup
  template<class T> static T sqr(T a) { return a * a; }
                                                 ^
/Users/boussau/Programs/Biopp/Stable/bpp-phyl-2.1.0/src/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp:281:45: note: in instantiation of function template specialization
      'bpp::NumTools::sqr<std::vector<double, std::allocator<double> > >' requested here
      MatrixTools::mult(rightEigenVectors_, NumTools::sqr(rate_ * eigenValues_) * VectorTools::exp(eigenValues_ * (rate_ * t)), leftEigenVectors_, d2pijt_);
                                            ^
/usr/local/include/Bpp/Numeric/VectorTools.h:128:16: note: 'operator*' should be declared prior to the call site
std::vector<T> operator*(const std::vector<T>& v1, const std::vector<T>& v2) throw (DimensionException)
               ^
1 warning and 1 error generated.
make[2]: *** [src/CMakeFiles/bppphyl-shared.dir/Bpp/Phyl/Model/AbstractSubstitutionModel.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/bppphyl-shared.dir/all] Error 2
make: *** [all] Error 2


Julien Yann Dutheil

unread,
Sep 26, 2013, 11:05:17 AM9/26/13
to biopp-de...@googlegroups.com
Hi Bastien,

I have to admit that your compiler is definitely in its own rights: as eigenValues_ is a vector, it should nit be NumTools::sqr but VectorTools::sqr which should have been used here. Just amazed this error did not pop up earlier! I have fixed it on the master branch on git. Also fixed the warning. Tell me if that solves the issue...

Cheers,

J.



--
You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biopp-devel-fo...@googlegroups.com.
To post to this group, send email to biopp-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/biopp-devel-forum/05ef8c4f-3030-4677-83d9-52f78566ac1f%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Julien Y. Dutheil, Ph-D
0 (+49) 6421 178 986

§ Max Planck Institute for Terrestrial Microbiology
Department of Organismic Interactions
Marburg -- GERMANY

§ Intitute of Evolutionary Sciences - Montpellier
University of Montpellier 2 -- FRANCE

Bastien Boussau

unread,
Sep 27, 2013, 8:06:22 AM9/27/13
to biopp-de...@googlegroups.com
Hi Julien, 

There was a similar problem in MarkovModulatedSubstitutionModel.cpp: 
[ 22%] Building CXX object src/CMakeFiles/bppphyl-shared.dir/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.cpp.o
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.cpp:40:
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.h:43:
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/SubstitutionModel.h:57:
/Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/FrequenciesSet/FrequenciesSet.h:164:7: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
      x+=freq_[i];
      ^
/Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/FrequenciesSet/FrequenciesSet.h:162:13: note: initialize the variable 'x' to silence this warning
    double x;
            ^
             = 0.0
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.cpp:40:
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.h:43:
In file included from /Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/SubstitutionModel.h:51:
In file included from /usr/local/include/Bpp/Numeric/VectorTools.h:44:
/usr/local/include/Bpp/Numeric/NumTools.h:116:50: error: call to function 'operator*' that is neither visible in the template definition nor found by argument-dependent lookup
  template<class T> static T sqr(T a) { return a * a; }
                                                 ^
/Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.cpp:198:41: note: in instantiation of function template specialization
      'bpp::NumTools::sqr<std::vector<double, std::allocator<double> > >' requested here
  MatrixTools::mult(rightEigenVectors_, NumTools::sqr(eigenValues_) * VectorTools::exp(eigenValues_ * t), leftEigenVectors_, d2pijt_);
                                        ^
/usr/local/include/Bpp/Numeric/VectorTools.h:128:16: note: 'operator*' should be declared prior to the call site
std::vector<T> operator*(const std::vector<T>& v1, const std::vector<T>& v2) throw (DimensionException)
               ^
1 warning and 1 error generated.
make[2]: *** [src/CMakeFiles/bppphyl-shared.dir/Bpp/Phyl/Model/MarkovModulatedSubstitutionModel.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/bppphyl-shared.dir/all] Error 2
make: *** [all] Error 2

I changed the NumTools::sqr into VectorTools::sqr, and it compiled this file.

I'm about to commit that change.

However, there is another problem later:
/Users/boussau/Programs/Biopp/bpp-phyl/src/Bpp/Phyl/Model/FrequenciesSet/WordFrequenciesSet.cpp:161:19: error: variable length array of non-POD element type 'vector<double>'
  vector<double> f[l];
 Not sure what that is...

Bastien.

Julien Yann Dutheil

unread,
Sep 30, 2013, 2:32:39 PM9/30/13
to biopp-de...@googlegroups.com
Hi Bastien,

Thanks a lot for the commit ! As for the other error, this is amazing that linux compilers have never complained about that! VLA are not standard C++, so I replaced it with a VVdouble. This should solve the issue!

Cheers,

J.



For more options, visit https://groups.google.com/groups/opt_out.

Bastien Boussau

unread,
Oct 10, 2013, 4:58:42 AM10/10/13
to biopp-de...@googlegroups.com
It worked, thanks!
Bastien.
Reply all
Reply to author
Forward
0 new messages