Porting sci20 to unix
Some problems found while porting sci20 to unix for the first time.
cog
The first problem arise while trying to run install.py script. The cog tool could not generate the files. Later we've find out that the problem was the dos end-of-line character.
We did a fix in the cog itself but all checksums must be removed and regenerated:
- Update cog
- Remove all checksums from source files
- Run the new cog
We also had to reorganize the cog binaries layout so that there is only one directory for python-2.4 or python-2.5.
__int64
The basic (integer) types are always a problem while porting to win32/unix. We decided to use boost/cstdint.h header that solves these problem gracefully.
Reference: boost/cstdint.hpp
__FUNCSIG__
This macro is only defined by MSVC.
Using __PRETTY_FUNCTION__ on X11
Creating a header for platform specific stuff: sci20/core/Platform.hpp
warning: "_POSIX_C_SOURCE" redefined
As described in boost documentation, we must include boost-python headers before any other system headers. This warning is explicitly complaining about that.
error: parse error in template argument list
template <class HandleType_> struct accepts
: public boost::mpl::bool_
<
Base_::accepts<HandleType_>::value
|| (boost::is_convertible<HandleType_, H1_>::value)
|| (boost::is_convertible<HandleType_, H2_>::value)
|| (boost::is_convertible<HandleType_, H3_>::value)
|| (boost::is_convertible<HandleType_, H4_>::value)
>
The problem occurs on the third line, where we try to call the Base_ accepts value. GCC gives a parse error.
The first try was to put the first line inside parameters, but then another error occurs:
error: ::value has not been declared
Solution?
error: non-template "to" used as template
01 using typename AcceptableHandleMappingsTrait_::to; //trait
02
03 typedef HandleMapperImpl_ implementation_super;
04 using implementation_super::map_handle; // function
05 // Helper
06 template <class H1_, class H2_, class Acc_ = AcceptableHandleMappingsTrait_>
07 struct accepts_ {
08 typedef typename Acc_::template to<H2_> To;
09 typedef typename To::template accepts<H1_> Accepts;
10 enum {value = Accepts::value};
11 };
The problem was the missing "typename" in line 01 and missing "template" in lines 08 and 09. GCC is very demanding in typenames and templates.
error: specialization of TEMPLATE X in different namespace from definition of TEMPLATE Y
Some template specialization where in a different namespace of the base template struct.
The solution is to declare the specialization in the same namespace of the base template.
error: explicit specialization in non-namespace scope XXX
This error is similar to the above: The template specialization must be in the same namespace as the base template. In this case, we are specializing a "member template", but the rule still apply.
The solution, as described very clearly in this post, is to move the specialization to outside the class.




Leave a comment