dtolnay / inventory

Typed distributed plugin registration
Apache License 2.0
944 stars 43 forks source link

Not working fine on macOS #52

Open 50U10FCA7 opened 1 year ago

50U10FCA7 commented 1 year ago

Inventory stops collecting anything on MacOS in some cases. Think it's because of fn pointers inside plugin, but not sure.

Here's MRE (see GitHub actions): https://github.com/50U10FCA7/inventory_issue_test

tyranron commented 1 year ago

Expected output: https://github.com/50U10FCA7/inventory_issue_test/runs/8248537681?check_suite_focus=true#step:4:26 Actual output on MacOS: https://github.com/50U10FCA7/inventory_issue_test/runs/8248538107?check_suite_focus=true#step:4:26

trevyn commented 1 year ago

This works for me with:

[profile.dev]
incremental = false

[profile.release]
codegen-units = 1
50U10FCA7 commented 1 year ago

Still unclear why this problem appears, but linkme crate has the same issue: https://github.com/50U10FCA7/inventory_issue_test/runs/8305029222?check_suite_focus=true#step:4:24

Looks like problem with linkage on macOS.

Bajix commented 1 year ago

It would be an appropriate use of panic to include static assertions that check the CARGOPROFILE_CODEGEN_UNITS env variable as a way of making sure that should inventory be a dependency this is not overlooked.

inferiorhumanorgans commented 1 year ago
[profile.dev]
incremental = false

[profile.release]
codegen-units = 1

This is definitely not working for me. Only some instances of inventory::submit! are being picked up even if I blow away the target directory.

$ uname -rv
uname -rv
18.7.0 Darwin Kernel Version 18.7.0: Tue Jun 22 19:37:08 PDT 2021; root:xnu-4903.278.70~1/RELEASE_X86_64
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-530
BUILD 18:57:17 Dec 13 2019
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 11.0.0, (clang-1100.0.33.17) (static support for 23, runtime is 23)
TAPI support using: Apple TAPI version 11.0.0 (tapi-1100.0.11)
$ rustc --version
rustc 1.72.0-nightly (fe7454bf4 2023-06-19)
$ grep -A2 -F '[profile.' Cargo.toml
[profile.dev]
incremental = false

--
[profile.release]
codegen-units = 1

$
Ragora commented 10 months ago

Been trying to figure this out as well, but I haven't ever gotten it to report anything but empty results so far. Also, the codegen units fix doesn't seem to work in my case either.

velvia commented 2 months ago

I saw this problem for 0.3 and the following did fix it for me, at least for tests.

[profile.dev]
incremental = false