Reason for rpath usage on arm64

Ken Cunningham ken.cunningham.webuse at gmail.com
Mon May 30 06:01:40 UTC 2022


ah yes, your question was arm64-specific so that led to the gcc assumption.

the way the cmake PG configures cmake breaks testing on all archs and
systems.

this comes up regularly, eg

https://lists.macports.org/pipermail/macports-dev/2021-September/043754.html

Perhaps it might beneficially be changed.

K

On Sun, May 29, 2022 at 22:17 Ryan Schmidt <ryandesign at macports.org> wrote:

> On May 24, 2022, at 10:22, Ken Cunningham wrote:
> >
> >> Does anyone know why things seem to be using rpath on arm64 builds
> >
> > Basically, it comes down to the fact that Apple has disallowed
> DYLD_LIBRARY_PATH to work on newer systems.
>
> > So gcc is installing it’s libraries with the @rpath linkage
>
> So you're talking about how SIP doesn't pass DYLD_LIBRARY_PATH to child
> processes on El Capitan and later, which breaks the gcc test suite,
> therefore gcc now uses @rpath at build time to fix the problem, and does
> not rewrite the install_names at install time, therefore things with @rpath
> get installed.
>
> That's not the issue that prompted me to start this thread.
>
> When I enabled the test suite for the portmidi port (which does not use
> gcc)...
>
>
> https://github.com/macports/macports-ports/commit/fd447d210e1814b1303c5013d088efa673470d77
>
> ...I set "DYLD_LIBRARY_PATH=." in test.env so that the executable it runs
> can find the library it just built. This worked fine on Catalina x86_64 but
> on Big Sur arm64 it failed with the error message:
>
> dyld: Library not loaded: @rpath/libportmidi.2.dylib
>   Referenced from: /path/to/portmidi/work/build/./qtest
>   Reason: image not found
>
> Seeing "@rpath" in this error message, I added
> "-DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF" to configure.args (to counteract
> "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" set by the cmake portgroup) and the
> problem went away.
>
> Perhaps placing the blame on @rpath was the wrong conclusion, since I now
> realize that the install_names also use @rpath on Catalina x86_64 yet the
> test worked there. I just don't understand then why disabling @rpath on Big
> Sur arm64 made the tests work.
>
> It seemed to me like I was seeing a lot of @rpath-related issues
> especially on arm64 lately, and this latest instance with portmidi prompted
> me to ask about it, but it could be that most or all of the other instances
> were related to the gcc situation you already discussed. I know we are
> using a different branch of gcc for arm64 so maybe that explains why the
> @rpath-related changes you mentioned only appear on arm64 so far.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220529/4358fd91/attachment.htm>


More information about the macports-dev mailing list