From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; compaq) Description of problem: When I create a shared library on a V6.x system and then link against it on a V7.x system, I get the following warning: warning:type and size of dynamic symbol `__gmon_start__' are not defined Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. On a Redhat 6.2 system, I create a library: cxal.zko.dec.com> g++ -shared -o libfoo.so foo.cxx 2. On a Red Hat 7.2 system, I create my program: cxalrh72> g++ -o tt m.cxx -L. -lfoo /usr/bin/ld: warning: type and size of dynamic symbol `__gmon_start__' are not d efined cxalrh72> setenv LD_LIBRARY_PATH . cxalrh72> ./tt foo constructed As an alternative, I can just link with "ld" and the message goes away, but of course none of my constructors are envoked: 1. Create library on V6.2 using ld: cxal.zko.dec.com> g++ -c foo.cxx cxal.zko.dec.com> ld -shared -o libfoo.so foo.o 2. Link on V7.2 system: cxalrh72> g++ -o tt m.cxx -L. -lfoo cxalrh72> ./tt Here is the source used in the example: cxal.zko.dec.com> cat foo.cxx #include <stdio.h> class foo { public: foo() { printf("foo constructed\n"); } }; foo x; cxal.zko.dec.com> cat m.cxx void main() { } 2. 3. Additional info: This looks similar to: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=19680 My guess is that in this case, X was being built on the old system and/or with an old glibc or gcc.
The warning message just comes from RHL 6.2 not setting .type/.size on __gmon_start__. glibc is compatible, but C++ is not binary compatible between 6.2 and 7.x, so you really cannot do this and expect things to work. There is compat-egcs-c++ if you need to link against 6.x C++ libraries.