I’m running Solaris, so it’s possible that this is specific to running GCC on Solaris. If I use GCC to generate a shared object, and then run nm on it to see undefined symbols, there will always be a reference to main:
[624] | 0| 0|NOTY |GLOB |0 |UNDEF |main
If I manually generate the same shared object using ld, the reference to main doesn’t exist. If I run nm on the system libraries in /usr/lib, none of them appear to have references to main. Only shared libraries I compile myself with GCC.
Apps compiled against these shared libraries work fine and without errors. But I still don’t understand why the reference to main is there in the first place. Any clues?
You forgot the
-sharedoption in yourgcclink command line.EDIT: and you forgot
-fPICoption on your compile command line (which is causing all the relocation errors at link time).If you still get relocation errors with
-fPICon all compile lines, then you should rebuild all the archive libraries which you link in (libtoast_datetime,libtoast_assert, etc.) with-fPICas well.