[ros-users] Linker --as-needed

Daniel Stonier d.stonier at gmail.com
Thu Aug 5 23:08:43 UTC 2010


On 6 August 2010 00:38, Brian Gerkey <gerkey at willowgarage.com> wrote:

> That is interesting.  I wasn't familiar with that flag.  We clearly
> have a lot of overlinking in ROS.  Daniel, have you seen any problems
> with using that flag?
>
> I've created a ticket to consider adding it as a default link flag:
> https://code.ros.org/trac/ros/ticket/2946 .
>
>          brian.
>

I had to fix a couple of linkages that went missing in my ros libraries when
a dependency didn't get linked in (namely rt and pthreads) but haven't had
any other problems. Mind you, haven't been testing this for very long! I'm
enabling it as a default in our packages for the moment for testing.

Fedora and now gentoo (which is how I found out about it) are setting this
as a default in their builds now (some others as well). Mind you, just
because someone else is doing it is no justification, but it does mean its
seeing a bit of testing out in the wild and isn't one of those really
obscure settings with rather unknown effects.


> On Thu, Aug 5, 2010 at 12:49 AM, Radu Bogdan Rusu <rusu at willowgarage.com>
> wrote:
> > Interesting. I found some discussions about this at:
> > * http://wiki.mandriva.com/en/Overlinking /
> http://wiki.mandriva.com/en/Underlinking
> > * http://www.gentoo.org/proj/en/qa/asneeded.xml
> >
> > Cheers,
> > Radu.
> >
> > On 08/04/2010 11:02 PM, Daniel Stonier wrote:
> >>
> >> I didn't know about this linker option until yesterday...turns out to be
> >> really useful. Setting -Wl,--as-needed in the ROS_LINK_FLAGS variable
> >>   in rosconfig.cmake, we can drop any unused linking dependencies.
> >>
> >> We've been bashing back and forth here at work on how to build our
> >> packages - ideally we want to be able to build a regular algorithm
> >> library or device driver with no ros connections so we can use in
> >> standalone projects, and also an rosnode lib around that, but
> >> unfortunately the manifest drags in all the ros dependencies into the
> >> algorithm library/device driver. Up until now, we were splitting into
> >> separate packages when we really needed to, but is a bit awkward. There
> >> are other use cases too, simple debugging utilities alongside the main
> >> library package, or full blown gui tools.
> >>
> >> This solves all of that. Would there be any reason/disadvantage to
> >> having it as a default link flag for gcc in the ros? It's not a big
> >> issue as its easy enough to enable globally yourself, but it's something
> >> that could just as easily be 'under the hood' so to speak.
> >>
> >> --
> >> Phone : +82-10-5400-3296 (010-5400-3296)
> >> Home: http://snorriheim.dnsdojo.com/
> >> Yujin Robot: http://www.yujinrobot.com/
> >> Embedded Control Libraries:
> http://snorriheim.dnsdojo.com/redmine/wiki/ecl
> >>
> >>
> >>
> >> _______________________________________________
> >> ros-users mailing list
> >> ros-users at code.ros.org
> >> https://code.ros.org/mailman/listinfo/ros-users
> >
> > --
> > | Radu Bogdan Rusu | http://rbrusu.com/
> > _______________________________________________
> > ros-users mailing list
> > ros-users at code.ros.org
> > https://code.ros.org/mailman/listinfo/ros-users
> >
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



-- 
Phone : +82-10-5400-3296 (010-5400-3296)
Home: http://snorriheim.dnsdojo.com/
Yujin Robot: http://www.yujinrobot.com/
Embedded Control Libraries: http://snorriheim.dnsdojo.com/redmine/wiki/ecl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100806/3a557485/attachment-0004.html>


More information about the ros-users mailing list