Thread overview
rpath on macOS
Nov 12, 2019
cartland
Nov 12, 2019
cartland
Nov 12, 2019
kinke
(SOLVED) Re: rpath on macOS
Nov 12, 2019
cartland
November 12, 2019
On Linux, this works:

------------
name "myapp"
targetType "executable"
description "A minimal D application."
authors "bartland"
copyright "Copyright © 2019, bartland"
license "public"
libs "mylib"
lflags "-L../../_cache/" "-rpath=../../_cache/"
------------

but on macOS with DMD or LDC this gives

------------
ld: unknown option: -rpath=../../_cache/"
------------


November 12, 2019
On Tuesday, 12 November 2019 at 10:19:30 UTC, cartland wrote:
> On Linux, this works:
>
> ------------
> *snip*
>
> but on macOS with DMD or LDC this gives
>
> ------------
> ld: unknown option: -rpath=../../_cache/"
> ------------

Currently I do this post build to get the binary to work:

----------
install_name_tool -add_rpath "../../_cache" myapp
----------

November 12, 2019
On Tuesday, 12 November 2019 at 10:19:30 UTC, cartland wrote:
> but on macOS with DMD or LDC this gives
>
> ------------
> ld: unknown option: -rpath=../../_cache/"
> ------------

IIRC, Mac's ld64 linker requires 2 separated args: "-rpath" "../../_cache/"
November 12, 2019
On Tuesday, 12 November 2019 at 10:44:07 UTC, kinke wrote:
> On Tuesday, 12 November 2019 at 10:19:30 UTC, cartland wrote:
>> but on macOS with DMD or LDC this gives
>>
>> ------------
>> ld: unknown option: -rpath=../../_cache/"
>> ------------
>
> IIRC, Mac's ld64 linker requires 2 separated args: "-rpath" "../../_cache/"

Brilliant.

lflags "-L../../_cache/" "-rpath" "../../_cache/"

also works on Linux.

Thanks