public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* compiler and linker flags
@ 2000-10-25 16:36 Robert Schweikert
  2000-10-26  0:19 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Schweikert @ 2000-10-25 16:36 UTC (permalink / raw)
  To: gcc-help

I have a compile/link problem and would like to figure out what kinds of
flags I need to use to get the code to compile. Here is the problem.

I have lots of code, C++, some will go into shared libraries, some is
used for executables. At compile time however I do not know which .C
file will be part of a shared library and which file will be part of a
shared library. This means I have to compile all code with the same
compiler flags. Currently I am using fPIC when compiling the code. This
works for the shared libraries, i.e. they compile and link. However,
when I try to link executables I get lots of errors, unresolved symbols
mostly. The trick here is that at link time I know which object files
become shared libraries and which ones are to become executables.

Thus what I am looking for is either a way to get executables to link
when the fPIC option was used at compile time, or a way to compile
without fPIC but still make the shared libraries work. At link time I
can do extra tricks if necessary to get the appropriate symbols
exported, I know the symbols I am looking for and in which object code
they are.

Any ideas, help is appreciated.

Thanks,
Robert

--
Robert Schweikert                      MAY THE SOURCE BE WITH YOU
rjschwei@mindspring.com                         LINUX



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: compiler and linker flags
  2000-10-25 16:36 compiler and linker flags Robert Schweikert
@ 2000-10-26  0:19 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2000-10-26  0:19 UTC (permalink / raw)
  To: Robert Schweikert; +Cc: gcc-help

On Oct 25, 2000, Robert Schweikert <rjschwei@mindspring.com> wrote:

> This means I have to compile all code with the same compiler
> flags. Currently I am using fPIC when compiling the code. This works
> for the shared libraries, i.e. they compile and link. However, when
> I try to link executables I get lots of errors, unresolved symbols
> mostly.

This is supposed to work.  Could you please come up with an example we
can use to reproduce the problem you're observing?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-10-26  0:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-25 16:36 compiler and linker flags Robert Schweikert
2000-10-26  0:19 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).