Skip to content
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

Failure to compile stdlib/system with VCC, C++ and threads:on on i386 #6196

Closed
fredrikhr opened this issue Aug 7, 2017 · 1 comment
Closed

Comments

@fredrikhr
Copy link
Contributor

When using the VCC compiler backend and targeting i386 CPUs with the C++ backend the compilation fails and complains about wrong types being passed to the compiler-intrinsic function _InterlockedExchangeAdd.

Relevant errors:

nimcache\stdlib_system.cpp(7299): error C2665: '_InterlockedExchangeAdd': none of the 4 overloads could convert all the argument types
note: could be 'unsigned __int64 _InterlockedExchangeAdd(volatile unsigned __int64 *,unsigned __int64)'
or 'unsigned long _InterlockedExchangeAdd(volatile unsigned long *,unsigned long)'
or 'unsigned int _InterlockedExchangeAdd(volatile unsigned int *,unsigned int)'
or 'LONG _InterlockedExchangeAdd(volatile LONG *,LONG)'
nimcache\stdlib_system.cpp(7299): note: while trying to match the argument list '(volatile NI *, NI)'

and

nimcache\stdlib_system.cpp(7307): error C2665: '_InterlockedExchangeAdd': none of the 4 overloads could convert all the argument types
note: could be 'unsigned __int64 _InterlockedExchangeAdd(volatile unsigned __int64 *,unsigned __int64)'
or 'unsigned long _InterlockedExchangeAdd(volatile unsigned long *,unsigned long)'
or 'unsigned int _InterlockedExchangeAdd(volatile unsigned int *,unsigned int)'
or 'LONG _InterlockedExchangeAdd(volatile LONG *,LONG)'
nimcache\stdlib_system.cpp(7307): note: while trying to match the argument list '(volatile NI *, NI32)'

Full output when compiling tthread_createthread.nim from the nim test suite from the cpp category:

> nim cpp --hints:on --threads:on --cc:vcc --cpu:i386 tests\cpp\tthread_createthread.nim
Hint: used config file 'C:\Users\fra006\AppData\Local\Temp\Nim\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\fra006\AppData\Roaming\nim.cfg' [Conf]
Hint: system [Processing]
Hint: tthread_createthread [Processing]
CC: stdlib_system
stdlib_system.cpp
tests\cpp\nimcache\stdlib_system.cpp(7299): error C2665: '_InterlockedExchangeAdd': none of the 4 overloads could convert all the argument types
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winbase.h(9096): note: could be 'unsigned __int64 _InterlockedExchangeAdd(volatile unsigned __int64 *,unsigned __int64)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winbase.h(9074): note: or       'unsigned long _InterlockedExchangeAdd(volatile unsigned long *,unsigned long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winbase.h(9054): note: or       'unsigned int _InterlockedExchangeAdd(volatile unsigned int *,unsigned int)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(6513): note: or       'LONG _InterlockedExchangeAdd(volatile LONG *,LONG)'
tests\cpp\nimcache\stdlib_system.cpp(7299): note: while trying to match the argument list '(volatile NI *, NI)'
tests\cpp\nimcache\stdlib_system.cpp(7307): error C2665: '_InterlockedExchangeAdd': none of the 4 overloads could convert all the argument types
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winbase.h(9096): note: could be 'unsigned __int64 _InterlockedExchangeAdd(volatile unsigned __int64 *,unsigned __int64)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winbase.h(9074): note: or       'unsigned long _InterlockedExchangeAdd(volatile unsigned long *,unsigned long)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winbase.h(9054): note: or       'unsigned int _InterlockedExchangeAdd(volatile unsigned int *,unsigned int)'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(6513): note: or       'LONG _InterlockedExchangeAdd(volatile LONG *,LONG)'
tests\cpp\nimcache\stdlib_system.cpp(7307): note: while trying to match the argument list '(volatile NI *, NI32)'
Hint:  [Link]
compiler_tthread_createthread.obj : error LNK2019: unresolved external symbol "void * __fastcall threadVarGetValue_RA7AnSIB7ATZq3Th1d9czYg(int)" (?threadVarGetValue_RA7AnSIB7ATZq3Th1d9czYg@@YIPAXH@Z) referenced in function "void * __cdecl GetThreadLocalVars(void)" (?GetThreadLocalVars@@YAPAXXZ)
stdlib_sharedlist.obj : error LNK2001: unresolved external symbol "void * __fastcall threadVarGetValue_RA7AnSIB7ATZq3Th1d9czYg(int)" (?threadVarGetValue_RA7AnSIB7ATZq3Th1d9czYg@@YIPAXH@Z)
compiler_tthread_createthread.obj : error LNK2019: unresolved external symbol "void __fastcall createThread_posQTE8v49cWcDRZFVoVfqw(struct Thread_1BjMQDz29aWuzX6DUOaNfqQ &,void (__fastcall*)(int),int)" (?createThread_posQTE8v49cWcDRZFVoVfqw@@YIXAAUThread_1BjMQDz29aWuzX6DUOaNfqQ@@P6IXH@ZH@Z) referenced in function "void __fastcall main_46jPa01Kd29aTFB1vsnncaQ(void)" (?main_46jPa01Kd29aTFB1vsnncaQ@@YIXXZ)
compiler_tthread_createthread.obj : error LNK2019: unresolved external symbol "void __fastcall joinThreads_Sj0mMCXgId5LSSMptl6qxg(struct Thread_1BjMQDz29aWuzX6DUOaNfqQ *,int)" (?joinThreads_Sj0mMCXgId5LSSMptl6qxg@@YIXPAUThread_1BjMQDz29aWuzX6DUOaNfqQ@@H@Z) referenced in function "void __fastcall main_46jPa01Kd29aTFB1vsnncaQ(void)" (?main_46jPa01Kd29aTFB1vsnncaQ@@YIXXZ)
compiler_tthread_createthread.obj : error LNK2019: unresolved external symbol "int globalsSlot_ciXDZu9c27pHpCRMoz4RIgw" (?globalsSlot_ciXDZu9c27pHpCRMoz4RIgw@@3HA) referenced in function "void * __cdecl GetThreadLocalVars(void)" (?GetThreadLocalVars@@YAPAXXZ)
stdlib_sharedlist.obj : error LNK2001: unresolved external symbol "int globalsSlot_ciXDZu9c27pHpCRMoz4RIgw" (?globalsSlot_ciXDZu9c27pHpCRMoz4RIgw@@3HA)
compiler_tthread_createthread.obj : error LNK2019: unresolved external symbol "struct GcThread_hgJQSlfXDOK3SwSHjeZBXg mainThread_6r3APOnKvB9aL9atazGvT52A" (?mainThread_6r3APOnKvB9aL9atazGvT52A@@3UGcThread_hgJQSlfXDOK3SwSHjeZBXg@@A) referenced in function "void __cdecl initThreadVarsEmulation(void)" (?initThreadVarsEmulation@@YAXXZ)
stdlib_sharedlist.obj : error LNK2019: unresolved external symbol "void * __cdecl allocShared0_4cubgSerkjpuLcj5MXjiLw_3(int)" (?allocShared0_4cubgSerkjpuLcj5MXjiLw_3@@YAPAXH@Z) referenced in function "void __fastcall add_LMD14ZZveJ1hTQDkuvr6bQ(struct SharedList_9cWkTIPQvNw7gFHMOEzMCLw &,void *)" (?add_LMD14ZZveJ1hTQDkuvr6bQ@@YIXAAUSharedList_9cWkTIPQvNw7gFHMOEzMCLw@@PAX@Z)
C:\Users\fra006\AppData\Local\Temp\Nim\tests\cpp\tthread_createthread.exe : fatal error LNK1120: 6 unresolved externals
Error: execution of an external program failed: 'vccexe.exe   --vcvarsall:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall"  --platform:x86 /nologo /DEBUG /Zi /F33554432  /FeC:\Users\fra006\AppData\Local\Temp\Nim\tests\cpp\tthread_createthread.exe  tests\cpp\nimcache\compiler_tthread_createthread.obj tests\cpp\nimcache\stdlib_system.obj tests\cpp\nimcache\stdlib_sharedlist.obj tests\cpp\nimcache\stdlib_locks.obj '
@fredrikhr
Copy link
Contributor Author

I checked and did the exact same thing on amd64, and then it works... So this is a i386-specific issue

jangko added a commit to jangko/Nim that referenced this issue Aug 8, 2017
@dom96 dom96 closed this as completed in d0365dc Aug 10, 2017
dom96 added a commit that referenced this issue Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants