microsoft / microsoft/msix-packaging

I need help compiling static linked msix.dll on Windows

Open
#660 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs-Triage
Dominant language
C
Stars
1.1k
Forks
193
Avg merge
2h 16m
Merged PRs (30d)
2

Description

I have installed the dependencies and prerequisites that are prescribed in the README., but I am unable to execute makewin.cmd x86 -mt on Windows (10, if that's important). Basically, I just need to make a very simple change in the MSIX Core (already done), however I can't figure out what I've done wrong or what I'm missing when compiling the dll. I can see it's a linker issue, that it cannot find what looks like the standard library, but it should be installed.

[ 71%] Linking CXX shared library ..\..\bin\msix.dll
LINK: command "C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1442~1.344\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\msix.dir\objects1.rsp /out:..\..\bin\msix.dll /implib:..\..\lib\msix.lib /pdb:C:\Users\mpetersson\Desktop\msix-packaging\.vs\bin\msix.pdb /dll /version:0.0 /DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll /DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll /LTCG /DEF:C:/Users/mpetersson/Desktop/msix-packaging/.vs/src/msix/windowsexports.def /NODEFAULTLIB:MSVCRT /machine:X86 /INCREMENTAL:NO bcrypt.lib crypt32.lib wintrust.lib runtimeobject.lib delayimp.lib ..\..\lib\zlibstatic.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1120) with the following output:
   Creating library ..\..\lib\msix.lib and object ..\..\lib\msix.exp
msix.cpp.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler3
msix.cpp.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
zlibstatic.lib(inftrees.c.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
msvcprt.lib(vector_algorithms.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
msix.cpp.obj : error LNK2001: unresolved external symbol ___std_exception_destroy
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__calloc
msix.cpp.obj : error LNK2001: unresolved external symbol _memmove
msix.cpp.obj : error LNK2001: unresolved external symbol _memcpy
zlibstatic.lib(inflate.c.obj) : error LNK2001: unresolved external symbol _memcpy
msvcprt.lib(vector_algorithms.obj) : error LNK2001: unresolved external symbol _memcpy
msix.cpp.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
msix.cpp.obj : error LNK2001: unresolved external symbol __imp___wfopen_s
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__fclose
msix.cpp.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *))" (??_M@YGXPAXIIP6EX0@Z@Z)
msix.cpp.obj : error LNK2001: unresolved external symbol ___std_exception_copy
msix.cpp.obj : error LNK2001: unresolved external symbol _atexit
msvcprt.lib(locale0_implib.obj) : error LNK2001: unresolved external symbol _atexit
msix.cpp.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@YAXPAXI@Z)
msix.cpp.obj : error LNK2001: unresolved external symbol __purecall
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__fwrite
msix.cpp.obj : error LNK2001: unresolved external symbol _strlen
msix.cpp.obj : error LNK2001: unresolved external symbol _memcmp
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__free
zlibstatic.lib(zutil.c.obj) : error LNK2001: unresolved external symbol __imp__free
msvcprt.lib(locale0_implib.obj) : error LNK2001: unresolved external symbol __imp__free
msix.cpp.obj : error LNK2001: unresolved external symbol _memset
msix.cpp.obj : error LNK2001: unresolved external symbol ___std_terminate
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__feof
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__wcslen
msix.cpp.obj : error LNK2001: unresolved external symbol __imp___ftelli64
msix.cpp.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__fread
msix.cpp.obj : error LNK2001: unresolved external symbol __imp___fseeki64
msix.cpp.obj : error LNK2001: unresolved external symbol __imp___invalid_parameter_noinfo_noreturn
msix.cpp.obj : error LNK2001: unresolved external symbol __imp__malloc
zlibstatic.lib(zutil.c.obj) : error LNK2001: unresolved external symbol __imp__malloc
msvcprt.lib(locale0_implib.obj) : error LNK2001: unresolved external symbol __imp__malloc
AppxFactory.cpp.obj : error LNK2001: unresolved external symbol __imp__fopen_s
Encoding.cpp.obj : error LNK2001: unresolved external symbol ___report_rangecheckfailure
AppxPackageInfo.cpp.obj : error LNK2001: unresolved external symbol _memchr
msvcprt.lib(vector_algorithms.obj) : error LNK2001: unresolved external symbol _memchr
AppxManifestObject.cpp.obj : error LNK2001: unresolved external symbol __Init_thread_epoch
AppxManifestObject.cpp.obj : error LNK2001: unresolved external symbol __imp__tolower
AppxManifestObject.cpp.obj : error LNK2001: unresolved external symbol __Init_thread_footer
AppxManifestObject.cpp.obj : error LNK2001: unresolved external symbol _strcmp
AppxManifestObject.cpp.obj : error LNK2001: unresolved external symbol __Init_thread_header
FileNameValidation.cpp.obj : error LNK2001: unresolved external symbol __imp__towlower
AppxManifestValidation.cpp.obj : error LNK2001: unresolved external symbol __imp__realloc
AppxManifestValidation.cpp.obj : error LNK2001: unresolved external symbol _strchr
TimeHelpers.cpp.obj : error LNK2001: unresolved external symbol __imp___localtime64
AppxBlockMapObject.cpp.obj : error LNK2001: unresolved external symbol __imp__strtoul
AppxBlockMapObject.cpp.obj : error LNK2001: unresolved external symbol __imp___errno
AppxBlockMapObject.cpp.obj : error LNK2001: unresolved external symbol __imp__strtoull
AppxPackageObject.cpp.obj : error LNK2001: unresolved external symbol __imp__remove
AppxPackageObject.cpp.obj : error LNK2001: unresolved external symbol __Init_thread_abort
AppxBundleManifest.cpp.obj : error LNK2001: unresolved external symbol __imp__strtol
Applicability.cpp.obj : error LNK2001: unresolved external symbol __imp__wcscmp
SignatureValidator.cpp.obj : error LNK2001: unresolved external symbol __imp__strncmp
LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
delayimp.lib(delayhlp.obj) : error LNK2001: unresolved external symbol __load_config_used
delayimp.lib(delayhlp.obj) : error LNK2001: unresolved external symbol ___guard_check_icall_fptr
msvcprt.lib(locale0_implib.obj) : error LNK2001: unresolved external symbol ___guard_check_icall_fptr
zlibstatic.lib(adler32.c.obj) : error LNK2001: unresolved external symbol __allrem
zlibstatic.lib(inftrees.c.obj) : error LNK2001: unresolved external symbol ___security_cookie
msvcprt.lib(vector_algorithms.obj) : error LNK2001: unresolved external symbol ___security_cookie
msvcprt.lib(vector_algorithms.obj) : error LNK2001: unresolved external symbol ___isa_enabled
msvcprt.lib(vector_algorithms.obj) : error LNK2001: unresolved external symbol __fltused
..\..\bin\msix.dll : fatal error LNK1120: 55 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --msvc-ver=1942 --intdir=CMakeFiles\msix.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x86\mt.exe --manifests -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1442~1.344\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\msix.dir\objects1.rsp @C:\Users\MPETER~1\AppData\Local\Temp\nm731C.tmp' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.42.34433\bin\HostX86\x86\nmake.exe" -s -f src\msix\CMakeFiles\msix.dir\build.make /nologo -SL                 src\msix\CMakeFiles\msix.dir\build' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.42.34433\bin\HostX86\x86\nmake.exe" -s -f CMakeFiles\Makefile2 /nologo -LS                 all' : return code '0x2'
Stop.

I can get everything else around it to build. makwin.cmd x86 builds just fine, I can build the entire MSIX Core solution, but I can't figure out what is causing the issue with the linker when compiling the statically linked dll.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README prerequisites and the makewin.cmd entry point, comparing the successful makewin.cmd x86 build with makewin.cmd x86 -mt. Review the reported MSVC linker output and the static-link configuration; done means the statically linked msix.dll builds successfully on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.