Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Building the C++ API/samples

Please keep it simple and self-sufficient. Creating dependencies makes a
project more complex and more difficult to port to small architectures
like microcontrollers.
At least the plain c implementation should be as simple as possible w/o
dependencies to bulky libs
like boost.

cheers

luja



On 11/14/2013 3:20 PM, Frank Pagliughi wrote:
> Sounds good. I have been working on an update - though, admittedly, a
> bit slowly.  I'd appreciate any feedback.
>
> Frank
>
> On 11/13/2013 04:24 PM, Ian Craggs wrote:
>> Frank,
>>
>> I am happy with that approach.  It's nice to be able to use recent
>> language features without having to wait 5 or 6 years!  And as you
>> say, we have the C library to fall back on - after all, the C library
>> is C rather than C++ because template support just didn't work in gcc
>> when I started writing the first implementation.
>>
>> Making it Boost compatible is up to you.  Personally I'm more
>> interested in automated build and tests.  And we obviously ought to
>> make it clear in big letters that it needs C++11 and what the options
>> are otherwise.
>>
>> What I would say is that I think before making the C++ library a
>> "first class" citizen of Paho, we would have to wait until we can
>> build and test it for Linux at least in the Eclipse build
>> infrastructure.   I'll probably raise a(nother) bug request and see
>> how that goes down!  (I already have a bug open on Windows/Mac builds
>> which is an ongoing discussion).
>>
>> Now I'll dig out my own machine with a recent Linux OS on it...
>>
>> Ian
>>
>> On 13/11/13 18:53, Frank Pagliughi wrote:
>>> Hello Ian,
>>>
>>> Yes, several people asked me about this, particularly people stuck
>>> with an older cross-compiler for an embedded system. Including me,
>>> as it turns out! The earliest GCC I suspect that would work is 4.6.
>>> For Windows, DevStudio 2012 is needed (though I still have to do
>>> more testing on Windows to be sure this works properly).
>>>
>>> The implementation makes heavy use of the C++11 libraries - threads,
>>> sync objects, time (chrono), and shared pointers. When we discussed
>>> this prior to my submission last spring, everyone seemed OK to
>>> proceed along these lines as we could "look forward" with the C++
>>> implementation, since people could fall back to the C library if
>>> necessary.
>>>
>>> I was, however, going to investigate using Boost for older compilers
>>> - so Boost would *not* be needed (at all) for a C++11 compiler, but
>>> could be used for an older compiler. It has nearly drop-in
>>> replacements for threading, time/chrono, and shared pointer
>>> libraries. I would still need to change/remove a few of the new
>>> language features (nullptr, noexcept, etc).
>>>
>>> But without using Boost, the required changes/additions would be a
>>> lot of work.
>>>
>>> To be clear, we would not need to ship any boost code (no licensing
>>> issues), but anyone with GCC <= 4.5 or VisualStudio <= 2010, could
>>> still use the Paho C++ library with Boost as an external
>>> requirement. And since Boost can be cross-compiled easily enough,
>>> this is a viable solution for embedded cross-compiled targets.
>>>
>>> What do you think of that?
>>>
>>> Frank
>>>
>>> On 11/13/2013 11:27 AM, Ian Craggs wrote:
>>>> Hi Frank,
>>>>
>>>> trying to build the C++ samples on my RedHat workstation, I get the
>>>> output included below. At least the first one is presumably due to
>>>> the older version of gcc installed (4.4.7-3) - I haven't looked at
>>>> the rest yet. But the version of gcc installed on at least one of
>>>> the Eclipse build servers is older than that (4.3.4).
>>>>
>>>> Should/could we have a solution for pre C++11 compilers?
>>>>
>>>> Ian
>>>>
>>>> g++ -I.. -I../../../org.eclipse.paho.mqtt.c/src -D_NDEBUG -Wall
>>>> -std=c++0x -O2 -o async_publish async_publish.cpp -L../lib
>>>> -L../../../org.eclipse.paho.mqtt.c/src/linux_ia64 -lmqttpp -lmqttv3a
>>>> In file included from ../mqtt/token.h:32,
>>>> from ../mqtt/async_client.h:31,
>>>> from async_publish.cpp:23:
>>>> ../mqtt/exception.h:73: error: expected ‘;’ before ‘noexcept’
>>>> ../mqtt/exception.h:76: error: expected ‘;’ before ‘}’ token
>>>> In file included from ../mqtt/async_client.h:31,
>>>> from async_publish.cpp:23:
>>>> ../mqtt/token.h: In member function ‘bool
>>>> mqtt::token::wait_until_completion(const
>>>> std::chrono::time_point<_Clock, _Duration1>&)’:
>>>> ../mqtt/token.h:315: error: expected primary-expression before ‘[’
>>>> token
>>>> In file included from ../mqtt/async_client.h:35,
>>>> from async_publish.cpp:23:
>>>> ../mqtt/connect_options.h: In constructor
>>>> ‘mqtt::connect_options::connect_options()’:
>>>> ../mqtt/connect_options.h:63: error: could not convert ‘{{'M', 'Q',
>>>> 'T', 'C'}, 2, 60, 1, 10, 0l, 0l, 0l, 30, 20, 0l, 0l, 0, 0l}’ to
>>>> ‘MQTTAsync_connectOptions’
>>>> async_publish.cpp: In function ‘void sleep(int)’:
>>>> async_publish.cpp:38: error: ‘sleep_for’ is not a member of
>>>> ‘std::this_thread’
>>>> async_publish.cpp: In function ‘int main(int, char**)’:
>>>> async_publish.cpp:143: error: ‘nullptr’ was not declared in this scope
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/paho-dev
>



Back to the top