[mlpack-git] Fail to build newest mlpack on windows(success on version 1.0.12)

ngap wei Tham thamngapwei at gmail.com
Thu Sep 24 00:13:18 EDT 2015


Hi, I have some compile issues on current source codes, I want to list them
out and talk about my solution.I compile the codes by the method introduce
on  this post(work on 1.0.12)
<http://qtandopencv.blogspot.my/2015/09/deep-learning-04-compile-mlpack-1012-on.html>



All of the error messages could be found at here
<http://pastebin.com/J6wE3E6e>.

compiler : visual c++ 2015 64bits
OS : windows 8.1 64bits

1 : openMP optimization do not work on vc2015, you have to disable it
2 : following codes(hrectbound.hpp) do not work on vc2015

//! Utility struct where Value is true if and only if the argument is of
type

//! LMetric.

template<typename MetricType>

struct IsLMetric

{

  static const bool Value = false;

};


//! Specialization for IsLMetric when the argument is of type LMetric.

template<> //this line will cause compilation issue

template<int Power, bool TakeRoot>

struct IsLMetric<metric::LMetric<Power, TakeRoot>>

{

  static const bool Value = true;

};



The error message is
Severity    Code    Description    Project    File    Line
Error    C2910
'mlpack::bound::meta::IsLMetric<mlpack::metric::LMetric<Power,TakeRoot>>':
cannot be explicitly specialized    hmm_train
c:\users\yyyy\qt\3rdlibs\mlpack\mlpack\src\mlpack\core\tree\hrectbound.hpp
31

But it can work as expected if you remove the line "template<>"

example :

template<int A, bool B>

struct LMetric{};


template<typename MetricType>

struct IsLMetric

{

  static const bool Value = false;

};


//! Specialization for IsLMetric when the argument is of type LMetric.

//template<>

template<int Power, bool TakeRoot>

struct IsLMetric<LMetric<Power, TakeRoot>>

{

  static const bool Value = true;

};


int main()

{

    std::cout<<IsLMetric<int>::Value<<"\n"; //false

    std::cout<<IsLMetric<LMetric<3,false>>::Value<<"\n"; //true
}


3 : BOOST_PFTO of the file serialization_shim.hpp will cause compile issue


namespace boost {namespace serialization {
/** * Catch a call to serialize() with a PointerShim, and call the
Serialize() * function directly. */template<typename Archive, typename
T>inline void serialize(Archive& ar,
mlpack::data::PointerShim<T>& t,                      const BOOST_PFTO
unsigned int version){  T* tptr = reinterpret_cast<T*>(&t);
tptr->Serialize(ar, version);}
}}


if I remove BOOST_PFTO, the compile time issue of BOOST_PFTO
will be "removed", but I do not know this is safe or not

4 : vc2015 do not bite the "not" keyword

file : cnn.hpp


template<typename T, typename P, typename D>    typename
std::enable_if<        not HasGradientCheck<T, void(T::*)(const P&,
D&)>::value, void>::type    Update(T& /* unused */, P& /* unused */,
D& /* unused */)    {      /* Nothing to do here */    }

change not to ! can solve this problem



After the fixed(?), there are still 10 errors

The error messages can be found at here <http://pastebin.com/1XSGs1mQ>.

The first error is "C1001 An internal error has occured in the compiler",

I do not know how to fix this one yet

The error is point the line 75 of file ffn.hpp


The other errors are quite weird, the compiler complain same files are
being used so the custom build rule fail, do not know how to fix this yet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20150924/3de2b6e9/attachment-0001.html>


More information about the mlpack-git mailing list