aldebaran/libqi

Boost static assert to c++11 static assert

Closed this issue · 7 comments

Hi

I want to compile libqi but i get errors with the last version.

[ 1%] Building CXX object CMakeFiles/qi.dir/src/future.cpp.o
In file included from /home/arne/Documents/Dev/arne/libqi-master/qi/type/typeinterface.hpp:381:0,
from /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/anyreference.hpp:376,
from /home/arne/Documents/Dev/arne/libqi-master/qi/anyvalue.hpp:10,
from /home/arne/Documents/Dev/arne/libqi-master/qi/detail/future_fwd.hpp:17,
from /home/arne/Documents/Dev/arne/libqi-master/qi/future.hpp:7,
from /home/arne/Documents/Dev/arne/libqi-master/src/future.cpp:5:
/home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:3: warning: identifier ‘static_assert’ is a keyword in C++11 [-Wc++0x-compat]
static_assert(!boost::is_same<T,bool>::value, "std::vector is not supported by AnyValue.");
^
In file included from /home/arne/Documents/Dev/arne/libqi-master/qi/type/typeinterface.hpp:381:0,
from /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/anyreference.hpp:376,
from /home/arne/Documents/Dev/arne/libqi-master/qi/anyvalue.hpp:10,
from /home/arne/Documents/Dev/arne/libqi-master/qi/detail/future_fwd.hpp:17,
from /home/arne/Documents/Dev/arne/libqi-master/qi/future.hpp:7,
from /home/arne/Documents/Dev/arne/libqi-master/src/future.cpp:5:
/home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:17: error: expected identifier before ‘!’ token
static_assert(!boost::is_same<T,bool>::value, "std::vector is not supported by AnyValue.");
^
/home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:17: error: expected ‘,’ or ‘...’ before ‘!’ token
/home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:98: warning: ISO C++ forbids declaration of ‘static_assert’ with no type [-fpermissive]
static_assert(!boost::is_same<T,bool>::value, "std::vector is not supported by AnyValue.");
^
make[2]: *** [CMakeFiles/qi.dir/src/future.cpp.o] Error 1
make[1]: *** [CMakeFiles/qi.dir/all] Error 2
make: *** [all] Error 2

Any clue what is wrong?

Thanks in advance

We use c++11 in libqi, now. We will make a fix available soon. Sorry for the inconvenience.

In the meantime, you can add the flag -std=gnu++0x or gnu++11 manually. You will need to add it to all your projects that use libqi also.

How can i add it with cmake because i use now for building my apps qibuild make.
Is this the same issue like -std=gnu++0x?

/lib/libqi.so: undefined reference to boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::detail::copy_option, boost::system::error_code*)' //lib/libqi.so: undefined reference toboost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::basic_string<char, std::char_traits, std::allocator >&)'
collect2: ld returned 1 exit status
CMakeFiles/app.dir/build.make:106: recipe for target 'sdk/bin/app' failed
make[2]: *** [sdk/bin/app] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/app.dir/all' failed
make[1]: *** [CMakeFiles/app.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

Yes, this is a boost bug which makes c++03 and c++11 versions incompatible. There are at least two ways to workaround this:

  • compile boost with c++11. You can do that by compiling boost with something like:

    ./b2 cxxflags=-std=c++11

  • disable c++11 scoped enums. You can do that by doing something like:

    CXXFLAGS="-std=gnu++11 -DBOOST_NO_CXX11_SCOPED_ENUMS" qibuild make

Another solution would be to upgrade boost, though I never tested that. It seems that the fix was back ported into boost 1.56. Beware that libqi does not support boost above 1.56.

I tried both in command line and they don't work. Does i need to add somethings to my project in the cmakefile.txt? Or do something else?

Does not officially support 1.56. I compile it with boost 1.57 sometimes and it works (but it's not officially supported).

If you still have problem open a new issue. Sorry.