arobenko / embxx

embxx - Embedded C++ Library
GNU General Public License v3.0
262 stars 35 forks source link

EMBXX in Cygwin and Windows 10 compile? #11

Closed carlosdelfino closed 8 years ago

carlosdelfino commented 8 years ago

Hello. Congratulations for the work.

I am aware of it researching the use of C ++ in embedded systems, then found his book on gitbook and became interested in following your suggested steps.

I tried to compile the embedxx on my machine, but I'm in trouble.

My environment is:

The Erro:

consu_000@SocialSLA ~/Documents/GitHub/embxx/build
$ make install
[  1%] Building CXX object module/io/test/CMakeFiles/io.InStreamBufTest.dir/InStreamBufTestRunner.cpp.o
In file included from /usr/include/boost/asio/detail/signal_blocker.hpp:25:0,
                 from /usr/include/boost/asio/detail/impl/select_reactor.ipp:29,
                 from /usr/include/boost/asio/detail/select_reactor.hpp:212,
                 from /usr/include/boost/asio/detail/reactor.hpp:29,
                 from /usr/include/boost/asio/detail/impl/task_io_service.ipp:24,
                 from /usr/include/boost/asio/detail/task_io_service.hpp:198,
                 from /usr/include/boost/asio/impl/io_service.hpp:71,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:20,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:21,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/ReadFifo.h:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/UartDevice.h:36,
                 from /home/consu_000/Documents/GitHub/embxx/module/io/test/InStreamBuf.th:30,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:23:
/usr/include/boost/asio/detail/posix_signal_blocker.hpp: In constructor ‘boost::asio::detail::posix_signal_blocker::posix_signal_blocker()’:
/usr/include/boost/asio/detail/posix_signal_blocker.hpp:42:25: error: ‘sigfillset’ was not declared in this scope
     sigfillset(&new_mask);
                         ^
/usr/include/boost/asio/detail/posix_signal_blocker.hpp: In member function ‘void boost::asio::detail::posix_signal_blocker::block()’:
/usr/include/boost/asio/detail/posix_signal_blocker.hpp:59:27: error: ‘sigfillset’ was not declared in this scope
       sigfillset(&new_mask);
                           ^
In file included from /usr/include/boost/asio/detail/signal_set_service.hpp:213:0,
                 from /usr/include/boost/asio/signal_set_service.hpp:20,
                 from /usr/include/boost/asio/basic_signal_set.hpp:24,
                 from /usr/include/boost/asio.hpp:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/ReadFifo.h:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/UartDevice.h:36,
                 from /home/consu_000/Documents/GitHub/embxx/module/io/test/InStreamBuf.th:30,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:23:
/usr/include/boost/asio/detail/impl/signal_set_service.ipp: In member function ‘boost::system::error_code boost::asio::detail::signal_set_service::add(boost::asio::detail::signal_set_service::implementation_type&, int, boost::system::error_code&)’:
/usr/include/boost/asio/detail/impl/signal_set_service.ipp:266:29: error: ‘sigfillset’ was not declared in this scope
       sigfillset(&sa.sa_mask);
                             ^
/usr/include/boost/asio/detail/impl/signal_set_service.ipp:267:44: error: no matching function for call to ‘sigaction::sigaction(int&, sigaction*, int)’
       if (::sigaction(signal_number, &sa, 0) == -1)
                                            ^
In file included from /usr/include/sys/signal.h:112:0,
                 from /usr/include/signal.h:6,
                 from /usr/include/pthread.h:12,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits/gthr-default.h:35,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits/gthr.h:148,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/ext/atomicity.h:35,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/ios_base.h:39,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/ios:42,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/istream:38,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/sstream:38,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/complex:45,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/StdHeaders.h:24,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/StdValueTraits.h:22,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/ValueTraits.h:400,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/TestSuite.h:24,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/RealDescriptions.h:20,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/TestRunner.h:22,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:10:
/usr/include/cygwin/signal.h:317:8: note: candidate: sigaction::sigaction()
 struct sigaction
        ^
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 0 arguments, 3 provided
/usr/include/cygwin/signal.h:317:8: note: candidate: constexpr sigaction::sigaction(const sigaction&)
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 1 argument, 3 provided
/usr/include/cygwin/signal.h:317:8: note: candidate: constexpr sigaction::sigaction(sigaction&&)
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 1 argument, 3 provided
In file included from /usr/include/boost/asio/detail/signal_set_service.hpp:213:0,
                 from /usr/include/boost/asio/signal_set_service.hpp:20,
                 from /usr/include/boost/asio/basic_signal_set.hpp:24,
                 from /usr/include/boost/asio.hpp:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/ReadFifo.h:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/UartDevice.h:36,
                 from /home/consu_000/Documents/GitHub/embxx/module/io/test/InStreamBuf.th:30,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:23:
