Closed ottozumkeller closed 2 years ago
Hi Otto
The last four library files you are linking to contain the statically linked C/C++ runtime, which is a very big piece of code. Crinkler is not designed to work for such big executables.
Leaving out the runtime libraries and removing the /NODEFAULTLIB option (to implicitly link to msvcrt.dll
) shows that your code is close to being able to get all of its necessary runtime support functions from msvcrt.dll
. Just three missing:
MAIN.OBJ: _main: error LNK: Cannot find symbol '___acrt_iob_func'
MAIN.OBJ: _printf: error LNK: Cannot find symbol '___acrt_iob_func'
MAIN.OBJ: _scanf_s: error LNK: Cannot find symbol '___acrt_iob_func'
MAIN.OBJ: __vfprintf_l: error LNK: Cannot find symbol '___stdio_common_vfprintf'
MAIN.OBJ: __vfscanf_s_l: error LNK: Cannot find symbol '___stdio_common_vfscanf'
You might be able to get rid of those dependencies by tweaking your code and experimenting with MSVC options.
perhaps something like https://github.com/Chuyu-Team/VC-LTL or https://github.com/Chuyu-Team/VC-LTL5 if you still need some of that runtime.
In fact, I have found a solution myself: Probably my mistake was that I used VS 2022, so I installed VS 2019. And then everything worked perfectly. Maybe Visual Studio is just too new or uses some overloaded library. Many thanks for your help, Crinkler is a really cool tool.
Good to hear that switching to 2019 fixed the problem.
And thanks @arizvisa for the link. Very interesting.
I was trying to compress a application using the following commands:
cl /c /O1 /GS- main.c crinkler /nodefaultlib /entry:main /subsystem:console /out:tiktak.exe main.obj kernel32.lib user32.lib ucrt.lib libcmt.lib libucrt.lib libvcruntime.lib
Crinkler tries to link the libraries but crashes. Here are the dump + obj files. dump-files.zip Hope that helps finding the issue.