[rabbitmq-discuss] rabbitmq-c (librabbizmq) works only partially.

David Wragg david at rabbitmq.com
Mon Nov 28 14:33:54 GMT 2011


TZHA <sophiewenxizhang at googlemail.com> writes:
> The error I got with the latest version of rabbitmq-c was:
>
> "A buffer overrun has occurred in z_rabbitmq_client_consumer.exe which
> has corrupted the program's internal state. Press Break to debug the
> program or Continue to terminate the program.

This is because you are trying to use a mingw build of librabbitmq from
Visual Studio.  This doesn't work because VS and gcc disagree about x86
calling conventions.  As a result, the program crashes is a way that VS
diagnoses as a buffer overrun.

> I started VS 2010 debugging on a consumer project (c++) which uses the
> rabbitmq-c c api.
>
> I guess I finally found out at least the reason for my previous
> error.  I used a c++ wrapper (amqpcpp  - modified) which calls
> amqp_simple_rpc to implement the consumer, which then caused the error
> (but runs correctly with DEBUG).
>
> I modified the code to use amqp_basic_consume (following the
> consumer.c), the c++ consumer  application works now.
>
> However, I still have the buffer overrun problem with the latest
> version. I used MinGW to build the package.  Do you whether there is a
> guide/readme for cmake build?

There are some brief instructions in the rabbitmq-c README.  In more
detail:

Install cmake (from <http://cmake.org/>).  Then open up a command
prompt, create a build directory, and from there run cmake with the path
to the rabbitmq-c source directory:

Z:\>cd tmp

Z:\tmp>mkdir rabbitmq-c-build

Z:\tmp>cd rabbitmq-c-build

Z:\tmp\rabbitmq-c-build>cmake ..\rabbitmq-c
-- Building for: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PythonInterp: C:/Python27/python.exe (found version "2.7")
-- Using amqp_codegen.py in Z:/tmp/rabbitmq-codegen
-- Configuring done
-- Generating done
-- Build files have been written to: Z:/tmp/rabbitmq-c-build

Then open up the rabbitmq-c.sln file in VS, and build.

-- 
David Wragg
Staff Engineer, RabbitMQ
VMware, Inc.


More information about the rabbitmq-discuss mailing list