tplgy / bonefish

C++ WAMP application router that enables building applications from loosely-coupled components.
Apache License 2.0
55 stars 33 forks source link

Problem building on Windows #42

Open sourcerror opened 7 years ago

sourcerror commented 7 years ago

I am trying to build bonefish on a windows 7 system and I am running into some problems. I am using either MSVC 2015 of GCC version 5.3.0 (buildt by the MinGW-W64 project) and Boost version 1.60.

For my GCC attempt I created a folder "C:\temp\bonefish\bonefish-build" and executed:

cmake -G "CodeBlocks - MinGW Makefiles" ../ mingW32-make -f Makefile

from the command-line within that directory. This failed after it created among others: C:\temp\bonefish\bonefish-build\CMakeCache.txt In that file I have modified all references to the pre-build Boost libraries (program_options, system, thread, chrono, date_time and atomic).

Because I am on a Windows system I also had to change RT_LIBRARY:FILEPATH. In my case i had to change it to (depending on the location of the compiler): RT_LIBRARY:FILEPATH=C:/mingw32/i686-w64-mingw32/lib/libws2_32.a

I ran both commands again and got a Code::Blocks project, but it would not build yet. In bonefish/rawsocket/rawsocket_connection.hpp there is an include of <arpa/inet.h>, that does not exist on Windows. I had to change that include to . Maybe an #ifdef can be used here?

Because I know that including winsock2 often causes problems if WIN32_LEAN_AND_MEAN has not been defined I also defined this for the project. I did this by editing bonefish\CMakeLists.txt:

if(WIN32) add_definitions(-D_WIN32_WINNT=0x0500) endif()

became

if(WIN32) add_definitions(-D_WIN32_WINNT=0x0500) add_definitions(-DWIN32_LEAN_AND_MEAN) endif()

Subsequently I ran into problems with the third-party includes from: bonefish\third-party\msgpack-c These problems could be overcome by reverting the msgpack-c files to the revision mentioned in the readme.md and changing: bonefish/CMakeList.txt

if(NOT MSVC) set(CMAKE_CXX_FLAGS "-Wall -Werror -Wno-unused-variable -std=c++11 ${CMAKE_CXX_FLAGS}") else()

into:

if(NOT MSVC) set(CMAKE_CXX_FLAGS "-Wall -Werror -Wno-unused-variable -fno-strict-aliasing -std=c++11 ${CMAKE_CXX_FLAGS}") else()

I ran both commands again and got a Code::Blocks project, but it would not build yet. Now if I try to build the project I get errors from bonefish/src/bonefish/rawsocket/uds_listener stating that:

In file included from C:\temp\bonefish\src\bonefish\rawsocket\uds_listener.cpp:17:0: C:/temp/bonefish/src/bonefish/rawsocket/uds_listener.hpp:47 C:/temp/bonefish/rawsocket/uds_listener.hpp:48 C:/temp/bonefish/rawsocket/uds_listener.hpp:49 In file included from C:\temp\bonefish\src\bonefish\rawsocket\uds_listener.cpp:18 C:/temp/bonefish/rawsocket/uds_connection.hpp:32 error: 'local' in namespace 'boost::asio' does not name a type

And some other errors that seem to be the result of these.

Now I don't have any ideas bot how to overcome this one and I hope someone will be able to help me bit. Also, if there is a pre-compiled stand-alone router or a DLL that I could use on a windows 7 system I would appreciate to get those so that I can also spend some time on trying out the actual communication.

Kind regards, Nico

davidchappelle commented 7 years ago

Hi Nico,

Thanks for digging in to the Windows related build errors. As you can probably guess, we haven't really been using this project on Windows. Sounds like we could do a better job with cmake in picking up the boost libraries on windows. The remaining error you are getting is odd since it should technically be included with boost-system (hopefully you have asio built/included in your pre-built boost). Cmake clearly isn't finding your boost libraries properly which is likely related to https://github.com/tplgy/bonefish/blob/master/CMakeLists.txt#L7 not being setup correctly or your libraries being in a non-standard location. There should be a way to point cmake at the correct boost installation directory.

I think that there are some valuable changes here as well so if you could put together PRs for some of the fixes you have made here that would be great.

Cheers,

Dave

On Thu, Sep 22, 2016 at 12:48 PM, sourcerror notifications@github.com wrote:

I am trying to build bonefish on a windows 7 system and I am running into some problems. I am using either MSVC 2015 of GCC version 5.3.0 (buildt by the MinGW-W64 project) and Boost version 1.60.

For my GCC attempt I created a folder "C:\temp\bonefish\bonefish-build" and executed:

cmake -G "CodeBlocks - MinGW Makefiles" ../ mingW32-make -f Makefile

from the command-line within that directory. This failed after it created among others: C:\temp\bonefish\bonefish- build\CMakeCache.txt In that file I have modified all references to the pre-build Boost libraries (program_options, system, thread, chrono, date_time and atomic).

Because I am on a Windows system I also had to change RT_LIBRARY:FILEPATH. In my case i had to change it to (depending on the location of the compiler): RT_LIBRARY:FILEPATH=C:/mingw32/i686-w64-mingw32/lib/libws2_32.a

I ran both commands again and got a Code::Blocks project, but it would not build yet. In bonefish/rawsocket/rawsocket_connection.hpp there is an include of , that does not exist on Windows. I had to change that include to . Maybe an

ifdef can be used here?

Because I know that including winsock2 often causes problems if WIN32_LEAN_AND_MEAN has not been defined I also defined this for the project. I did this by editing bonefish\CMakeLists.txt:

if(WIN32) add_definitions(-D_WIN32_WINNT=0x0500) endif()

became

if(WIN32) add_definitions(-D_WIN32_WINNT=0x0500) add_definitions(-DWIN32_LEAN_AND_MEAN) endif()

Subsequently I ran into problems with the third-party includes from: bonefish\third-party\msgpack-c These problems could be overcome by reverting the msgpack-c files to the revision mentioned in the readme.md and changing: bonefish/CMakeList.txt

if(NOT MSVC) set(CMAKE_CXX_FLAGS "-Wall -Werror -Wno-unused-variable -std=c++11 ${CMAKE_CXX_FLAGS}") else()

into:

if(NOT MSVC) set(CMAKE_CXX_FLAGS "-Wall -Werror -Wno-unused-variable -fno-strict-aliasing -std=c++11 ${CMAKE_CXX_FLAGS}") else()

I ran both commands again and got a Code::Blocks project, but it would not build yet. Now if I try to build the project I get errors from bonefish/src/bonefish/rawsocket/uds_listener stating that:

In file included from C:\temp\bonefish\src\bonefish\ rawsocket\uds_listener.cpp:17:0: C:/temp/bonefish/src/bonefish/rawsocket/uds_listener.hpp:47 C:/temp/bonefish/rawsocket/uds_listener.hpp:48 C:/temp/bonefish/rawsocket/uds_listener.hpp:49 In file included from C:\temp\bonefish\src\bonefish\ rawsocket\uds_listener.cpp:18 C:/temp/bonefish/rawsocket/uds_connection.hpp:32 error: 'local' in namespace 'boost::asio' does not name a type

And some other errors that seem to be the result of these.

Now I don't have any ideas bot how to overcome this one and I hope someone will be able to help me bit. Also, if there is a pre-compiled stand-alone router or a DLL that I could use on a windows 7 system I would appreciate to get those so that I can also spend some time on trying out the actual communication.

Kind regards, Nico

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tplgy/bonefish/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/ACmyX3x3lVPPoErsm4fdbR2DxFyWqAlNks5qsrFogaJpZM4KEHtZ .

sourcerror commented 7 years ago

I usually use subversion so I don't know how to make a PR yet, but once I get stuff sorted out I will put in the effort to figure that out. My current concern a router going before I get ordered to drop it completely because it takes too much time.

Should boost::asio be pre-compiled for bonefish? Usually it is a header only library, but it can be build.

By default, Boost.Asio is a header-only library. However, some developers may prefer to build Boost.Asio using separately compiled source code. To do this, add #include <boost/asio/impl/src.hpp> to one (and only one) source file in a program, then build the program with BOOST_ASIO_SEPARATE_COMPILATION defined in the project/compiler settings. Alternatively, BOOST_ASIO_DYN_LINK may be defined to build a separately-compiled Boost.Asio as part of a shared library.

If using Boost.Asio's SSL support, you will also need to add #include <boost/asio/ssl/impl/src.hpp>.

http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/using.html#boost_asio.using.optional_separate_compilation