/usr/include/boost/asio/detail/impl/signal_set_service.ipp: In member function ‘boost::system::error_code boost::asio::detail::signal_set_service::remove(boost::asio::detail::signal_set_service::implementation_type&, int, boost::system::error_code&)’:
/usr/include/boost/asio/detail/impl/signal_set_service.ipp:337:44: error: no matching function for call to ‘sigaction::sigaction(int&, sigaction*, int)’
       if (::sigaction(signal_number, &sa, 0) == -1)
                                            ^
In file included from /usr/include/sys/signal.h:112:0,
                 from /usr/include/signal.h:6,
                 from /usr/include/pthread.h:12,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits/gthr-default.h:35,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits/gthr.h:148,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/ext/atomicity.h:35,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/ios_base.h:39,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/ios:42,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/istream:38,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/sstream:38,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/complex:45,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/StdHeaders.h:24,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/StdValueTraits.h:22,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/ValueTraits.h:400,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/TestSuite.h:24,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/RealDescriptions.h:20,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/TestRunner.h:22,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:10:
/usr/include/cygwin/signal.h:317:8: note: candidate: sigaction::sigaction()
 struct sigaction
        ^
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 0 arguments, 3 provided
/usr/include/cygwin/signal.h:317:8: note: candidate: constexpr sigaction::sigaction(const sigaction&)
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 1 argument, 3 provided
/usr/include/cygwin/signal.h:317:8: note: candidate: constexpr sigaction::sigaction(sigaction&&)
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 1 argument, 3 provided
In file included from /usr/include/boost/asio/detail/signal_set_service.hpp:213:0,
                 from /usr/include/boost/asio/signal_set_service.hpp:20,
                 from /usr/include/boost/asio/basic_signal_set.hpp:24,
                 from /usr/include/boost/asio.hpp:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/ReadFifo.h:27,
                 from /home/consu_000/Documents/GitHub/embxx/module/device/test/UartDevice.h:36,
                 from /home/consu_000/Documents/GitHub/embxx/module/io/test/InStreamBuf.th:30,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:23:
/usr/include/boost/asio/detail/impl/signal_set_service.ipp: In member function ‘boost::system::error_code boost::asio::detail::signal_set_service::clear(boost::asio::detail::signal_set_service::implementation_type&, boost::system::error_code&)’:
/usr/include/boost/asio/detail/impl/signal_set_service.ipp:391:50: error: no matching function for call to ‘sigaction::sigaction(int&, sigaction*, int)’
       if (::sigaction(reg->signal_number_, &sa, 0) == -1)
                                                  ^
In file included from /usr/include/sys/signal.h:112:0,
                 from /usr/include/signal.h:6,
                 from /usr/include/pthread.h:12,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits/gthr-default.h:35,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits/gthr.h:148,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/ext/atomicity.h:35,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/ios_base.h:39,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/ios:42,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/istream:38,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/sstream:38,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/complex:45,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/StdHeaders.h:24,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/StdValueTraits.h:22,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/ValueTraits.h:400,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/TestSuite.h:24,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/RealDescriptions.h:20,
                 from /home/consu_000/Documents/GitHub/embxx/external/cxxtest/cxxtest/TestRunner.h:22,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:10:
/usr/include/cygwin/signal.h:317:8: note: candidate: sigaction::sigaction()
 struct sigaction
        ^
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 0 arguments, 3 provided
/usr/include/cygwin/signal.h:317:8: note: candidate: constexpr sigaction::sigaction(const sigaction&)
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 1 argument, 3 provided
/usr/include/cygwin/signal.h:317:8: note: candidate: constexpr sigaction::sigaction(sigaction&&)
/usr/include/cygwin/signal.h:317:8: note:   candidate expects 1 argument, 3 provided
In file included from /home/consu_000/Documents/GitHub/embxx/module/io/test/InStreamBuf.th:23:0,
                 from /home/consu_000/Documents/GitHub/embxx/build/module/io/test/InStreamBufTestRunner.cpp:23:
