How to set RPATH and RUNPATH with GCC/LD?

前端 未结 2 527
栀梦
栀梦 2020-12-05 21:15

I recently encountered this problem after an upgrade of the system: using the GCC -Wl,-rpath= option works differently than before.

I used it to set the

2条回答
  •  长情又很酷
    2020-12-05 21:46

    The project GNU Binutils (containing GNU linker (ld)) is not at the origin of this change of behaviour, but Debian (2016)1, and Gentoo (2013!)2.

    According to gentoo commit from Mike Frysinger on Jan 2013 :

    "The "new" dtags options have been around for 14+ years now, so for Linux and GNU targets, enable them by default."

    This change are not well received 3, 4, 5, as RUNPATH and RPATH have "undocumented behaviour difference"... Surprisingly this changes is now applied on Debian stable.

    The problem is that using RUNPATH, leads to unpredictable problems... But mainly just works . From wikipedia :

    The ld dynamic linker does not search DT_RUNPATH locations for transitive dependencies, unlike DT_RPATH.

提交回复
热议问题