Page 1 of 1

Building a Client with OmeroCpp

PostPosted: Wed Apr 06, 2011 11:02 pm
by jtzucker
Hi,

I was wondering if anyone had some pointers to help me get started?
I would like to build a small Omero Client Application in C++ (on Windows) to talk to my Omero Server.
Initially I just wanted to see if I could connect (session) and retrieve an image (pixels).
I have been going over all the documentation on Building Clients, APIs, etc... but do not quite understand the build/development process.
In particular
1. Do I need to rebuild a OmeroCpp.dll, .lib ?
2. What includes do I need to include? Location? Ice?
3. What libs need to be included? Location?
Any help would be much appreciated !!

Re: Building a Client with OmeroCpp

PostPosted: Thu Apr 07, 2011 9:16 am
by jmoore
Hi,

jtzucker wrote:I was wondering if anyone had some pointers to help me get started?
I would like to build a small Omero Client Application in C++ (on Windows) to talk to my Omero Server.
Initially I just wanted to see if I could connect (session) and retrieve an image (pixels).
I have been going over all the documentation on Building Clients, APIs, etc... but do not quite understand the build/development process.


Which pages have you found so far? Did you find http://trac.openmicroscopy.org.uk/ome/wiki/OmeroCpp? I've updated it with the new URLs for downloads (see below). Obviously, it's more Linux-based, but we'd be interested to work with you to have exemplary Windows info.

In particular
1. Do I need to rebuild a OmeroCpp.dll, .lib ?


Possibly. We have a continuous build running on a 32bit version of Windows Server 2003. Binaries from that build are linked from the OmeroCpp wiki page. The latest build is #467:
http://hudson.openmicroscopy.org.uk/job/OMERO-trunk-components/component=cpp,label=x86-windows/467/

What platform are you using? If it varies significantly, you'll need to build yourself. You can do this from the console via the following:

Code: Select all
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
set ICE_HOME=c:\Ice-3.3.1-VC90
python build.py clean
python build.py build-all


which is taken from http://git.openmicroscopy.org/?p=ome.git;a=blob;f=docs/hudson/OMERO-cpp.bat;h=6fb8e6d7aeb17012809089fae133859762b09f66;hb=refs/heads/develop which is used by Hudson/Jenkins to perform the integration builds.

2. What includes do I need to include? Location? Ice?


The console build (above; using "python build.py" or "build.bat") should find the Ice includes for you.

However, under the section "Notes for Visual Studio users", there's an alternative. You can run:
Code: Select all
build -f components\tools\OmeroCpp\build.xml msproj

to generate an VS project file which should include all includes and libraries for you.

3. What libs need to be included? Location?


The same should hold for the libraries. But to be explicit: You need the /lib and /include directores from your %ICE_HOME%. If you are on a 64 bit system, add /lib/x64 before you add /lib. The libraries which you need to link against are "Ice", "IceUtil", and "Glacier2", which is defined in the scons environment at http://git.openmicroscopy.org/?p=ome.git;a=blob;f=components/blitz/blitz_tools.py;h=ad9b9e523c4e433a1e480644cee1d9f7fd9c32b9;hb=refs/heads/develop#l333. Note: if you are building a debug version, you need to append a "d" to each of those library names.

Once you've built or got the binaries working, then you can go back to following the instructions on OmeroCpp to get a simple Hello World working. If you come up with an NMake or similar build, it'd be great if you could share it back. If you use VS, then you'll need to add the "omero_client" library to your list of libs, and add the OMERO include/ directory to your includes.

Hope that helps. If not, please let us know.

Cheers,
~Josh

Re: Building a Client with OmeroCpp

PostPosted: Thu Apr 07, 2011 5:28 pm
by jtzucker
Wow Josh Thanks so much for all the great info !!
Before I get too deep though I wanted to get your advice on some tooling.
Currently our development makes heavy use of C++ where we need to stay platform independent.
We develop on Windows and use the MinGW development environment actually with Qt (Nokia).
Do you have any additional pointers / will I be able to compile/link everything I need under the MinGW environment?

Thanks!!
Jay

Re: Building a Client with OmeroCpp

PostPosted: Thu Apr 07, 2011 7:38 pm
by jmoore
Hi Jay,

jtzucker wrote:Wow Josh Thanks so much for all the great info !!


No problem. C++ users need all the help they can get! ;)

Before I get too deep though I wanted to get your advice on some tooling.
Currently our development makes heavy use of C++ where we need to stay platform independent.
We develop on Windows and use the MinGW development environment actually with Qt (Nokia).
Do you have any additional pointers / will I be able to compile/link everything I need under the MinGW environment?


But your not going to make that easy on me, are you? Ok. ZeroC who makes the remoting framework we use (Ice), does not (yet) support mingw. There official statement is available at http://www.zeroc.com/forums/help-center/985-does-ice-support-mingw.html (and an older warning at http://www.zeroc.com/forums/help-center/2066-ice-qt-opensource-windows.html)

That being said, there are people who have done so, see
http://lists.trolltech.com/qt-interest/2008-09/thread00030-0.html or http://www.elpauer.org/?p=238, albeit with the 3.2.1 version rather than 3.3.1.

Though I haven't tried it myself, I'm optimistic that it can be done, and very interested in seeing it in action. I won't have time to really dig in until after our 4.3 release (May/June), but will certainly help where I can if this is something you're willing to take on. (For example, once Ice is compiling via the Makefiles as described by Matthew, OMERO's use of Scons will need to be modified to use mingw akin to http://www.scons.org/wiki/SconstructShortMingwWin32).

Thanks!!
Jay


Gladly.
~Josh

Re: Building a Client with OmeroCpp

PostPosted: Mon May 02, 2011 1:05 pm
by jmoore
A quick update, Jay.

One of the Ice forum members on the mingw thread has attached a patch (albeit for 3.4.1):

http://www.zeroc.com/forums/help-center/985-does-ice-support-mingw-2.html#post23343

in case you would like to try it out against 3.3.1.

Cheers,
~Josh