www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - rpath on macOS

reply cartland <example example.com> writes:
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/"
------------
Nov 12 2019
next sibling parent cartland <example example.com> writes:
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 ----------
Nov 12 2019
prev sibling parent reply kinke <kinke gmx.net> writes:
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/"
Nov 12 2019
parent cartland <example example.com> writes:
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
Nov 12 2019