[Issue 17216] OSX: `rdmd -shared -oflibfun.dylib fun.d` and otool -L libfun.dylib points to libfun.dylib.tmp

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 7 06:44:23 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17216

Andrew <andrew at ugh.net.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew at ugh.net.au

--- Comment #3 from Andrew <andrew at ugh.net.au> ---
This is still occurring in HEAD.

When rdmd calls dmd it gives an output name that ends with ".tmp"
(https://github.com/dlang/tools/blob/master/rdmd.d#L483-L488) and that is what
dmd passes to clang (used for linking under OSX). As the install_name arg isn't
given thats what ends up being the install_name of the dylib and hence this
problem.

There are two obvious ways of fixing it - get dmd to call clang with
install_name or run install_name_tool after building.

Neither seem obviously great - IIUC rdmd doesn't know its building a shared
library so doesn't know install_name is important. dmd does know but isn't
aware that rdmd has passed it a dummy output name that will later get mv'ed to
the final name.

I don't yet know if rdmd _needs_ to use the .tmp then mv trick but I'm guessing
its there to cope with some sort of error on some platform - if that could be
avoided the problem would disappear. Anything else seems to require rdmd
learning about shared libraries under OSX or dmd having more awareness of rdmd.

--


More information about the Digitalmars-d-bugs mailing list