linker - Why does compiling a shared object with GCC always result in undefined references to main? -


I'm running Solaris, so it is possible that it is specific to running GCC on Solaris if I share a GCC Use to create objects, and then run nm to see the undefined symbols, then there will always be a reference to the main:

  [624] | 0 | 0 | NOTY | GLOB | 0 | UNDEF | Main  

If I manually generate the same shared object using LD, then the main reference does not exist. If I run nm in the / usr / lib system library None of them shows the context of the main, only the shared library compiling themselves with the GCC.

The applications compiled against these shared libraries work well and without any errors, but I still do not understand why there is any clue why the reference to the main location is in the first place?

You have forgotten the -shared option in your GCC < / Code> link command line.

EDIT: And you have forgotten the option ( -fPIC ) on your compile command line (which is causing all transit errors on link time).

If you still get the transfer errors with all the configurable lines with the -fPIC , then you should rebuild all the collection libraries that you ( libtoast_datetime Also with -fPIC , , libtoast_assert , etc.).


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -