Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Compiling Paho C Client

Hi Ian,

Am still getting lot of errors in compiling C++ client, do we have any documentation for C++ clients?
Am relatively new to C++ programming and finding difficulty in linking libraries and C-libraries ! 

Thanks!

With Regards,

Satish V Madala Techpreneur & FOSS Evangelist


On Fri, Oct 16, 2015 at 7:02 AM, Satish V Madala <satish@xxxxxxxxxxx> wrote:
Hi,

Libraries were in C Client folder, i linked them using following command, still i get a problem executing cpp samples.

While paho-mqtt3c is present in Paho_C_Build - build/output/ , i have given the C - Path. I also tried with linking mqttpp library in CPP build.

 gcc src/samples/sync_publish.cpp -lmqttpp -L lib -I src -lpthread -std=c++11

This compilation also failed with similar errors.

satish@zombie:~/works/mqtt/org.eclipse.paho.mqtt.cpp$ gcc src/samples/sync_publish.cpp -lpaho-mqtt3c -L ../org.eclipse.paho.mqtt.c/build/output -I src -lpthread -std=c++11
/tmp/ccRhVPyU.o: In function `main':
sync_publish.cpp:(.text+0x174): undefined reference to `mqtt::client::client(std::string const&, std::string const&, mqtt::iclient_persistence*)'
sync_publish.cpp:(.text+0x19c): undefined reference to `mqtt::client::set_callback(mqtt::callback&)'
sync_publish.cpp:(.text+0x1dd): undefined reference to `std::cout'
sync_publish.cpp:(.text+0x1e2): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
sync_publish.cpp:(.text+0x1e7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::flush<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'

|
|
so on..
(.rodata._ZTVN4mqtt19iclient_persistenceE[_ZTVN4mqtt19iclient_persistenceE]+0x30): more undefined references to `__cxa_pure_virtual' follow
/tmp/ccRhVPyU.o: In function `mqtt::persistence_exception::~persistence_exception()':
sync_publish.cpp:(.text._ZN4mqtt21persistence_exceptionD2Ev[_ZN4mqtt21persistence_exceptionD5Ev]+0x34): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o: In function `mqtt::persistence_exception::~persistence_exception()':
sync_publish.cpp:(.text._ZN4mqtt21persistence_exceptionD0Ev[_ZN4mqtt21persistence_exceptionD5Ev]+0x20): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o:(.rodata._ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x20): undefined reference to `__cxa_pure_virtual'
/tmp/ccRhVPyU.o:(.rodata._ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x30): undefined reference to `__cxa_pure_virtual'
/tmp/ccRhVPyU.o:(.rodata._ZTISt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE[_ZTISt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTISt19_Sp_make_shared_tag[_ZTISt19_Sp_make_shared_tag]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTI8callback[_ZTI8callback]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTI22sample_mem_persistence[_ZTI22sample_mem_persistence]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt8callbackE[_ZTIN4mqtt8callbackE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt19iclient_persistenceE[_ZTIN4mqtt19iclient_persistenceE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt21persistence_exceptionE[_ZTIN4mqtt21persistence_exceptionE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt9exceptionE[_ZTIN4mqtt9exceptionE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt9exceptionE[_ZTIN4mqtt9exceptionE]+0x10): undefined reference to `typeinfo for std::runtime_error'
/tmp/ccRhVPyU.o:(.rodata._ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o: In function `std::_Sp_counted_ptr_inplace<mqtt::message, std::allocator<mqtt::message>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()':
sync_publish.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED2Ev[_ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x44): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o: In function `std::_Sp_counted_ptr_inplace<mqtt::message, std::allocator<mqtt::message>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()':
sync_publish.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED0Ev[_ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x20): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o: In function `void __gnu_cxx::new_allocator<mqtt::message>::destroy<mqtt::message>(mqtt::message*)':
sync_publish.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN4mqtt7messageEE7destroyIS2_EEvPT_[_ZN9__gnu_cxx13new_allocatorIN4mqtt7messageEE7destroyIS2_EEvPT_]+0x18): undefined reference to `mqtt::message::~message()'
/tmp/ccRhVPyU.o:(.rodata._ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.eh_frame+0x16b): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status


Thanks!!
With Regards,

Satish V Madala Techpreneur & FOSS Evangelist


On Fri, Oct 16, 2015 at 4:08 AM, <paho-dev-request@xxxxxxxxxxx> wrote:
Send paho-dev mailing list submissions to
        paho-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        https://dev.eclipse.org/mailman/listinfo/paho-dev
or, via email, send a message with subject or body 'help' to
        paho-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
        paho-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of paho-dev digest..."


Today's Topics:

   1. Re: Disconnection issue on Android service (Kamaljeet)
   2. Re: Compiling Paho C Client (Andrew Kenny)
   3. Re: Compiling Paho C Client (Mike Tran)


----------------------------------------------------------------------

Message: 1
Date: Thu, 15 Oct 2015 13:19:34 -0500
From: Kamaljeet <kamaljeetmaini@xxxxxxxxxxx>
To: General development discussions for paho project
        <paho-dev@xxxxxxxxxxx>
Subject: Re: [paho-dev] Disconnection issue on Android service
Message-ID: <BLU179-W851150F6872D6A6D9782A7D93E0@xxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Thanks Rajitha for the feedback. For now, I have changed the keep alive to 1 minute. This may reduce the severity of the issue but won't fully resolve it.
I checked GCM's working and it also has similar limitation. If Internet connection breaks without any obvious sign on the device, GCM won't be able to receive any messages until it pings the server again, which can be as high as 15 minutes.
Date: Thu, 15 Oct 2015 11:42:49 +0530
From: slamdamjc@xxxxxxxxx
To: paho-dev@xxxxxxxxxxx
Subject: Re: [paho-dev] Disconnection issue on Android service

Helllo Kamajeet,
I've been having the same issue. Until now I could only lower the keep alive interval as a solution. More than keeping the connection alive, keep alive ping seems to be worth as a connection verifier here.I wish there was a way for the client to register a connection loss in case of a message delivery failure too.
Would like to hear the views of the others on this matter.
Cheers.
On 14 October 2015 at 22:44, Kamaljeet <kamaljeetmaini@xxxxxxxxxxx> wrote:



Hello,I have run into a corner case issue while using Paho Android service. Here is the scenario:
1) Connect Android device to a Wi-Fi Access Point2) Using Paho Android service, connect and subscribe to a topic3) Verify that service can receive messages on the topic4) Disconnect Internet cable from Wi-Fi router. There is no change in connection between Android and Wi-Fi AP.5) Reconnect the Internet cable to the Wi-Fi router.6) Send a message on the topic. The message is NOT received. This continues to happen until the next keepalive interval.
It seems that when Wi-Fi AP loses Internet connection, this tears down the connection between service and broker but service is not notified of this by the Android system. This is because there is no change in Wi-Fi connectivity. Even when Wi-Fi AP connects back to Internet, the Android service has no connection to the broker. Only when the keepalive interval expires and service tries to communicate with the broker, it finds out that connection is broken and it tries to reestablish the connection.
Have you come access this scenario? Is there a potential solution or upcoming fix for this?
I have a keepalive of 10 minutes, so this causes missed MQTT messages for up to 10 minutes.
Thanks,Kamaljeet


