exception.o - Undefined reference to NtCurrentTeb in CVS?

Robert Shearman rob at codeweavers.com
Tue Dec 27 09:33:08 CST 2005

Evil wrote:

>I commented out the three references to NtCurrentTeb in
>dlls/ntdll/tests/exception.c and WINE now compiles, installs, and runs fine.
>There's no CVS history for that file beyond the (current) 1.1 version,
>so I'm guessing an include or something has been missing ever since it
>was first added on the 17th of this month.
>I'm still confused, though, as to why I'm the only one (?) seeing the
>problem (on both my Mandriva 2005LE and Mandriva 2006 machines).  I
>don't immediately see how it (as part of thread.c) would be found when
>compiling tests/exception.c, but I've only scratched the surface of the
>source;  Any guru's care to illuminate me?
>Evil wrote:
>>I just got back from being on vacation for a week or so, and found I
>>can't compile the current CVS on either of my systems - even after
>>checking out everything from scratch and making clean.
>>Is anyone else having this problem, or is is specific to my machines? 
>>   ../../../tools/winegcc/winegcc -B../../../tools/winebuild -mconsole
>>   atom.o env.o error.o exception.o generated.o info.o large_int.o
>>   path.o om.o reg.o rtl.o rtlbitmap.o rtlstr.o string.o time.o
>>   testlist.o   -o ntdll_test.exe.so -L../../../libs/port -lwine_port
>>   -L../../../dlls -L../../../dlls/kernel32 -L../../../libs -lkernel32
>>   exception.o(.text+0x267): In function `test_prot_fault':
>>   /home/evil/install/wine/dlls/ntdll/tests/exception.c:202: undefined
>>   reference to `NtCurrentTeb'
>>   exception.o(.text+0x271):/home/evil/install/wine/dlls/ntdll/tests/exception.c:203:
>>   undefined reference to `NtCurrentTeb'
>>   exception.o(.text+0x32b):/home/evil/install/wine/dlls/ntdll/tests/exception.c:213:
>>   undefined reference to `NtCurrentTeb'
>>   collect2: ld returned 1 exit status
>>   winegcc: gcc failed.
>>   make[3]: *** [ntdll_test.exe.so] Error 2

The problem is caused because NtCurrentTeb is defined as "extern 
inline". Your compiler appears to have decided not to inline the 
function so it expects to be able to link to the function. However, the 
tests aren't linked to ntdll as they need to run on win9x machines. The 
solution that is probably the best is to include an implementation of 
NtCurrentTeb at the end of the test to be used if there is no inline 

Rob Shearman

More information about the wine-devel mailing list