#6147: message_queue sample fails to compile in 32-bit
--------------------------------------------+-------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.48.0 | Severity: Regression
Keywords: |
--------------------------------------------+-------------------------------
Just upgraded to 1.48.
On OS X I compile the sample program with: gcc -I <blah path to
boost>/include -arch i386 main.cpp
and it fails with "....boost/interprocess/ipc/message_queue.hpp:330:
error: no matching function for call to ‘get_rounded_size(long unsigned
int, const unsigned int&)’"
It's the MQ creation line that fails. If I build for x64, it compiles
successfully. The source is:
#define BOOST_DATE_TIME_NO_LIB
#include <boost/interprocess/ipc/message_queue.hpp>
#include <iostream>
#include <vector>
using namespace boost::interprocess;
int main ()
{
try{
//Erase previous message queue
message_queue::remove("message_queue");
//Create a message_queue.
message_queue mq
(create_only //only create
,"message_queue" //name
,100 //max message number
,sizeof(int) //max message size
);
//Send 100 numbers
for(int i = 0; i < 100; ++i){
mq.send(&i, sizeof(i), 0);
}
}
catch(interprocess_exception &ex){
std::cout << ex.what() << std::endl;
return 1;
}
return 0;
}
#6147: message_queue sample fails to compile in 32-bit
---------------------------------------------+------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.48.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------------------+------------------------------
Comment (by Graham Perks <graham@…>):
Retry code formatting. It's the sample from the boost docs.
{{{
#define BOOST_DATE_TIME_NO_LIB
#include <boost/interprocess/ipc/message_queue.hpp>
#include <iostream>
#include <vector>
using namespace boost::interprocess;
int main ()
{
try{
//Erase previous message queue
message_queue::remove("message_queue");
//Create a message_queue.
message_queue mq
(create_only //only create
,"message_queue" //name
,100 //max message number
,sizeof(int) //max message size
);
//Send 100 numbers
for(int i = 0; i < 100; ++i){
mq.send(&i, sizeof(i), 0);
}
}
catch(interprocess_exception &ex){
std::cout << ex.what() << std::endl;
return 1;
}
return 0;
}
}}}
#6147: message_queue sample fails to compile in 32-bit
---------------------------------------------+------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.48.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------------------+------------------------------
Comment (by Graham Perks <graham@…>):
If anyone has a workaround for this, it would be much appreciated.
#6147: message_queue sample fails to compile in 32-bit
---------------------------------------------+------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.48.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------------------+------------------------------
Comment (by Graham Perks <graham@…>):
I was able to workaround this by adding this code before including the
boost headers. It adds a second type to the get_rounded_size template.
{{{
namespace boost {
namespace interprocess {
namespace ipcdetail {
//Rounds "orig_size" by excess to round_to bytes
template<class SizeType, class ST2>
inline SizeType get_rounded_size(SizeType orig_size, ST2
round_to)
{
return ((orig_size-1)/round_to+1)*round_to;
}
}
}
}
}}}
#6147: message_queue sample fails to compile in 32-bit
---------------------------------------------+------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.48.0 | Severity: Regression
Resolution: fixed | Keywords:
---------------------------------------------+------------------------------
Changes (by igaztanaga):
* status: new => closed
* resolution: => fixed
Comment:
Fixed in trunk and release branches adding
#include <boost/interprocess/detail/utilities.hpp>
to message queue header.
#6147: message_queue sample fails to compile in 32-bit
---------------------------------------------+------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.50.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------------------+------------------------------
Changes (by moala@…):
* status: closed => reopened
* version: Boost 1.48.0 => Boost 1.50.0
* resolution: fixed =>
Comment:
Still not fixed in i386 GCC 4.2 xcode 3.2.6 (only works in x86_64) even
with this
#include <boost/interprocess/detail/utilities.hpp>
inclusion in message_queue.hpp in boost 1.50 (macports) (with Mac OS X
10.6 SDK / deployment target 10.5).
Graham Perks's workaround allows compiling.
#6147: message_queue sample fails to compile in 32-bit
---------------------------------------------+------------------------------
Reporter: Graham Perks <graham@…> | Owner: igaztanaga
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.50.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------------------+------------------------------
Comment (by igaztanaga):
I successfully compiled your test using trunk code in Mac OS 10.6.2 with
GCC:
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
can you check the bug is fixed?