Milton Woods wrote:Here's what I get (for the findFit symbols):
The linker doesn't seem to be the problem.
Consider as an example the file src/TextCache.C which declares a global method 'findFit'. When compiled using gcc-3.2 on Redhat 9, the 'nm' program shows that the object file includes two 'findFit' symbols:
00000366 t _GLOBAL__I__ZN9TextCache7findFitEP6Bufferi 00000000 T _ZN9TextCache7findFitEP6Bufferi
Both symbols are stored in the text section of the object file. When the same source file is compiled using gcc-3.3.1 on Cygwin, the object file includes three 'findFit' symbols:
U __GLOBAL__D__ZN9TextCache7findFitEP6Bufferi U __GLOBAL__I__ZN9TextCache7findFitEP6Bufferi 00000000 T __ZN9TextCache7findFitEP6Bufferi
The two global symbols are marked as undefined.
Perhaps there is a bug in gcc-cygwin, or else the syntax used to
define 'findFit' as global is incorrect or outdated. Can anyone
suggest other reasons or possible workarounds?
I find this very odd. 'findFit' is a member function of the TextClass class. How can it not be found? Baffling!
Can you use the '--line-numbers' option to 'nm'?
$ nm --demangle --line-numbers TextCache.o | grep findFit
00000464 t _GLOBAL__I__ZN9TextCache7findFitEP6Bufferi /home/angus/lyx/13x/build-xforms/src/../../src/bufferlist.h:38
00000000 T TextCache::findFit(Buffer*, int) /home/angus/lyx/13x/build-xforms/src/../../src/TextCache.C:75
U _GLOBAL__D__ZN9TextCache7findFitEP6Bufferi /usr/include/c++/3.3.1/bits/stl_tree.h:0 U _GLOBAL__I__ZN9TextCache7findFitEP6Bufferi /usr/include/c++/3.3.1/bits/stl_tree.h:0 00000000 T TextCache::findFit(Buffer*, int)
I haven't forgotten the line information for the last symbol - there isn't any.
I have tried to isolate which lines of the source or header files are causing the problem. If I replace 'Buffer *' with 'char' on lines 36,69,71 of src/bufferlist.h, recompile TextCache.C and run nm, I get the following (for the findFit symbols):
000003d8 t _GLOBAL__D__ZN9TextCache7findFitEP6Bufferi /usr/include/c++/3.3.1/bits/stl_map.h:120 000003bc t _GLOBAL__I__ZN9TextCache7findFitEP6Bufferi /usr/include/c++/3.3.1/bits/stl_map.h:120 00000000 T TextCache::findFit(Buffer*, int)
It also works with other basic types like int. However, it doesn't work if I use 'char*' or 'Buffer'.
Any ideas about what to do next?
Cheers, Milton Woods.