Previous Up Next

Chapter 23  Lessons Learned

23.1  Introduction

This appendix focuses on providing tips, tricks, and advice submitted by Babel/SIDL users. We have generally provided the information verbatim.

23.2  Compilation Consistency is Key

Steve Smith, 24 September 2001

Basically “be consistent” is the biggest lesson we found.

When compiling C++ codes, you may have conflicts if you use different compile options. Under KCC we found -no_exceptions caused problems if parts were compiled with/without the flag. There are most likely other compile flags which turn features on/off which would cause similar problems. This caused a core dump immediately when core file was loaded. This is somewhat obvious but if you are linking together several different codes from a variety of developers you need to examine the compile flags very carefully. This problem is probably more likely with C++ due to the greater number of code generation options (e. g. RTTI, exceptions etc).

A much more subtle problem occurred when we had a C shared library which called functions in a C++ shared library. We initially used gcc to create the C shared library and KCC to create the C++ shared library. The application would core dump when a dynamic cast was attempted. This was solved by using the cc compiler wrapper that is part of the KCC distribution (which uses the native cc). So you need to be aware of not only what is in your .so and how it is compiled but all the .so’s that you are using.

If you have several versions of a library, say during a debugging process, make sure you are using the correct versions of things. The ldd command is very useful for making sure you getting the shared libraries that you think you should be linking to. Along these lines, keep your LD_LIBRARY_PATH as simple as possible when debugging.

In retrospect this does not look like a large number of problems, but figuring out the second problem took a long time since I focused on how the C++ library was being created rather than where the real problem was being introduced. It wasn’t until after I had exhausted a long list of other potential conflicts that I started messing with the C library compilation.

Previous Up Next