warmcat / libwebsockets

canonical libwebsockets.org networking library
https://libwebsockets.org
Other
4.66k stars 1.46k forks source link

libwebsocket-master : Unable to build on QnX 660 (RTOS) #517

Closed jayesh9977 closed 8 years ago

jayesh9977 commented 8 years ago

Hello,

  1. I am trying to build the libwebsockets-master on QnX 660 to use it with mosquitto MQTT example.
  2. As Qnx 660 SDK doesn't support libev/libuv mechanism, hence there aren't corresponding header files.
  3. I have successfully build the libwebsockets-master on Ubuntu.

Is there any alternative to build the libwebsockets on Qnx 660.

thanks.

JoakimSoderberg commented 8 years ago

And again, as @lws-team said... Please provide more information such as error messages or failed build log and so on. You have to be a lot more specific

JoakimSoderberg commented 8 years ago

@ralight I guess you might be helpful with this, since you're the author of Mosquitto :)

jayesh9977 commented 8 years ago

make[1]: Entering directory D:/JayeshDulani/WS_PL_NS1.7/libwebsockets-master' C:/qnx660/host/win32/x86/usr/bin/qcc -c -ID:/JayeshDulani/WS_PL_NS1.7/libwebsockets-master/lib/ -IC:/qnx660/target/qnx6/usr/include -IC:/qnx660/target/qnx6/usr/include/io-pkt/ -Vgcc_ntox86 -Wno-pointer-sign -Wno-sign-compare -g0 -DHAVE_PTHREAD=1 -fPIE lib/alloc.c -o lib/alloc.o In file included from lib/alloc.c:1:0: lib/private-libwebsockets.h:139:16: fatal error: ev.h: No such file or directory make[1]: Leaving directoryD:/JayeshDulani/WS_PL_NS1.7/libwebsockets-master' compilation terminated. cc: C:/qnx660/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.6.0/4.7.3/cc1 caught signal 1 make[1]: * [lib/alloc.o] Error 1 make: * [all] Error 2

jayesh9977 commented 8 years ago

There isn't any support for ev.h/uv.h on QnX 660. so checking any alternative. mosquitto MQTT broker is tightly coupled with libwebsockets for Websocket support.

JoakimSoderberg commented 8 years ago

Well you don't have to build libwebsockets with support for those turned on. I am not sure what build system you are using?

Are you simply compiling libwebsockets using the instructions for libwebsockets? Then by default the use of libev and libuv is turned off: https://github.com/warmcat/libwebsockets/blob/master/CMakeLists.txt#L70-L71

However there are some specific cases where it is turned on automatically when using other options (actually this is bad design in the CMake project, it sohuld instead give an error rather than simply turn on libev/uv automatically): https://github.com/warmcat/libwebsockets/blob/master/CMakeLists.txt#L101-L112

...

But you need to be very specific what build instructions and exactly what commands (ALL OF THEM) you are running when you're getting the error.

ralight commented 8 years ago

I can only echo what @JoakimSoderberg is saying - please provide the exact details of what you are using for the build configuration step.

Mosquitto doesn't make use of the libuv/libev support in lws, so disabling them shouldn't be a problem.

jayesh9977 commented 8 years ago

Thanks @ralight and @JoakimSoderberg for your responses and support.

Requirement is to use the mosquitto with websocket support, but as i understood mosquitto example: a. I need to provide the library (libwebsocket-master.so) to mosquitto MQTT broker to execute with websocket enabled. b. I am not able to build the libwebsocket on RTOS platform QnX 660. c. I have not enabled/disabled anything for libwebsocket.

ralight commented 8 years ago

@jayesh9977 The answer we are looking for is the exact thing that you typed in to the command line. This is what I just tried on an Ubuntu Linux box that has neither libev nor libuv installed:

git clone https://github.com/warmcat/libwebsockets
cd libwebsockets
mkdir build
cd build
cmake ..
make

Everything built fine, despite the lack of libuv/libev - so you should not have a problem with a lack of libuv/libev. Please provide a similar set of commands that are exactly what you have tried.

lws-team commented 8 years ago

Yes lws won't touch ev.h by default. In particular the error is coming here

#ifdef LWS_USE_LIBEV
#include <ev.h>
#endif

Unless you ask for ev support at cmake, LWS_USE_LIBEV will never be defined. So this sounds like a self-inflicted wound.

If you used the recommended separate build dir, you can just delete the build dir, create a new one and from there, just do the default cmake .. with no options. You can be sure then everything about your previous cmake options is gone.

If you built inside the source tree, it's messier, start over with a fresh clone and use a throwaway build dir as recommended.

jayesh9977 commented 8 years ago

@ralight @lws-team;

  1. first I tried compiling on linux (ubuntu) and it build successfully with CMake then Make.
  2. Actually I am trying to build on QnX neutrino platform.
  3. Qnx doesn't support CMake, hence written own make file to simply build (.c) but facing issue of libev/libuv etc. ( i have provided some .h files generated by CMake(ubuntu) done using step 1.)

thanks for your help.

lws-team commented 8 years ago

If I google QNX and cmake, it seems people are using cmake on QNX.

Cmake seems to know about QNX

https://github.com/Kitware/CMake/blob/master/Modules/Platform/QNX.cmake

I think you should come at the problem from the "how can I use cmake on QNX" perspective and all or almost all of the other problems will disappear.

acooks commented 8 years ago

@jayesh9977 I want to point out that you are the QNX expert in this case and should know what makes that platform special, why you need to use it and be able to make things run on that exceptional platform.

libwebsockets has been successfully ported to all sorts of strange platforms, with the contributions of the people who use those platforms, but you can't expect the core people to know all the strange things of all the strange platforms.

JoakimSoderberg commented 8 years ago

@jayesh9977 also for future reference, not just relating to libwebsockets. It is a very good idea to mention that you have created your own Makefile instead of using the official CMake project when asking for help. As well as providing as much information as possible up front. Exactly what settings, compiler, OS, and so on you are using.

Regarding running cmake on ubuntu first, and copying the generated headers to windows, and in turn try to compile the code using that.

The reason those header files aren't just included in libwebsockets, but instead generated, is because they contain settings from the CMake project, as well as system introspection. In this case specific things on your ubuntu machine. If you then try to use that on a different platform it is bound to fail.

If you need to write your own Makefile you must understand how the origina CMake project works, as well as note how all the ifdefs and macros in the config header relate to each other, as well as what C-files contain what (in this case you are including libev/uv code that you don't even need).

But as @lws-team says, I'd recommend trying to focus on using the CMake project to cross compile for the QNX platform instead. Since that is supported by CMake. Things that you could google for is "cmake qnx cross compile": https://cmake.org/cmake/help/v3.1/manual/cmake-toolchains.7.html#cross-compiling-for-qnx

Some general information on cross compilation in cmake: http://www.vtk.org/Wiki/CMake_Cross_Compiling

lws-team commented 8 years ago

Well I am pretty sure there is no "facing issue of libev/libuv etc", especially since the OP says " I tried compiling on linux (ubuntu) and it build successfully with CMake then Make". Both libev and libuv are disabled by default on every platform.

This issue is actually "how do I use cmake on QNX", which is unrelated to lws. It seems from google many people succeed to use cmake on QNX.

If there's some problem with lws, or something we should do to make integration with QNX work easier (via cmake, not random unmaintainable fiddlings), please propose it on another github issue.