Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
898 views
in Technique[技术] by (71.8m points)

curl - gcc linker error: undefined reference to `__security_cookie'

with gcc I want to build a DLL, which uses the Curl lib.

After

$gcc -shared -o GA_TestLibV11.dll GA_TestLibV11.o GA_TestLibV11.def curllib_static.lib

$ gcc -shared -o GA_TestLibV11.dll GA_TestLibV11.o GA_TestLibV11.def curllib_static.lib -llibws2_32

I get the following warning (which appears many times)

Warning: .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' v ersion='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3 b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized

and the following errors:

curllib_static.lib(./Release/easy.obj):(.text[_win32_init]+0x7): undefined reference to `__security_cookie'

curllib_static.lib(./Release/easy.obj):(.text[_win32_init]+0x41): undefined reference to `@__security_check_cookie@4'

c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: curllib_st
atic.lib(./Release/easy.obj): bad reloc address 0x41 in section `.text[_win32_in
it]'
collect2.exe: error: ld returned 1 exit status

What else do I have to link to solve these problems?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You will need to link with one of the bufferoverflow.lib libraries,

bufferoverflowU.lib This library implements functionality for security cookie verification that can be used in the user mode and in applications that use the Win32 API. Most applications link to this library.

bufferoverflowK.lib This library implements the check of a security cookie that works in the kernel mode of the operating system. Services and subsystems that run in the kernel mode have to be linked to this library.

bufferoverflow.lib This library implements functionality for security cookie verification that can be used in the user mode. However, bufferoverflow.lib is different from bufferoverflowU.lib because bufferoverflow.lib can be used in services and in applications that do not use the Win32 API.

See more at You may receive the "Linker tools error LNK2001" error messages when you build source code by using the Win32 Software Development Kit (SDK) or the Windows Server 2003 Driver Development Kit (DDK) for Windows Server 2003 Service Pack 1.

Alternatively, you will have to rebuild curl without the /GS compiler switch,

In Microsoft Visual Studio 2002, a new compiler switch that is named " /GS" has been introduced to the Microsoft Visual C++ compiler. When the " /GS" switch is set, the compiler injects buffer overrun detection code in the compiled code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...