shared library name resolution

Mike - EMAIL IGNORED m_d_berger_1900 at yahoo.com
Fri Jun 16 15:42:33 UTC 2006


On Fri, 16 Jun 2006 07:26:37 -0700, Ulrich Drepper wrote:

> Rex Dieter wrote:
> 
>> Avoid unresolved symbols in your shared library.  Instead of
>> linking -lrt -lssl in your apps, add -lrt -lssl when creating the library,
>> ie, instead of
>> gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJ)
>> do
>> gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJ) -lrt -lssl
> 
> 
> Or use
> 
>   gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJ) -Wl,--as-needed -lrt -lssl
> -Wl,--no-as-needed
> 
> 
> (one long line).
> 
> -- 
> Ulrich Drepper Red Hat, Inc. 444 Castro St Mountain View, CA

The first suggestion works, but the second does not:

   LIBS = -Wl,--as-needed -lrt -lssl -Wl,--no-as-needed

   $(TARGET): $(OBJS)
      gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

Wherein do I err?
Thanks,
Mike.







More information about the fedora-list mailing list