Re: [PATCH] rust: query the compiler for dylib path

Masahiro Yamada
2024-10-14T18:46:03Z

On Sun, Oct 13, 2024 at 8:53 AM Tamir Duberstein <tamird@gmail.com> wrote:
>
> On Sat, Oct 12, 2024 at 7:37 PM Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> wrote:
> > But before we do that, is there a way to force `rustc` to load current
> > name (or trick it to do so, say, with a symlink)? i.e. can it be
> > reasonably done out-of-tree without changes to the filename?
>
> I think the problem is that rustc produces .dylib on macOS rather than
> it _looking_ for .dylib; the path to the .so is fully specified in the
> rustc invocation of the targets that depend on it. I don't know of a way
> to control the file suffix externally.

rustc ignores --emit=link=rust/libmacro.so
and produces rust/libmacro.dylib.

Is this a bug in rustc?

> A symlink would possibly work (unless rustc refuses to load anything
> other than .dylib on macOS for whatever reason), but wouldn't be very
> ergonomic; you'd have to create the symlink blind or else run the build
> system until it fails, then create the symlink, and then run the build
> again.

--
Best Regards
Masahiro Yamada