rust-lang/cc-rs

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

chyyran opened this issue · 1 comments

#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.

Thanks I've reverted and published a new release