undefined refernce symbol __chkstk

Reini Urban rurban@x-ray.at
Tue Feb 5 20:24:00 GMT 2008


Anik Pal schrieb:
> I got the linking error message "undefined reference symbol __chkstk". When
> I try to link my source code with a MSVC compiled library. From the
> following url I got a workaround to remove this problem is to copy
> CHKSTK.OBJ from MSVC library and rename it to chkstk.o and link with it.
> 
> http://eegeerg.blogspot.com/2008_01_01_archive.html#4158852069709002699
>  
> But that option remove this error message and create the executable, But
> when run the executable it doesn't give anything just abort, no error
> message
> 
> I'm also linking my code with cygwin/lib/mingw/libmsvcrt.a
> 
> Now I suspect that wither CHKSTK.OBJ MSVC object file or mingw libmsvcrt.a
> library or both is causing this problem. But I'm not sure How to replace
> them with equivalent lib if I want to remove dependency from Mingc and MSVC
> both.

If your goal is to remove the dependency from Mingw and MSVC, so why are 
still trying to link against MSVC libs with ggc and MSVC specific 
compiler options?
__chkstk is a MSVC-specific stack checker compiled into each debugging 
function.

Get rid of your MSVC build script with cygwin, and use the cygwin 
equivalent of the solaris environment. Esp. get cygwin or mingw libs.
That's your work to do. Or use MSVC.

The day you got your cygwin application to compile against those
MSVC libs will not be the end of your problems.
http://cygwin.com/faq/faq.programming.html#faq.programming.msvcrt-and-cygwin

 > -LF:/geolog6.6.1/lib -lcgg -lgeolog6  -llicence -llogs_dll -lPGILc_dll
 > -lPGILcTool_dll -lcgs -llmgr9a -LD:/cygwin/lib -lcygwin
 > -LD:/cygwin/lib/mingw -lmsvcrt -Bstatic -LD:/cygwin/lib -lm

oh horror.

 >undefined reference to `?instance@OrbInit@@SAPAV1@HPBDH@Z'

So you link against a MSVC C++ library with gcc? Corba?
Maybe possible with a lot of work. But most likely not.
http://cygwin.com/faq/faq.programming.html#faq.programming.msvc-gcc-objects
E.g. besides the different C++ name mangling, your lib is linked against 
the microsoft c runtime, on cygwin you use the cygwin c runtime.
Both together will not work. The C++ members allocate new memory with 
the msvcrt malloc(), which cannot be free'd from any cygwin function. 
And vice versa.
-- 
Reini

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list