[ome-users] Good news! OmeroCpp built (at last!)

Mario Valle mvalle at cscs.ch
Tue Dec 9 14:10:42 GMT 2008


The long journey has reached a successful end. Now I'm able to run the small test client
from: http://trac.openmicroscopy.org.uk/omero/wiki/OmeroCpp
Here I want to list the steps done and the problems still open. Hopefully it will be 
useful to someone.

My machine is Mac OSX 10.4 PPC

1) Check if you have Xcode version 2.2 installed, otherwise upgrade it (Go to Apple 
Developer Connect connect.apple.com and go to Developer Transition Kit to download it).

2) Download source from zeroc.com
http://www.zeroc.com/download/Ice/3.3/Ice-3.3.0.tar.gz
and unpack it somewhere (in my case /Ice-3.3.0).

3) Download 3rd party software needed to build Ice
http://www.zeroc.com/download/Ice/3.3/ThirdParty-Sources-3.3.0.tar.gz

4) Build the 3rd party programs you do not have already installed on the machine. For 
Berkeley DB remember to configure with --enable-cxx (otherwise you don't have the needed 
db_cxx.h header)

5) The IceC++ installation instructions are: /Ice-3.3.0/cpp/INSTALL.MACOSX

6) Edit /Ice-3.3.0/cpp/config/Make.rules and change the *_HOME variables to point to the 
installation directories for the various 3rd party packages.

7) Return to /Ice-3.3.0/cpp and execute make

8) Wait. There are warnings during compilation, but no error.

9) The installation notes suggest to run "make test" to run the tests. What the notes 
don't say is that the test programs are not built by default. If you want to run the 
tests, go to /Ice-3.3.0/cpp/test and do "make". Then cd .. and "make test".

10) Remember to update PATH adding /Ice-3.3.0/cpp/bin and DYLD_LIBRARY_PATH adding 
/Ice-3.3.0/cpp/lib

11) Go to /Ice-3.3.0/py edit config/Make.rules and add the definition of your python home 
(around line 50)

12) Execute make

13) Take the OMERO sources
svn co http://cvs.openmicroscopy.org.uk/svn/omero/trunk omero

14) Setup the sources
cd omero
java omero setup
Then when suggested, edit etc/local.properties and put the same values you have in the 
production omero installation.

15) Enable Ice in the sources omero/etc/local.properties setting:
no.ice=false
ice.home=/Ice-3.3.0/cpp

16) Go to the omero directory (under the sources) and execute
java omero build-cpp
If it fails building libomero_client.dylib implement the following workaround
(* Josh, don't forget... *):
cd components/tools/OmeroCpp
Create a symbolik link to /Ice-3.3.0 called Ice-3.3.0
execute: ant tools-build
then redo building: cd ../../..; java omero build-cpp

17) Setup OmeroGrid
Make sure the following env variables are defined:
PYTHONPATH=/Ice-3.3.0/py/python

18) Start OmeroGrid server (from the production installation)
cd /omero-Beta3.2/omero
bin/omero admin start
bin/omero admin deploy (only the first time it is needed)

19) Compile a small client. The makefile should be modified from the published one:
Makefile
========
# Where the OMERO source distribution was installed (and OmeroCpp built)
OMERO_DIST?=/omero-cpp/omero/dist

# Where the Ice lib/ and include/ directories are to be found
ICE_HOME?=/Ice-3.3.0/cpp

INCLUDES=-I$(OMERO_DIST)/include -I$(ICE_HOME)/include

LIBS=-L$(OMERO_DIST)/lib -L$(ICE_HOME)/lib \
      -lIce -lIceUtil -lGlacier2 -lOMERO_client -lstdc++

LIBPATH=$(DYLD_LIBRARY_PATH):$(ICE_HOME)/lib:$(OMERO_DIST)/lib

.PHONY: clean run

all: client

client.o: client.cpp
         $(CXX) $(CXXFLAGS) -c -o $@ $< $(INCLUDES)

client: client.o
         $(CXX) -o $@ $^ $(LIBS)

run:  client
         DYLD_LIBRARY_PATH="$(LIBPATH)" ./client --Ice.Config=../omero/dist/etc/ice.config

run2:  client
         DYLD_LIBRARY_PATH="$(LIBPATH)" ./client --omero.host=localhost --omero.user=xxxx 
--omero.pass=yyyy

run3:  client
         DYLD_LIBRARY_PATH="$(LIBPATH)" ./client --omero.host=localhost --omero.user=xxxx 
--omero.pass=yyyy --Ice.Trace.Network=3 --Ice.Trace.Protocol=1 --Ice.Trace.Locator=1

clean:
         rm -f client *.o *~ core

client.cpp
==========
#include <omero/client.h>
#include <iostream>

using namespace std;

/*
  * Pass "--Ice.Config=your_config_file" to the executable, or
  * set the ICE_CONFIG environment variable.
  */
int main(int argc, char* argv[])
{
     omero::client omero(argc, argv);
     omero::api::ServiceFactoryPrx sf = omero.createSession();
     sf->closeOnDestroy();

     // IAdmin is responsible for all user/group creation, password changing, etc.
     omero::api::IAdminPrx  admin  = omero.getSession()->getAdminService();

     // Who you are logged in as.
     cout << admin->getEventContext()->userName << endl;

     return 0;
}

20) Edit ../omero/dist/etc/ice.config putting your username and password and set the omero 
host.

21) Run the example with:
make run

If complains that there is missing omero.host then edit the Makefile target run2 and 
execute: make run2 (* developers, don't forget *)

If you want to diagnose connection problems then edit the Makefile target run3 and 
execute: make run3

That's it. Now I start studying how to create a more useful client.

Ciao!
	mario



Mario Valle wrote:
> At last good news: the compilation of OmeroCpp on Mac OSX succeeded!
> (remember, the last roadblock is the missing '/' in the library search path)
> 
> Now I'm trying to run the small test client from: 
> http://trac.openmicroscopy.org.uk/omero/wiki/OmeroCpp
> 
> Beside a Makefile error (OMERO_common library does not exist) it build without problems.
> 
> The problem is now with the run:
> 
> 1) Seems it is not able to read ../omero/etc/ice.config The error is:
> error while parsing endpoint `tcp  -p 4063 -h <"omero.host" not set >'
> but omero.host IS set inside ../omero/etc/ice.config
> 
> 2) So I run it as:
> DYLD_LIBRARY_PATH="$(LIBPATH)" ./client --Ice.Config=../omero/etc/ice.config 
> --omero.host=localhost --omero.user=yyyy --omero.pass=xxxx
> 
> Now the error is:
> terminate called after throwing an instance of 'Ice::ConnectionRefusedException'
>    what():  Network.cpp:1218: Ice::ConnectionRefusedException:
> connection refused: Connection refused
> 
> Is there any "SetVerbose" or magic env variable to diagnose this problem?
> The omero server is up and running. Is there any other process necessary? I don't' know 
> Ice at all, maybe something here is missing.
> 
> Thanks for the help!
> 			mario
> 

-- 
Ing. Mario Valle
Data Analysis Group                              | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82



More information about the ome-users mailing list