-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation error LNK2001:unresolved external symbol "__security_check_cookie" #134
Comments
I added the following to the [BuildOptions]: MSVC:__*_CC_FLAGS = /GS- and everything works fine ;-) |
Thanks for the heads up. I don't normally compile EfiGuard with EDK2 master myself, due to EDK2 master frequently having caused both compile time errors and runtime regressions in the past (with at least one still unfixed - see #112). So I hadn't noticed this change in EDK2. Your fix (overriding Re: the 'inconsistent compiler flags' warning emitted: I'm aware of this happening, but I don't consider it an issue. Overriding |
FWIW, there is currently an open issue for this on the TianoCore EDK2 repository as well: see tianocore/edk2#10547. |
Question description
Operating system:
Windows 10 22H2 build 19045.3808
Issue description:
When I try to compile EfiGuard within EDK2 I got follollowing errors:
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x64\cl.exe" /Fod:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\EfiGuardDxe\EfiGuardDxe\OUTPUT.\ /showIncludes /nologo /c /WX /GS /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /volatileMetadata- -D ZYAN_NO_LIBC -D ZYCORE_STATIC_BUILD -D ZYDIS_STATIC_BUILD -D ZYDIS_DISABLE_ENCODER -D ZYDIS_DISABLE_FORMATTER -D ZYDIS_DISABLE_AVX512 -D ZYDIS_DISABLE_KNC /wd4201 /O2 /Ot /Zi -D DISABLE_NEW_DEPRECATED_INTERFACES /utf-8 /Qspectre- /Id:\sources\edk2\EfiGuardPkg\EfiGuardDxe\X64 /Id:\sources\edk2\EfiGuardPkg\EfiGuardDxe /Id:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\EfiGuardDxe\EfiGuardDxe\DEBUG /Id:\sources\edk2\MdePkg /Id:\sources\edk2\MdePkg\Include /Id:\sources\edk2\MdePkg\Test\UnitTest\Include /Id:\sources\edk2\MdePkg\Test\Mock\Include /Id:\sources\edk2\MdePkg\Library\MipiSysTLib\mipisyst\library\include /Id:\sources\edk2\MdePkg\Include\X64 /Id:\sources\edk2\EfiGuardPkg /Id:\sources\edk2\EfiGuardPkg\Include /Id:\sources\edk2\EfiGuardPkg\Include\Protocol /Id:\sources\edk2\EfiGuardPkg\EfiGuardDxe\Zydis\dependencies\zycore\include /Id:\sources\edk2\EfiGuardPkg\EfiGuardDxe\Zydis\include /Id:\sources\edk2\EfiGuardPkg\EfiGuardDxe\Zydis\src /Id:\sources\edk2\EfiGuardPkg\EfiGuardDxe\Zydis\msvc /Id:\sources\edk2\MdeModulePkg /Id:\sources\edk2\MdeModulePkg\Include /Id:\sources\edk2\MdeModulePkg\Test\Mock\Include @d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\EfiGuardDxe\EfiGuardDxe\OUTPUT\cc_resp_14.txt
Loader.c
cl : Command line warning D9025 : overriding '/O1' with '/O2'
cl : Command line warning D9025 : overriding '/Os' with '/Ot'
EfiGuardDxe.c
AutoGen.c
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x64\lib.exe" /NOLOGO /LTCG /OUT:d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\OUTPUT\Loader.lib @d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\OUTPUT\object_files.lst
PatchBootmgr.c
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x64\link.exe" /OUT:d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\DEBUG\Loader.dll /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data /ALIGN:4096 /DLL /SUBSYSTEM:EFI_APPLICATION,1.0 /ALIGN:0x1000 /FILEALIGN:0x200 /SECTION:.pdata,!D /SECTION:.xdata,!D /DEBUG:FULL /NOVCFEATURE /NOCOFFGRPINFO /PDBALTPATH:%_PDB% /WHOLEARCHIVE @d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\OUTPUT\static_library_files.lst
util.c
Loader.lib(AutoGen.obj) : error LNK2001: unresolved external symbol __security_check_cookie
d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\DEBUG\Loader.dll : fatal error LNK1120: 1 unresolved externals
AutoGen.c
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x64\link.exe" /OUT:d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\DEBUG\Loader.dll /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data /ALIGN:4096 /DLL /SUBSYSTEM:EFI_APPLICATION,1.0 /ALIGN:0x1000 /FILEALIGN:0x200 /SECTION:.pdata,!D /SECTION:.xdata,!D /DEBUG:FULL /NOVCFEATURE /NOCOFFGRPINFO /PDBALTPATH:%_PDB% /WHOLEARCHIVE @d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader\OUTPUT\static_library_files.lst' : return code '0x460'
Stop.
build.py...
: error 7000: Failed to execute command
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\Application\Loader\Loader]
build.py...
: error 7000: Failed to execute command
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\EfiGuardDxe\EfiGuardDxe]
build.py...
: error F002: Failed to build module
d:\sources\edk2\EfiGuardPkg\Application\Loader\Loader.inf [X64, VS2022, RELEASE]
Build end time: 11:20:59, Jan.05 2025
Build total time: 00:00:29
Compilation is started with following command:
build -a X64 -t VS2022 -p EfiGuardPkg/EfiGuardPkg.dsc -b RELEASE
Missing or Incorrect Runtime Library:
error LNK2001: unresolved external symbol __security_check_cookie:
Do I miss a runtime library? Or is it a configuration error?
Inconsistent Compiler and Linker Flags: /O1b2s and /O2:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\bin\Hostx86\x64\cl.exe" /Fod:\sources\edk2\Build\EfiGuard\RELEASE_VS2022\X64\EfiGuardPkg\EfiGuardDxe\EfiGuardDxe\OUTPUT.\ /showIncludes /nologo /c /WX /GS /W4 /Gs32768 /D UNICODE ### /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /volatileMetadata- -D ZYAN_NO_LIBC -D ZYCORE_STATIC_BUILD -D ZYDIS_STATIC_BUILD -D ZYDIS_DISABLE_ENCODER -D ZYDIS_DISABLE_FORMATTER -D ZYDIS_DISABLE_AVX512 -D ZYDIS_DISABLE_KNC /wd4201 ### /O2
Are the two flags set correctly? Or are they conflicting?
The text was updated successfully, but these errors were encountered: