klokan / webstor

High performance C++ API for Amazon S3
Apache License 2.0
1 stars 2 forks source link

Compiling with qmake #6

Closed klokan closed 7 years ago

klokan commented 11 years ago

We need to create a cross-platform (Windows/Mac/Linux) compilation with 'qmake' project file, similar to 'maptiler' to simplify the later merging of the two projects.

Possibly we could keep the code of 'webstor' library in a separate project and use 'git submodule' to link this one to maptiler main tree.

klokan commented 11 years ago

Miki, could you please have a look at this and create the appropriate .pro file and test compilation with qmake on all platforms on our virtual machines in labs? THX

MartinMikita commented 11 years ago

Using qmake on Linux [Ubuntu] I found this error:

In file included from directory.cpp:12:0: ./dirent.h:100:20: fatal error: windef.h: No such file or directory

It is result of using following compilation line g++ -c directory.cpp -I. -o directory.o

Without flag -I. there is no error, but I am unable to remove this flag from Qt project file. It will be necessary to remove it from Makefile somehow, after qmake, or "fix this error". If this file is used on Windows, than it should be surrounded with #ifdef _WIN32 ... #endif

klokan commented 11 years ago

@xrosecky could you please comment on this? THX

xrosecky commented 11 years ago

It is already surrounded with #ifdef _WIN32 ... #endif:

https://github.com/klokan/webstor/blob/master/directory.cpp#L9

But I think we can rename the ident.h to something like ident_win.h and change the include in directory.cpp and it will solve the problem. Can I fix it?

xrosecky commented 11 years ago

BTW, regarding the compilation warning on Mac OS X (deprecated openSSL), we should bundle own openSSL library with webstor and link it statically, see this post for details:

http://ludovicrousseau.blogspot.cz/2011/08/mac-os-x-lion-and-openssl.html

MartinMikita commented 11 years ago

https://github.com/klokan/webstor/blob/master/directory.cpp#L9

So this is the source of weird error. If it is compiled with -I., it is including our dirent.h, not system dirent.h, which is including other win headers, that on Linux not exists. I think, you should maybe rename it, so it will not confuse Linux.

xrosecky commented 11 years ago

OK, renamed in c496aeca03.

MartinMikita commented 11 years ago

After long studying and testing, I have two options, how to make it "working well" Qt project file can make just one proper target, therefore

There is also another option, do not making static library webstor.a, but just wscmd, wsdbg and wsperf with proper link commands.

What should I do? Is static library needed?

xrosecky commented 11 years ago

The wsdbg and wsperf can be optional, they are used for debuging or performance analysis. The only required binary is wscmd, which can upload files, manipulate with buckets and so on.

@klokan Do you need static library?

klokan commented 11 years ago

We have two main targets:

1) Now - the result of compilation should be the 'wscmd' binary which will be distributed together with the maptiler cluster (and the 'wscmd' may be re-branded at later point to something more "ours", such as 'maptiler_transfer' - or do you have better name?). I don't want to let our customers know about webstor library.

2) Later we need to compile / link the webstor with new functionality as a library with maptiler GUI directly - to integrate upload into S3/GoogleStorage/... with progressbar in the user-interface. Then the webstor repository will be git submodule or we will merge the project directly into maptiler main git repository and compilation must be done from the maptiler.pro

I don't really care about the other binaries, beside debugging and development.

On Thu, Mar 21, 2013 at 8:58 PM, Václav Rosecký notifications@github.comwrote:

The wsdbg and wsperf can be optional, they are used for debuging or performance analysis. The only required binary is wscmd, which can upload files, manipulate with buckets and so on.

@klokan https://github.com/klokan Do you need static library?

— Reply to this email directly or view it on GitHubhttps://github.com/klokan/webstor/issues/6#issuecomment-15261699 .

Petr Pridal (managing director)

Klokan Technologies GmbH Bahnhofstrasse 9, Baar 6340, Switzerland Tel: +41 (0)41 511 26 12 Email: info@klokantech.com Web: http://www.klokantech.com/

MartinMikita commented 11 years ago

2) Later we need to compile / link the webstor with new functionality as a library with maptiler GUI directly

Do you mean, as static library, or shared library (dll)?

But ok, now I understand, and it will be easier :) So i do not need "copy makefile", just have inspiration for making wscmd

klokan commented 11 years ago

I would prefer static - on all platforms - even if we have the code once in maptiler and for second time in the wscmd. If it must be a shared library for any reason, then name it transfer.dll, instead of webstor.dll, PLS

On Thu, Mar 21, 2013 at 9:31 PM, MartinMikita notifications@github.comwrote:

2) Later we need to compile / link the webstor with new functionality as a library with maptiler GUI directly

Do you mean, as static library, or shared library (dll)?

But ok, now I understand, and it will be easier :) So i do not need "copy makefile", just have inspiration for making wscmd

— Reply to this email directly or view it on GitHubhttps://github.com/klokan/webstor/issues/6#issuecomment-15263470 .

Petr Pridal (managing director)

Klokan Technologies GmbH Bahnhofstrasse 9, Baar 6340, Switzerland Tel: +41 (0)41 511 26 12 Email: info@klokantech.com Web: http://www.klokantech.com/

MartinMikita commented 11 years ago

A new project file (webstor.pro) is in branch qmake, by default it is compiling wscmd, wsperf and wsdbg, but without macro defines. For change, see line 83 all.depends += wsdbg wsperf, remove that one, you do'nt want to compile by default. There exists also targets wsperf and wsdbg, so running a command make wsdbg will make just wsdbg app.

On Windows, there are errors like: fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

On MacOS, using macx-g++ specification (that means, using g++ compiler), there are errors with wscmd.cpp wscmd.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’: wscmd.cpp:474: instantiated from here wscmd.cpp:474: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available But, on MacOS using clang specification (clang++ compiler), everything is working good, no compilation error.

On the other hand, actual makefile/makefile.win32 is not working on MacOS neither on virtual Windows. On MacOS there are a lot of errors, using cc compiler, i.e. Undefined symbols for architecture x86_64: "std::string::size() const", referenced from: webstor::WsConnection::createBucket(char const*, bool) in webstor.a(wsconn.o) ... "std::bad_alloc::~bad_alloc()", referenced from: webstor::Request::raiseIfError() in webstor.a(wsconn.o)

I would prefer static - on all platforms - even if we have the code once in maptiler and for second time in the wscmd. If it must be a shared library for any reason, then name it transfer.dll, instead of webstor.dll, PLS

@klokan No, there is no problem for static library, I was just asking :)

klokan commented 11 years ago

Please use 'clang++' as the compiler - we need it for MapTiler anyway, so there is no reason for not using it for webstor as well.

Windows must be fixed. Linux is without issues?

klokan commented 11 years ago

@xrosecky please recommend right parameters for the Windows compilation error.

xrosecky commented 11 years ago

The problem with compilation on MS Windows (missing 'pthread.h' header file) is fixed in this commit: 9963afb37f7dbfe4492013a4eb077e818166b5a8.