pvsneslib icon indicating copy to clipboard operation
pvsneslib copied to clipboard

[Windows] Missing dependencies for constify, smconv and snesbrr

Open StarWolf3000 opened this issue 3 years ago • 8 comments

It seems the toolchain binary devkitsnes/bin/constify and the devkitsnes/tools/smconv and devkitsnes/tools/snesbrr are dynamically-linked to the C++ stdlib and GCC runtime on Windows. All three complain about a missing libgcc_s_sjlj-1.dll and libstdc++-6.dll.

There are two solutions for this:

  1. Ship the DLLs with the release.
  2. Statically build constify, smconv and snesbrr using -static, -static-libstdc++ and -static-libgcc flags.

StarWolf3000 avatar Jul 30 '22 10:07 StarWolf3000

Thanks for reporting it. We will probably use the solution 2. Do you have a tool which show it or you saw it in sources?

RetroAntho avatar Aug 02 '22 17:08 RetroAntho

It is Windows itself that complains about the missing DLLs for all three mentioned tools (following messages in german, as that's my system's UI language):

C++ stdlib: image

GCC runtime: image

I came across the issue, when I tried to build the example projects.

StarWolf3000 avatar Aug 03 '22 09:08 StarWolf3000

Ok, i cannot reproduce the issue on my computer but i found someone to do it :) The behavior is really strange because i compiled same sources (without modifying CFLAGS) and it seems to be already static in my case (the executable files are 10 times bigger) and it works on the "test" computer. I guess it is an option somewhere but i did not find it !

I updated the makefiles and pushed it on develop branch :

https://github.com/alekmaul/pvsneslib/commit/e9c8d46484abf2e6096d2a2277726ad995c9be98

but i need @alekmaul 's help to see if it solve the issue. Can you please build constify, smconv and snesbrr with these changes and provide us executable ?

RetroAntho avatar Aug 03 '22 20:08 RetroAntho

Hello,

i do not have anymore a way to test new binaries with static libs for now. @alekmaul built it from develop branch (with the same machine used for release version), these one should be correct but i have a doubt because of binaries size seems too small.

Can you please test it and tells me if you still have the issue ? staticLink.zip

RetroAntho avatar Aug 16 '22 18:08 RetroAntho

constify no longer complains, but smconv and snesbrr still do (those two are the same file sizes as the release build).

As per your commit, you only added -static, but for smconv and snesbrr to work properly without shipping the dlls, the flags require -static-libstdc++ -static-libgcc too.

StarWolf3000 avatar Aug 20 '22 09:08 StarWolf3000

hmmm, i had not well understood how works static and i thought it was applied for all kind of libraries used. Thank you for your feedback, i will update it soon

RetroAntho avatar Aug 20 '22 18:08 RetroAntho

The regular -static flag works for the majority of libraries, provided their static files are available on the environment hosting the compiler (if they're missing, the linker will complain about unresolved symbols), but the C/C++ Standard Library and the compiler's own runtime are exempt from this and are always dynamically linked by default (at least that's what GCC does). That's why you need to explicitely specify the static inclusion of the standard library and the compiler runtime.

StarWolf3000 avatar Aug 20 '22 18:08 StarWolf3000

Your explanations are clear but i still have an issue ! I am concentrating on smconv only for now as it contains only one makefile :

https://github.com/alekmaul/pvsneslib/commit/b6923217a4e83c9e7b34a6762821bf699bd9255b smconv_static

@alekmaul rebuilt the dev branch with this commit and we see in output the -static-libstdc++ -static-libgcc flags. The binary size has not changed and the issue with DLL is still the same.

I checked quickly on forums and the only track i saw it is because the user do not use CXXFLAGS but CFLAGS. In our case, CXXFLAGS is based on CFLAGS so it is not applicable

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

I need to investigate further but as i cannot reproduce the issue on my computer when compiling sources, it is slower :(

RetroAntho avatar Aug 21 '22 10:08 RetroAntho

Hello, It has been fixed with this commit : https://github.com/alekmaul/pvsneslib/commit/9ece4371010a5e9a5c0b206f2b5b781faf97d863 Tested and approved, everything now works !

RetroAntho avatar Feb 26 '23 19:02 RetroAntho