How do I create Apache ActiveMQ-CPP (and APR) on Windows?

I am trying to get some functionality written in C ++ to communicate with Apache ActiveMQ (which uses JMS natively) located on a Linux machine. To make this connection, I tried to set up Apache ActiveMQ-CPP on my Windows 7 machine (development machine), but I am currently facing some major issues.

As far as I understand, ActiveMQ-CPP has a dependency on Apache Portable Runtime / APR as mentioned here . My problem is that I cannot even create APRs and therefore not start with ActiveMQ-CPP. I followed this writing guide setting up parallel directories, renaming version names to standard names, and changing the startup project to libaprutil (using dynamic link libraries), but with no luck. When creating an APR solution, only 13 out of 27 projects succeed. I also tried to create a solution with a static aprutil project as a startup, but without any improvement.

The solution is to provide more compatibility with Visual Studio 6, so I suspect using Visual Studio 2010 is responsible for my problems. While updating the project should be possible (as stated in the APR documentation), I have a few (I think) missing dependencies in the project after using the update assistant and trying to build the whole solution afterwards, see 1st screendump. Many of the errors relate to the iconv_module.obj ( error LNK2019: unresolved external symbol xxx referenced in function _iconv_getpath C:\work\apr-iconv\iconv_module.obj

) file , which, as you can see from the bottom tip, is in C:\work\apr-iconv

. Instead, the file is in different subfolders, depending on the build format (I chose "Release" and "Win32"), but I'm not sure if this is really a problem or not.

I should mention that I am completely new to C ++ and only have very limited experience with C, so maybe these are just dependencies that I don't understand to link manually ... if you open that file and look at it the functions mentioned in the error messages, however, there is something clearly wrong with the code, so maybe they are not dependencies, see both screendumps.

In terms of possible solutions, I was asked to try to build each project at a time by hand, rather than the entire solution at once, so libraries that do not depend on anything are created first, and so on. However, this was not successful.

Also one should use command line to create project which did the trick for some people ( link ). "msdev" seems to be replaced with "devenv" in newer versions of Visual Studio, but despite this, the assembly still complains about "msdev not found" after using find and replace ... maybe not the best solution, Yes?

While looking for posts with similar problems, I'm certainly not alone, but unfortunately none of the suggested solutions worked for me. Some of the posts I looked at were: Compile Apache APR on Windows and ActiveMQ-CPP and Visual Studio 2003 .

Do you have any experience with creating APR with newer versions of Visual Studio or the command line on Windows? Or more importantly, getting ActiveMQ-CPP to work on Windows?

Screenshots:

+3


source to share


2 answers


I was able to create APR via command line using instructions in README.txt in ActiveMQ source.

6.2.1 Library APR.

APR is provided in its original form only from the Apache Software Foundation. You will need to build the library from source by downloading the latest version from:

http://apr.apache.org/

      

At the time of this writing, the latest version is v1.5.2 and is recommended because its build support files work with Visual Studio 2010 tools.

APR is built from the command line using the provided Make files. When building the library, you need to make sure that you are in the correct environment to create the desired architectural assemblies (x64 or win32). You can open the Command Prompt which is fixed by shortcuts on the Start Menu in Visual Studio (for example Visual Studio 2010 / Visual Studio Tools / Visual Studio x64 win 64 Command Prompt

Once you are on the right command line, navigate to the directory where the APR source is located (ex: C: \ APR), then run the build for the library to create the desired ARCH build.

For a 32-bit library that is installed in the appropriate mailing directory:

nmake -f Makefile.win ARCH="Win32 Release" PREFIX=C:\dist\APR\x64 buildall install clean

      

and for 64-bit build of the library use this command.

nmake -f Makefile.win ARCH="x64 Release" PREFIX=C:\dist\APR\x64 buildall install clean

      



I did:

Go to Start> All Programs> Visual Studio 2017> Visual Studio Tools and launch Developer Command Prompt . Navigate from there to the location of your APR source and run the appropriate command. On 64-bit Windows 7, I rannmake -f Makefile.win ARCH="Win32 Release" PREFIX=C:\dist\APR\x64 buildall install clean

More general:

Go to Start> All Programs> Visual Studio 2017> Visual Studio Tools> VC and run a Command Prompt for the architecture you are building for. Then continue with the steps above using nmake -f Makefile.win ARCH="x64 Release" PREFIX=C:\dist\APR\x64 buildall install clean

if you are building for x64 architecture.

This is successfully built by APR and placed in C:\dist\APR\x64




Then in Visual Studio make sure to C:\dist\APR\x64\includes

link to Additional Inclusions in the project properties.

  • Right click your project and select Properties
  • Expand Configuration Properties
  • Expand C / C ++
  • Select "General"
  • Edit additional Include directories and add C: \ path \ to \ APR \ arch \ include
  • Apply changes

Building at this stage results in the following errors (see solution below):

1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C2039: 'auto_ptr': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\sstream(13): note: see declaration of 'std'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C2143: syntax error: missing ';' before '<'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C2238: unexpected token(s) preceding ';'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(55): error C2614: 'decaf::internal::security::SRNGData': illegal member initialization: 'random' is not a base or member
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(74): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(74): error C2228: left of '.reset' must have class/struct/union
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(96): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(96): error C2228: left of '.get' must have class/struct/union
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(99): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(99): error C2227: left of '->setSeed' must point to class/struct/union/generic type
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(117): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(117): error C2228: left of '.get' must have class/struct/union
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(140): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(140): error C2227: left of '->nextBytes' must point to class/struct/union/generic type

      

To enable editing errors activemq-cpp-library-3.9.4\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp

by adding #include <memory>

a.

The post-addition recovery above includes the results of a successful ActiveMQ build.

Conclusion to: activemq-cpp-library-3.9.4\vs2010-build\\Win32\Release\libactivemq-cpp.lib

+1


source


I created an ActiveMQ for Visual Studio 2012 pro using APR available in the NuGet repository. In my case, some configuration is unrelated. Simply fixing the path in the Reference section of the project properties will make it work.



I was unable to run the unit test.

0


source







All Articles