Skip to content

building dynamic libraries on mac sets id/name for linker to something questionable #121674

Open
@vmchale

Description

@vmchale

If I build a "cdylib", it tells the linker that the library is located in the target/release directory.

Here is the output for otool -l:

Load command 4
          cmd LC_ID_DYLIB
      cmdsize 96
         name /Users/vanessa/dev/rust/forks/regex/target/release/deps/librure.dylib (offset 24)
   time stamp 1 Wed Dec 31 19:00:01 1969
      current version 0.0.0
compatibility version 0.0.0

This means I can't install the shared library by copying the .dylib to /usr/local/lib; I have to run install_name_tool on the build result before distributing.

I think building a library should set the name to something like @rpath/librure.dylib

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesO-macosOperating system: macOST-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions