OpenTechEngine / OpenTechBFG

Engine based on (RB) Doom 3 BFG aiming to allow the creation of standalone games
Other
85 stars 11 forks source link

pthreads problems #155

Closed aindros closed 4 years ago

aindros commented 4 years ago

Hello, I have problems running cmake-vs2013-32bit.bat, after configuring Visual Studio 2013 to work with pthreads, I get this error:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: E:/devel/OpenTechEngine/OpenTechBFG/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe cmTC_e47a8.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=12.0 /v:m && Microsoft (R) Build Engine version 12.0.40629.0

[Microsoft .NET Framework, version 4.0.30319.42000]

Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86

  Copyright (C) Microsoft Corporation.  All rights reserved.

  src.c

  cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D CMAKE_HAVE_LIBC_PTHREAD /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_e47a8.dir\Debug\\" /Fd"cmTC_e47a8.dir\Debug\vc120.pdb" /Gd /TC /analyze- /errorReport:queue E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\src.c

E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\src.c(15): warning C4013: 'pthread_atfork' undefined; assuming extern returning int [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

src.obj : error LNK2019: unresolved external symbol __imp__pthread_create referenced in function _main [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

src.obj : error LNK2019: unresolved external symbol __imp__pthread_detach referenced in function _main [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

src.obj : error LNK2019: unresolved external symbol __imp__pthread_exit referenced in function _main [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

src.obj : error LNK2019: unresolved external symbol __imp__pthread_join referenced in function _main [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

src.obj : error LNK2019: unresolved external symbol __imp__pthread_cancel referenced in function _main [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

src.obj : error LNK2019: unresolved external symbol _pthread_atfork referenced in function _main [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\Debug\cmTC_e47a8.exe : fatal error LNK1120: 6 unresolved externals [E:\devel\OpenTechEngine\OpenTechBFG\build\CMakeFiles\CMakeTmp\cmTC_e47a8.vcxproj]

Source file was:
#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_cancel(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

I have pasted that code inside an empty project on VIsual Studio 2013 and I can compile and execute that without problems (after commenting _pthreadatfork() because I have noticed that there is no definition for that function in pthread.h).

Any suggestions?

kortemik commented 4 years ago

https://github.com/OpenTechEngine/OpenTechBFG/blob/master/appveyor.yml#L16

Please check here