Skip to content

Project fails to link when using dylibs without the -Zshare-generics flag #67276

Closed
@alexkornitzer

Description

@alexkornitzer

I have opened this issue under the recommendation of @michaelwoerister who has been helping me track down the linking issues I have been having with dylibs.

As reported in previous issues which I piggybacked, the example provided will build on 1.36.0 but nothing newer: https://github.com/AlexKornitzer/dylib-errors/tree/error/consul

To quote @michaelwoerister, the -Zshare-generics flag has potentially been identified as the root cause:

OK, with the latest version of the error/consul branch I can reproduce. Interestingly the error goes away when compiling with RUSTFLAGS=-Zshare-generics=no.
The error also isn't present for me when compiling with cargo build --release (which is expected because --release implies -Zshare-generics=no)

Hence when building with --release the linking issues go away.

This is potentially related to #64319 and was originally being tracked in #64340.

Metadata

Metadata

Labels

A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions