qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leticia <reyt...@gmail.com>
Subject Re: Installing broker on Ubuntu - Strict aliasing problem
Date Tue, 17 Nov 2009 11:02:56 GMT
the latest one.

On Mon, Nov 16, 2009 at 8:18 PM, Alan Conway <aconway@redhat.com> wrote:

> On 11/16/2009 07:26 AM, Leticia wrote:
>
>> Hello there!
>>
>> I have a problem doing the make all part of the installation process of
>> qpid
>> broker. It looks exactly  like this:
>>
>> qpid/sys/posix/SystemInfo.cpp: In function 'void qpid::sys::SystemInfo::
>> getLocalIpAddresses(uint16_t, std::vector<qpid::Address,
>> std::allocator<qpid::Address>  >&)':
>> qpid/sys/posix/SystemInfo.cpp:73: error: dereferencing pointer 'sin' does
>> break strict-aliasing rules
>> qpid/sys/posix/SystemInfo.cpp:72: note: initialized from here
>>
>> And the code lines correspond to these ones:
>>
>> void SystemInfo::getLocalIpAddresses (uint16_t port, std::vector<Address>
>> &addrList) {
>>     int s = socket (PF_INET, SOCK_STREAM, 0);
>>     for (int i=1;;i++) {
>>         struct ifreq ifr;
>>         ifr.ifr_ifindex = i;
>>         if (::ioctl (s, SIOCGIFNAME,&ifr)<  0)
>>             break;
>>         /* now ifr.ifr_name is set */
>>         if (::ioctl (s, SIOCGIFADDR,&ifr)<  0)
>>             continue;
>>         struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr;
>> /*Line 72*/
>>         string addr(inet_ntoa(sin->sin_addr)); /*Line 73 breaking rules!
>> */
>>         if (addr != LOCALHOST)
>>             addrList.push_back(TcpAddress(addr, port));
>>     }
>>     if (addrList.empty()) {
>>         addrList.push_back(TcpAddress(LOCALHOST, port));
>>     }
>>     close (s);
>> }
>>
>>
>> I'm using the latest Ubuntu version and gcc 4.4 and I'd like to solve this
>> problem without going back to the previous version of the compiler.
>>
>> Could you please help me?
>>
>
> You can try compiling with -fno-strict-aliasing, do:
>  ./configure CXXFLAGS="-fno-strict-aliasing"
>
> That's not the ideal solution I'd rather fix the code to compile cleanly.
> What version of gcc are you using?
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message