supamii / QttpServer

Build your API with C++ - Powered by Qt and Node's libuv
https://supamii.github.io/qttpserver/
MIT License
103 stars 35 forks source link

Build error in Windows 7 with MinGW 5.3.0 #11

Open iamazeem opened 7 years ago

iamazeem commented 7 years ago

Hi there,

I've followed the steps from the main page but when I try to compile the qhttpserver.pro I get the following errors:

WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/*.c
WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/win/*.c
WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/*.c
WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/win/*.c
C:\QttpServer\build\debug\lib\libuv_qmake\Makefile.Debug:113: warning: overriding recipe for target 'debug/*.o'
C:\QttpServer\build\debug\lib\libuv_qmake\Makefile.Debug:110: warning: ignoring old recipe for target 'debug/*.o'
fatal error: cannot specify -o with -c, -S or -E with multiple files

Any suggestions?

I'm using Qt 5.7 on Windows 7 (32-bit).

supamii commented 7 years ago

Ah interesting... are you using mingw? These seem like GNU error messages, for example:

https://www.gnu.org/software/make/manual/html_node/Error-Messages.html http://stackoverflow.com/questions/13268517/cannot-specify-c-with-multiple-files

I've only tested against MSVC as indicated in the docs - but I can dig around later on my windows machine to see what the issue is - it would help if you can give me your mingw version as well

iamazeem commented 7 years ago

@supamii Yes. I'm using MinGW 5.3.0 (32-bit).

BTW, it's amazing and surprisingly this project is covering a lot of things that other Qt HTTP projects are not. I guess the focus here is providing a complete solution for restful services for Qt. I liked the feature to resolve dependencies using Git. Loved it, to be honest! <3

I'd suggest that it should accompany an HTTP client too. I've seen the issue (enhancement) regarding providing SSL/TLS support and I hope to see it soon. It would be awesome. Just can't wait to get my hands dirty to test this one though. :-)

~ AZEEM ~

supamii commented 7 years ago

Update:

First, the bad news - it looks as though minGW is minimally supported by libuv, the heart and soul of qttpserver.

https://github.com/libuv/libuv/blob/master/SUPPORTED_PLATFORMS.md

However there have been some (relatively) recent changes to support mingw seen here.

So regardless, I'm going to continue to reconfigure qmake files to have it be mingw friendlier - it's hard to tell at this point if there'll be any serious road-block that'll prevent it.

In the meanwhile, is MSVC an option for you at all?

iamazeem commented 7 years ago

@supamii Well, that's too bad! I'm using Qt Creator. For cross-platform development, I need to stick with Qtonly.

I did some digging and found some interesting things:

Anyway, I'd try to have a look at QttpServer on Mac. Just to have a flavor of it. :) Hope that'd work fine.

A quick question. I guess Qthas everything to create a good server so why not use its features? Any specific reason to use libuvhere? Just asking.

supamii commented 7 years ago

First off, as far as Qt's TcpServer goes - I have analyzed its blocking-synchronous mode and it shares much of the tcp advantages boasted by libuv. To be specific, it leverages poll instead of select() - see: http://www.kegel.com/c10k.html. Here's the qt code base: http://code.qt.io/cgit/qt/qtbase.git/tree/src/network/socket/qlocalsocket_unix.cpp

With that, there's really no reason not to use TcpServer in a blocking/synchronous way! You can check out this very popular version here: https://github.com/nikhilm/qhttpserver

Advantages of QttpServer:

  1. Url routing mechanisms are provided
  2. Has its own event loop (might not be entirely a good thing depending on your needs)

What I do enjoy about libuv is the amount of control that we potentially have.

Personally - I have a personal mission to see this compared to performance and memory consumption against other popular NodeJS solutions

supamii commented 7 years ago

It doesn't look like I'll be able to support MinGW without replacing poll.h which I'm not enthusiastic about. I'd prefer to employ only underlying sockets that all operate as intended- I don't see the benefit in faking out any OS APIs.

I'd like to clear up a bit of confusion that we've had too.

So if you are going to develop on a windows machine - I encourage you to install Visual Studio 2015 (or newer).

After you install MSVC 2015+, you'll have at your disposal the compiler (cl) and the rest of the toolchain that Qt can then use to build libuv.

I hope that makes sense - let me know.

supamii commented 7 years ago

I've reopened again - since it still seems possible - i am slowly working in the MINGW config flag to see just how far i can get

i got side-tracked on windows build issues and i'll try again tomorrow

iamazeem commented 7 years ago

@supamii : Thanks for working on this! I really appreciate that. <3

For now, I'm using QtHttpServer but I'm looking for to use the things like a separate isolated event loop, URL routing, HTTP client with its own event loop (if need be), etc. And, I hope QttpServer would be offering all of these seamlessly on all the platforms that Qt supports.

Regarding event loop for descriptors, IMO the epoll is by far the best solution compared to select and poll. I've used it in the past and it works great. But, that was for linux. I don't know if it's equivalent is available for Windows.

Anyways, I hope you'll come up with a solution for this! :) Best of luck! 👍

iamazeem commented 7 years ago

@supamii Any update on this one?