Really simple:
Copying that file from the latest stable x64 SDCC release into the same folder as sdcc.exe also doesn't work, the application will report error 0xc000007b then. This DLL seems from something with the MinGW compiler per https://stackoverflow.com/questions/12921911/mingw-libgcc-s-sjlj-1-dll-is-missing.
Looking at https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html I think including the DLL would make more sense than linking the GCC lib statically (apparently some C++ exceptions do not work with static linking).
Hmm. sdcc/support/scripts/sdcc.nsi has this line:
That looks like it is meant for this DLL?
Trying to build a 32-bit Windows snapshot locally, on my laptop, I ran into multiple issues, including this line:
So something tries to get the DLL from the directory where GCC 12 had it, but my system has GCC 13 installed, and the DLL is actually in
/usr/lib/gcc/i686-w64-mingw32/13-win32/libgcc_s_dw2-1.dll. While that is a different DLL, I wonder is the problems could be related.Last edit: Philipp Klaus Krause 2023-12-20
I can reproduce the bug using current x86 snapshots installer on Windows 10 in a VM. Attemptiong to run sdcc results in error messages about both
libgcc_s_sjlj-1.dllandlibstdc++-6.dll. On the other hand, I see no such problem when using the current amd64 snapshots installer.@epetrich, AFAIK you are running the hardware that builds the 32-Bit snapshots. Do you have an idea what could have caused this problem?
I had to upgrade to a much newer cross compiler earlier this year to support a change that needed some newer C/C++ feature. Previously the 32-bit Windows snapshot was built with mingw32 and the 64-bit Windows snapshot was built with mingw-w64. Currently both are built with mingw-w64. I'm a little surprised that the regression tests are running without including these DLLs in the SDCC installer package, but I suppose wine is finding them somehow.
To fix this, it looks like we will need to update sdcc-build/lib/bootstrap.mk to copy the DLLs into bin for both 32-bit and 64-bit rather than just 64-bit and then similarly update sdcc/support/scripts/sdcc.nsi to install the DLLs for both 32-bit and 64-bit rather than just 64-bit.
Thanks. I made the change to bootstrap.mk in the nativecrosstools branch, and it works for me there for the .zip (I see the .dll files in there). I haven't gotten further yet.
But this might still be good enough to try the fix in trunk next.
Last edit: Philipp Klaus Krause 2024-01-09
@epetrich: What would be the path to the two DLLs to use in bootstrap.mk for trunk?
I think ideally we would parse the output from calling gcc with --print-search-dirs to find its library directory so that it works with any version, but for now I have manually copied the .dll files to where bootstrap.mk is expecting them.
Parsing sounds like a good long-term solution. Would be helpful for the nativecrosstools branch (and to reduce the diff between trunk and nativecrosstools): currently the paths there are hardcoded for GCC 13 on Debian, and won't even work with GCC 12 on Debian.
An alternative might be to link statically. Anyway, I asked the MinGW people about the recommended approach: https://sourceforge.net/p/mingw-w64/support-requests/195/
Using the current nativecrosstools branch, I was able to build a 32-bit Windows snapshot and installer last night, and run the regression tests. Today I verified that that installer installs SDCC in a Windows 10 VM, and it works for me there without any errors about missing DLLs.
I've tried to make a fix in [r14600]. Though I'm not sure about the source paths in sdcc-build/lib/bootstrap.mk (previous testing was in the nativecrosstools branch, which by its nature needs to have different source paths there).
Related
Commit: [r14600]
Looks like current snapshots 32-bit installers do install libgcc_s_sjlj-1.dll, so this is fixed now.