You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Grzegorz Swiatek <g....@teles.at> on 2011/02/01 17:53:00 UTC

Unknown protocol: tcp

Hi,

I want to start my simple C++ program (see below) that tries to open a 
connection and get following output:
open connection
Unknown protocol: tcp (qpid/client/Connector.cpp:52)

I used static libraries with following link settings:
-static -lqpidclient -static -lqpidcommon -lm -lrt -ldl -luuid -lpthread 
-lboost_filesystem -lboost_program_options

My environment is:
- CentOS 5.5 /x86_64
- gcc/g++ 4.1.2
- qpid 0.8

What is wrong here?

Regards,
Grzegorz


#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>

#include <iostream>


using namespace qpid::client;
  	
using namespace std;

int main(int ragc, char** argv) {


	Connection connection;

	try {

		cout << "open connection" << endl;
		connection.open("127.0.0.1", 5672);

		cout << "new session" << endl;

		Session session = connection.newSession();

		cout << "close connection" << endl;

		connection.close();
	} catch (const std::exception& ex) {
		cerr << ex.what() << endl;
	}
}

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Unknown protocol: tcp

Posted by joseluis <jl...@gmail.com>.
http://apache-qpid-users.2158936.n2.nabble.com/compiling-statically-qpid-td7029304.html

--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Unknown-protocol-tcp-tp5981768p7029542.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Unknown protocol: tcp

Posted by Grzegorz Swiatek <g....@teles.at>.
Hi,

you are right, the problem disappears when I use dynamic libraries.

Unfortunately for our project I must use static libraries.
Is there some specific order for the libraries required if I want build 
own C++ client application?
Is there another way to ensure that the protocol registration is done at 
proper time (e.g. I invoke some special method/function before I try to 
open a connection)?

Regards,
Grzegorz

On 2/1/2011 6:51 PM, Gordon Sim wrote:
> On 02/01/2011 04:53 PM, Grzegorz Swiatek wrote:
>> Hi,
>>
>> I want to start my simple C++ program (see below) that tries to open a
>> connection and get following output:
>> open connection
>> Unknown protocol: tcp (qpid/client/Connector.cpp:52)
>>
>> I used static libraries with following link settings:
>> -static -lqpidclient -static -lqpidcommon -lm -lrt -ldl -luuid -lpthread
>> -lboost_filesystem -lboost_program_options
>>
>> My environment is:
>> - CentOS 5.5 /x86_64
>> - gcc/g++ 4.1.2
>> - qpid 0.8
>>
>> What is wrong here?
>
> My guess would be that the static linking is the issue. The protocol
> registration relies on static initialisers at present and the static
> linking may result in the wrong order of execution.
>
> Are you able to link dynamically to verify that theory?
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Unknown protocol: tcp

Posted by Gordon Sim <gs...@redhat.com>.
On 02/01/2011 04:53 PM, Grzegorz Swiatek wrote:
> Hi,
>
> I want to start my simple C++ program (see below) that tries to open a
> connection and get following output:
> open connection
> Unknown protocol: tcp (qpid/client/Connector.cpp:52)
>
> I used static libraries with following link settings:
> -static -lqpidclient -static -lqpidcommon -lm -lrt -ldl -luuid -lpthread
> -lboost_filesystem -lboost_program_options
>
> My environment is:
> - CentOS 5.5 /x86_64
> - gcc/g++ 4.1.2
> - qpid 0.8
>
> What is wrong here?

My guess would be that the static linking is the issue. The protocol 
registration relies on static initialisers at present and the static 
linking may result in the wrong order of execution.

Are you able to link dynamically to verify that theory?

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org