/home/consu_000/Documents/GitHub/embxx/embxx/driver/Character.h: In instantiation of ‘void embxx::driver::details::CharacterReadSupport<TDevice, TEventLoop, THandler, TReadUntilPred, 1ul>::readCompleteInterruptHandler(const ErrorStatus&) [with TDevice = embxx::device::test::UartDevice<embxx::device::test::EventLoopLock, char>; TEventLoop = embxx::util::EventLoop<1024ul, embxx::device::test::EventLoopLock, embxx::device::test::EventLoopCond>; THandler = embxx::util::StaticFunction<void(const embxx::error::ErrorStatusT<embxx::error::ErrorCode>&, long unsigned int)>; TReadUntilPred = std::nullptr_t; embxx::error::ErrorStatus = embxx::error::ErrorStatusT<embxx::error::ErrorCode>]’:
/home/consu_000/Documents/GitHub/embxx/embxx/driver/Character.h:353:17:   required from ‘embxx::driver::details::CharacterReadSupport<TDevice, TEventLoop, THandler, TReadUntilPred, 1ul>::CharacterReadSupport(embxx::driver::details::CharacterReadSupport<TDevice, TEventLoop, THandler, TReadUntilPred, 1ul>::Device&, embxx::driver::details::CharacterReadSupport<TDevice, TEventLoop, THandler, TReadUntilPred, 1ul>::EventLoop&) [with TDevice = embxx::device::test::UartDevice<embxx::device::test::EventLoopLock, char>; TEventLoop = embxx::util::EventLoop<1024ul, embxx::device::test::EventLoopLock, embxx::device::test::EventLoopCond>; THandler = embxx::util::StaticFunction<void(const embxx::error::ErrorStatusT<embxx::error::ErrorCode>&, long unsigned int)>; TReadUntilPred = std::nullptr_t; embxx::driver::details::CharacterReadSupport<TDevice, TEventLoop, THandler, TReadUntilPred, 1ul>::Device = embxx::device::test::UartDevice<embxx::device::test::EventLoopLock, char>; embxx::driver::details::CharacterReadSupport<TDevice, TEventLoop, THandler, TReadUntilPred, 1ul>::EventLoop = embxx::util::EventLoop<1024ul, embxx::device::test::EventLoopLock, embxx::device::test::EventLoopCond>]’
/home/consu_000/Documents/GitHub/embxx/embxx/driver/Character.h:1038:27:   required from ‘embxx::driver::Character<TDevice, TEventLoop, TTraits>::Character(embxx::driver::Character<TDevice, TEventLoop, TTraits>::Device&, embxx::driver::Character<TDevice, TEventLoop, TTraits>::EventLoop&) [with TDevice = embxx::device::test::UartDevice<embxx::device::test::EventLoopLock, char>; TEventLoop = embxx::util::EventLoop<1024ul, embxx::device::test::EventLoopLock, embxx::device::test::EventLoopCond>; TTraits = InStreamBufTestSuite::CharacterTraits; embxx::driver::Character<TDevice, TEventLoop, TTraits>::Device = embxx::device::test::UartDevice<embxx::device::test::EventLoopLock, char>; embxx::driver::Character<TDevice, TEventLoop, TTraits>::EventLoop = embxx::util::EventLoop<1024ul, embxx::device::test::EventLoopLock, embxx::device::test::EventLoopCond>]’
/home/consu_000/Documents/GitHub/embxx/module/io/test/InStreamBuf.th:62:29:   required from here
/home/consu_000/Documents/GitHub/embxx/embxx/driver/Character.h:433:14: error: converting to ‘bool’ from ‘embxx::driver::details::CharacterReadSupportBase<embxx::device::test::UartDevice<embxx::device::test::EventLoopLock, char>, embxx::util::EventLoop<1024ul, embxx::device::test::EventLoopLock, embxx::device::test::EventLoopCond>, embxx::util::StaticFunction<void(const embxx::error::ErrorStatusT<embxx::error::ErrorCode>&, long unsigned int)>, std::nullptr_t>::ReadUntilPred {aka std::nullptr_t}’ requires direct-initialization [-fpermissive]
             (!info_.readUntilPred_) ||
              ^
make[2]: *** [module/io/test/CMakeFiles/io.InStreamBufTest.dir/build.make:67: module/io/test/CMakeFiles/io.InStreamBufTest.dir/InStreamBufTestRunner.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:182: module/io/test/CMakeFiles/io.InStreamBufTest.dir/all] Error 2
make: *** [Makefile:139: all] Error 2

consu_000@SocialSLA ~/Documents/GitHub/embxx/build
arobenko commented 8 years ago

Hi Carlos, The embxx is headers only library and doesn't really require compilation. Just include its headers in your embedded project. The compilation needed only for unittesting, which uses boost.

The reported compilation error states that boost library trying to invoke "sigfillset" function, which seems to be applicable to Linux environment only. Maybe your cygwin environment doesn't provide it.

I would recommend excluding unittests via using: "cmake -DNO_UNIT_TESTS=1 ..". In this case the "make install" command will just copy the embxx headers into your "build_dir/install/include" directory.

I would also recommend using "develop" branch instead of "master". The "develop" branch may work better for your environment.

The third thing is that I haven't tested this work with gcc5 and greater yet. There is issue #5 about it. It seems that there may be some compilation errors inside the library itself. I home to look into it within next month or so.

carlosdelfino commented 8 years ago

Thank you Alex, for the quick response.

I did as instructed and it worked out. I will also test to Develop Branch.

About the version of GCC will try the 4.9.2 version can be this? I will test other alternatives when left over time, perhaps in the mac as well.

In the case of raspberry pi, not yet test, I will have problems?

arobenko commented 8 years ago

The gcc 4.9 should be fine. Let me know if it isn't. The "embxx_on_rpi" project doesn't contain unittests. It cross-compiles the sample applications with the toolchain you specify. These applications can be executed on Raspberry PI.

carlosdelfino commented 8 years ago

Thanks again.

I will give news in the coming days, I will do the tests.