0
Answered

Build OpenICE from source

Rado 10 years ago in OpenICE updated by anonymous 8 years ago 8
Hello,

We are trying to use openICE for integration with several different medical devices at the University of Pennsylvania and the surrounding hospitals. We are able to use the demo app that is pre-built but we are having trouble building the code from source.

We have tested this on Windows, Mac and Ubuntu and get to the same stage. We are able to import the project using the eclipse plugin for gradle but there are some bits that don't compile. In particular, the main problem is that the ice environment that is defined in a few idl files is not correctly recognized by the java files (so the most common error is "ice cannot be resolved to a type"). As far as I understand, some java code has to be generated by these specifications but we cannot get eclipse to do it.

Is there some other pluging that we need to install? Or do you think there is some other problem?

Thanks,
Rado
OpenICE
GOOD, I'M SATISFIED
Satisfaction mark by Rado 10 years ago
+1
Hi Rado,

Thank you very much for contacting us. I'm sorry that you've run into problems with the software. I hope the following information is useful but please don't hesitate to ask further questions.

If you'd like to develop your own software to interact with the OpenICE system you can utilize our prebuilt libraries. An example of how to do this is available at https://github.com/mdpnp/hello-openice. Those libraries are hosted on our artifactory instance at build.openice.info.

If you would like to build all the software yourself from our SourceForge that is also possible. The generation of java code from IDL definitions has been automated in the build process but it sounds as if that target is not being executed in your environment. Most of the code generated from IDL into java will be placed into an "ice" package. The easiest way to ensure all the appropriate code gets generated is to execute from the command line (from the root of the git repo):
./gradlew :interop-lab:demo-apps

If you would like to get more granular the key sub-project for generating java code from IDL is :data-types:x73-idl-rti-dds. (This project is a dependency of the demo-apps project I previously mentioned). From the command line you can trigger code generation directly with
./gradlew :data-types:x73-idl-rti-dds:build

If you’d prefer to stay within the eclipse environment you can highlight the x73-idl-rti-dds project from the Package Explorer, from the ‘External Tools’ menu select “Run As” “Gradle Build…”, and enter “build” for the task name.

Thank you and let us know if you have any more questions,
Jeff Plourde
+1
Hi Jeff,

Thanks for the reply, I was now able to build the project in Eclipse! I wonder if there is any way to automate this process and avoid this extra step.

BTW, openICE only compiles in Java 7. If you use Java 8, there are some inheritance problems in the newly generated classes, some of which implement two different interfaces.

Thanks,
Rado
Hi Rado,

Thanks for the feedback regarding java 8.  I realize the end of life for java 7 is looming and we'll make the switch eventually but for now the gradle build is set up to explicitly use Java 7.  In fact if you generate eclipse projects using the eclipse plugin for gradle they should have the appropriate language and byte code compliance settings in place.

That said I wonder if you have more information about the build errors you received under java 8?  Implementing multiple interfaces doesn't sound like it should be a compile error.  Also I just tried changing compliance settings to Java in the root build.gradle and didn't experience any errors so I'm especially curious.

The build has been streamlined as much as possible for purposes of continuous integration but I agree getting the projects loaded into IDEs could be streamlined further.  If you have any suggestions we'd be happy to make changes.  As of right now we've had the most success with the eclipse plugin for gradle "./gradlew eclipse" and then importing projects into Eclipse from there.

Thanks!
Jeff
Hi Jeff,

My Eclipse is set up to use java 8 by default and, after generating those new java files, I got a lot of errors "duplicate methods named spliterator" (e.g., AlarmSettings class in the ice package, which implements two interfaces that I'm guessing have a method with the same name). When I switched back to Java 7, the problem disappeared.

As for the build process, I'm not a gradle expert, so I can't give great advice. Maybe the fix is as simple as including a "use plugin eclipse" somewhere, I don't know. But since the manual step was just to build that x73-idl project again, I'm guessing this can be included in some of the scripts.

Thanks again for all the help!

Rado
Answered
Hi Rado,

Glad I could help.  Let us know if you have any other questions.

Thank you
Jeff