Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1231 breaks cargo publish for a cdylib on MSVC #1236

Closed
chyyran opened this issue Oct 6, 2024 · 1 comment · Fixed by #1237
Closed

#1231 breaks cargo publish for a cdylib on MSVC #1236

chyyran opened this issue Oct 6, 2024 · 1 comment · Fixed by #1237

Comments

@chyyran
Copy link

chyyran commented Oct 6, 2024

#1231 breaks cargo publish on windows when linking to C libraries

Repro here: https://github.com/SnowflakePowered/librashader/tree/repro-cc-no-limit

When running on nightly Rust

cargo publish -p librashader-capi --dry-run --allow-dirty --verbose

Linkage fails with

LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
libglslang_sys-c1204bbd1e384f2e.rlib(84710f0e4e4917c9-propagateNoContraction.o) : error LNK2001: unresolved external symbol __imp__invalid_parameter␍
libglslang_sys-c1204bbd1e384f2e.rlib(84710f0e4e4917c9-InfoSink.o) : error LNK2001: unresolved external symbol __imp__CrtDbgReport␍
  msvcprtd.lib(locale0_implib.obj) : error LNK2019: unresolved external symbol __imp__free_dbg referenced in function "public: static void __cdecl std::_Fac_node::operator delete(void *)" (??3_Fac_node@std@@SAXPEAX@Z)␍
          msvcprtd.lib(filesystem.obj) : error LNK2001: unresolved external symbol __imp__free_dbg␍
          msvcprtd.lib(locale0_implib.obj) : error LNK2019: unresolved external symbol __imp__malloc_dbg referenced in function "public: static void * __cdecl std::_Fac_node::operator new(unsigned __int64)" (??2_Fac_node@std@@SAPEAX_K@Z)␍
          msvcprtd.lib(filesystem.obj) : error LNK2001: unresolved external symbol __imp__malloc_dbg␍
          F:\coding\librashader\target\package\librashader-capi-0.5.0\target\debug\deps\librashader_capi.dll : fatal error LNK1120: 5 unresolved externals␍

and so on and so-forth.

This is not seen when cc is pinned to =1.1.25.

I was also able to reproduce on stable rust with the RUSTC_BOOSTRAP=1 trick.

@chyyran chyyran changed the title error LNK2001: unresolved external symbol __imp__CrtDbgReport on cc 1.1.24 and later when running cargo publish for a cdylib https://github.com/rust-lang/cc-rs/pull/1231 breaks cargo publish for a cdylib Oct 6, 2024
@chyyran chyyran changed the title https://github.com/rust-lang/cc-rs/pull/1231 breaks cargo publish for a cdylib #1231 breaks cargo publish for a cdylib Oct 6, 2024
@chyyran chyyran changed the title #1231 breaks cargo publish for a cdylib #1231 breaks cargo publish for a cdylib on MSVC Oct 6, 2024
@NobodyXu
Copy link
Collaborator

NobodyXu commented Oct 6, 2024

Thanks I've reverted and published a new release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants