openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.97k stars 2.55k forks source link

OpenFrameworks failed to build due to rror LNK2001: unresolved external symbol _Cnd_timedwait_for with MSVC on Windows target arm64 or arm64ec #8058

Closed spacelg closed 2 months ago

spacelg commented 3 months ago

Hi,

OpenFrameworks failed to build due to 'error LNK2001: unresolved external symbol _Cnd_timedwait_for' with MSVC on Windows target arm64 or arm64ec. but it can build pass on target x64. This issue can reproduce on version cbb57f2 on master branch. Could you please help look at this issue? Thanks in advance.

Repro steps:

  1. Open VS2022 amd64 cmd.
  2. git -C "C:\gitP" clone --no-checkout https://github.com/openframeworks/openFrameworks openframeworks\openFrameworks
  3. git submodule init
  4. git submodule update
  5. "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=arm64
  6. cd /d C:\gitP\openframeworks\openFrameworks
  7. "C:\Program Files\Git\bin\sh.exe" ./scripts/ci/vs/install_bleeding.sh -p vs --silent
  8. msbuild examples/templates/emptyExample/emptyExample.vcxproj /p:configuration=Release /p:platform=arm64 /p:PlatformToolset=v143

Error log: build_arm64.log

Error info: openframeworksLib.lib(ofThread.obj) : error LNK2001: unresolved external symbol _Cnd_timedwait_for [C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj] bin\emptyExample.exe : fatal error LNK1120: 1 unresolved externals [C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1151,5): error MSB6006: "link.exe" exited with code 1120. [C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj] Done Building Project "C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj" (default targets) -- FAILED.

danoli3 commented 3 months ago

Missing -pthreads

On Wed, 24 Jul 2024 at 4:08 PM, spacelg @.***> wrote:

Hi,

OpenFrameworks failed to build due to 'error LNK2001: unresolved external symbol _Cnd_timedwait_for' with MSVC on Windows target arm64 or arm64ec. but it can build pass on target x64. This issue can reproduce on version cbb57f2 https://github.com/openframeworks/openFrameworks/commit/cbb57f2b70385269cc6dd745f2bb8ed3e5a54b43 on master branch. Could you please help look at this issue? Thanks in advance.

Repro steps:

  1. Open VS2022 amd64 cmd.
  2. git -C "C:\gitP" clone --no-checkout https://github.com/openframeworks/openFrameworks openframeworks\openFrameworks
  3. git submodule init
  4. git submodule update
  5. "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=arm64
  6. cd /d C:\gitP\openframeworks\openFrameworks
  7. "C:\Program Files\Git\bin\sh.exe" ./scripts/ci/vs/install_bleeding.sh -p vs --silent
  8. msbuild examples/templates/emptyExample/emptyExample.vcxproj /p:configuration=Release /p:platform=arm64 /p:PlatformToolset=v143

Error log: build_arm64.log https://github.com/user-attachments/files/16357844/build_arm64.log

Error info: openframeworksLib.lib(ofThread.obj) : error LNK2001: unresolved external symbol _Cnd_timedwait_for [C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj] bin\emptyExample.exe : fatal error LNK1120: 1 unresolved externals [C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1151,5): error MSB6006: "link.exe" exited with code 1120. [C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj] Done Building Project "C:\gitP\openframeworks\openFrameworks\examples\templates\emptyExample\emptyExample.vcxproj" (default targets) -- FAILED.

— Reply to this email directly, view it on GitHub https://github.com/openframeworks/openFrameworks/issues/8058, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGK2HGBVPYPZ3I7QPZKWALZN5AENAVCNFSM6AAAAABLLYKZR6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZDMNRXGY3DQNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

danoli3 commented 3 months ago

@spacelg could you try this:

msbuild examples/templates/emptyExample/emptyExample.vcxproj /p:configuration=Release /p:platform=arm64 /p:PlatformToolset=v143 /p:AdditionalDependencies=concrt.lib

add: /p:AdditionalDependencies=concrt.lib

danoli3 commented 3 months ago

Okay traced to inconsistency with C standard.

https://en.cppreference.com/w/c/thread/cnd_timedwait

danoli3 commented 3 months ago

@spacelg please try again now with C17 set