_______________________________________________

paho-dev mailing list

paho-dev@xxxxxxxxxxx

To change your delivery options, retrieve your password, or unsubscribe from this list, visit

https://dev.eclipse.org/mailman/listinfo/paho-dev



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/paho-dev/attachments/20151015/248da5f7/attachment.html>

------------------------------

Message: 2
Date: Thu, 15 Oct 2015 20:22:03 +0200
From: Andrew Kenny <andrew.kenny01@xxxxxxxxx>
To: General development discussions for paho project
        <paho-dev@xxxxxxxxxxx>
Subject: Re: [paho-dev] Compiling Paho C Client
Message-ID:
        <CAGAiS4L5Dk+-7o=H1KyzMp7dccqUJKseF0hv5Buvhatu8196aA@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

Hi

Where is the paho-mqtt3c library? Not on git?

Regards
Andrew

On Thu, Oct 15, 2015 at 3:47 PM, Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxxx
> wrote:

> Hi,
>
> when you run the make file, it shows what commands are used to build the
> libraries and samples:
>
> cc -o build/output/samples/pubsync src/samples/pubsync.c -lpaho-mqtt3c  -I
> src -lpthread -L build/output
>
> for pubsync.c for instance.  Your errors are caused by not linking to the
> Paho library.
>
>
> Ian
>
> On 10/15/2015 04:12 AM, Satish V Madala wrote:
>
> Hi folks!
>
> I have been using MQTT since many days and for the first time i have to
> use a C/C++ Client. Probably, there is a compiling problem with the present
> code at paho git (or i miss something):
>
>
> git clone http://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.c.git
> cd org.eclipse.paho.mqtt.c.git
> make
>
> make install
>
> Make Install was succesful and I have tried the sample in src/samples
> directory.
>
>
>> *gcc pubsync.c  *
>> */tmp/ccbSD877.o: In function `main': *
>> *pubsync.c:(.text+0xf2): undefined reference to `MQTTClient_create' *
>> *pubsync.c:(.text+0x116): undefined reference to `MQTTClient_connect' *
>> *pubsync.c:(.text+0x191): undefined reference to
>> `MQTTClient_publishMessage' *
>> *pubsync.c:(.text+0x1d1): undefined reference to
>> `MQTTClient_waitForCompletion' *
>> *pubsync.c:(.text+0x202): undefined reference to `MQTTClient_disconnect' *
>> *pubsync.c:(.text+0x211): undefined reference to `MQTTClient_destroy' **collect2:
>> error: ld returned 1 exit status*
>
> I got these errors. Any compilation document would be really helpful.
>
> Am running 15.04 Ubuntu. Was running mosquitto_clients and python clients
> on the machine.
> (Actually, I want C++ implementation, which would require this C Client
> installed. )
>
> It seems like libraries aren't linked, but isn't it supposed to be linked
> by default when i make installed?
>
> Thanks!
> With Regards,
>
> *Satish V Madala *| Techpreneur & FOSS Evangelist
>
>
> _______________________________________________
> paho-dev mailing listpaho-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visithttps://dev.eclipse.org/mailman/listinfo/paho-dev
>
>
> --
> Ian Craggs                          icraggs@xxxxxxxxxx                 IBM United Kingdom
> Paho Project Lead; Committer on Mosquitto
>
>
>
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/paho-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/paho-dev/attachments/20151015/f3f9fc34/attachment.html>

------------------------------

Message: 3
Date: Thu, 15 Oct 2015 22:37:35 +0000
From: "Mike Tran" <miketran@xxxxxxxxxx>
To: paho-dev@xxxxxxxxxxx
Subject: Re: [paho-dev] Compiling Paho C Client
Message-ID: <201510152237.t9FMbhbB023003@xxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/paho-dev/attachments/20151015/7c23bda6/attachment.html>

------------------------------

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

End of paho-dev Digest, Vol 46, Issue 20
****************************************



Back to the top