Some crate wants libstdc++-6.dll. Which one?

I'm cross-compiling from Linux to Windows, target x86_64-pc-windows-gnu. (I want to make a Windows version, but don't have a current Windows machine or dev environment.) This works surprisingly well. But some external crate, probably one with C++ code, is looking for libstdc++-6.dll at run time.

Running under Wine 7.0 I get

00d0:err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\tmp\\scenetest.exe") not found
00d0:err:module:LdrInitializeThunk Importing dlls for L"Z:\\tmp\\scenetest.exe" failed, status c0000135

which is reasonable enough. If I provide that DLL, the program runs But I'd like to find out what crate didn't statically link that library and get it fixed to link it statically, so I don't have to mess with finding and distributing DLLs. Cargo.lock isn't helpful; this was pulled in by something that has a C++ component, so it's not a dependency Cargo sees.

Is there some tool for this?

1 Like

You could look around in target/x86_64-pc-windows-gnu/debug/build. Every crate with a build script has a directory here with the output of the build script. This should contain which libraries it links against. Alternatively you could try looking in Cargo.lock which crates depend on the cc crate and check those for c++ dependencies.

2 Likes

Ah! Found it in the build script logs. Didn't realize Cargo kept all those logs. Thanks.