axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
922 stars 205 forks source link

Ninja + Clang on Windows support #1152

Closed iAndyHD3 closed 1 year ago

iAndyHD3 commented 1 year ago

It should be possible to compile axmol with clang on windows. I would try to add support for it myself but the errors are third party libraries which aren't very easy to work with if you aren't used to the environment

the specific error i'm having, if it helps:

FAILED: engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_llvm_rc C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/src/base/ftver.rc engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res.pp C:\PROGRA~1\LLVM\bin\clang.exe -DFT2_BUILD_LIBRARY -DNTCVT_CP_DEFAULT=CP_UTF8 -DPNG_INTEL_SSE_OPT=1 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DRC_INVOKED -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include/freetype/config -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/png  -MD -MF engine\thirdparty\freetype\CMakeFiles\freetype.dir\src\base\ftver.rc.res.d -x c -E -- C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/src/base/ftver.rc ++ C:\PROGRA~1\LLVM\bin\llvm-rc.exe -DFT2_BUILD_LIBRARY -DNTCVT_CP_DEFAULT=CP_UTF8 -DPNG_INTEL_SSE_OPT=1 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -I SOURCE_DIR -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include/freetype/config -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/png  -MD -MF engine\thirdparty\freetype\CMakeFiles\freetype.dir\src\base\ftver.rc.res.d /fo engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res.pp
llvm-rc: Error in VERSIONINFO statement (ID 1):
Non-ASCII 8-bit codepoint (169) can't occur in a non-Unicode string
[153/857] Building CXX object engine/thirdparty/recast/CMakeFiles/recast.dir/DetourNavMeshQuery.cpp.obj
ninja: build stopped: subcommand failed.
halx99 commented 1 year ago

I have not seen this error, I do some changes of source code and cmake, and build cpp-test.exe successfuly

halx99 commented 1 year ago

The vs cmake generate full command line is:

"C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="E:\dev\axmol1\axmol\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/PROGRAM FILES/MICROSOFT VISUAL STUDIO/2022/COMMUNITY/VC/Tools/Llvm/bin/clang-cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/PROGRAM FILES/MICROSOFT VISUAL STUDIO/2022/COMMUNITY/VC/Tools/Llvm/bin/clang-cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "E:\dev\axmol1\axmol" 2>&1"
iAndyHD3 commented 1 year ago

I am using official llvm clang Installation instead of getting it through vs installer, maybe that makes a difference?

halx99 commented 1 year ago

I'm not sure. but at least, we can quick supoort clang-cl installed by visual studio installer first

iAndyHD3 commented 1 year ago

yes if you can please do! we (a team) would appreciate

halx99 commented 1 year ago

refer to: https://github.com/axmolengine/axmol/pull/1153

iAndyHD3 commented 1 year ago

It should be possible to compile axmol with clang on windows. I would try to add support for it myself but the errors are third party libraries which aren't very easy to work with if you aren't used to the environment

the specific error i'm having, if it helps:

FAILED: engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_llvm_rc C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/src/base/ftver.rc engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res.pp C:\PROGRA~1\LLVM\bin\clang.exe -DFT2_BUILD_LIBRARY -DNTCVT_CP_DEFAULT=CP_UTF8 -DPNG_INTEL_SSE_OPT=1 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DRC_INVOKED -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include/freetype/config -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/png  -MD -MF engine\thirdparty\freetype\CMakeFiles\freetype.dir\src\base\ftver.rc.res.d -x c -E -- C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/src/base/ftver.rc ++ C:\PROGRA~1\LLVM\bin\llvm-rc.exe -DFT2_BUILD_LIBRARY -DNTCVT_CP_DEFAULT=CP_UTF8 -DPNG_INTEL_SSE_OPT=1 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -I SOURCE_DIR -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/freetype/include -I C:/Users/user/Desktop/projects/axmol/OpenGD/nbuild/engine/thirdparty/freetype/include/freetype/config -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/include -I C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/png  -MD -MF engine\thirdparty\freetype\CMakeFiles\freetype.dir\src\base\ftver.rc.res.d /fo engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res engine/thirdparty/freetype/CMakeFiles/freetype.dir/src/base/ftver.rc.res.pp
llvm-rc: Error in VERSIONINFO statement (ID 1):
Non-ASCII 8-bit codepoint (169) can't occur in a non-Unicode string
[153/857] Building CXX object engine/thirdparty/recast/CMakeFiles/recast.dir/DetourNavMeshQuery.cpp.obj
ninja: build stopped: subcommand failed.

update on this error, the fix is to update FreeType third party to 2.13.0, this commit fixes it

iAndyHD3 commented 1 year ago

Big news: I made it compile correctly using official clang + ninja, now I'm getting a weird a link issue, apparently it can't find the main function. I checked and all object files were compiled correctly...

Syncing resources for OpenGD ...
[2/4] Running utility command for SYNC_RESOURCE-OpenGD
    Syncing to C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD/Content
[4/4] Linking CXX executable bin\OpenGD\OpenGD.exe
FAILED: bin/OpenGD/OpenGD.exe
cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -fuse-ld=lld-link -nostartfiles -nostdlib -O0 -g -Xclang -gcodeview -D_DEBUG -D_dll
 -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console @CMakeFiles\OpenGD.rsp -o bin\OpenGD\OpenGD.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:OpenGD.lib -Xlinker /pdb:bin\OpenGD\OpenGD.pdb -Xlinker /version:0.0   && cmd.exe /C "cd /D C:\Users\user\Desktop\projects\axmol\OpenGD\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/prebuilt/win32/x64/zlib1.dll
 C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD/zlib1.dll
 && cd /D C:\Users\user\Desktop\projects\axmol\OpenGD\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/openssl/prebuilt/win32/x64/libcrypto-3-x64.dll
C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD/libcrypto-3-x64.dll
 && cd /D C:\Users\user\Desktop\projects\axmol\OpenGD\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/openssl/prebuilt/win32/x64/libssl-3-x64.dll
 C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD/libssl-3-x64.dll
 && cd /D C:\Users\user\Desktop\projects\axmol\OpenGD\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/curl/prebuilt/win32/x64/libcurl.dll
 C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD/libcurl.dll
 && cd /D C:\Users\user\Desktop\projects\axmol\OpenGD\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/prebuilt/win32/x64/zlib1.dll
 C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/openssl/prebuilt/win32/x64/libcrypto-3-x64.dll
 C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/openssl/prebuilt/win32/x64/libssl-3-x64.dll
 C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/curl/prebuilt/win32/x64/libcurl.dll
 C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenAL32.dll
 C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD""
lld-link: error: undefined symbol: main
>>> referenced by D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
>>>               msvcrtd.lib(exe_main.obj):(int __cdecl invoke_main(void))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

any idea on how to fix or what the issue can be?

halx99 commented 1 year ago

seems the entry point setup incorrect

halx99 commented 1 year ago

should be wWinMain for win32

iAndyHD3 commented 1 year ago

wWinMain didn't work, however the usual int main() did. I'll fix some other issues and probably open PR

iAndyHD3 commented 1 year ago

Sadly I can't easily update thirdparty through a pr, so I'll list the (easy) steps. I also got a minor error that I don't know how to solve yet so that's also holding me back from making a PR.

After these changes axmol compiled fine, however I got a last weird error when compiling the windows resource file of the game project

[1/4] cmd.exe /C "cd /D C:\Users\user\Des...E echo "Syncing resources for OpenGD ...""
Syncing resources for OpenGD ...
[2/4] Running utility command for SYNC_RESOURCE-OpenGD
    Syncing to C:/Users/user/Desktop/projects/axmol/OpenGD/build/bin/OpenGD/Content
[3/4] Building RC object CMakeFiles/OpenGD.dir/proj.win32/game.rc.res
FAILED: CMakeFiles/OpenGD.dir/proj.win32/game.rc.res
llvm-rc: Error in ICON statement (ID GLFW_ICON):
Stream Error: The stream is too short to perform the requested operation.
ninja: build stopped: subcommand failed.

this error is produced here, one temp workaround is simply removing that line, everything compiles and runs fine but the icon is obviously not set. Tried to actually solve it but I wasn't able, there's also pretty much no information online

halx99 commented 1 year ago

What's your cmake generation command line? like this:

cmake -B build_llvm -G "Ninja" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_C_COMPILER=clang" "-DCMAKE_CXX_COMPILER=clang++"
halx99 commented 1 year ago

Tests, follow command can generate successfully.

cmake -B build_llvm -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_C_COMPILER=clang" "-DCMAKE_CXX_COMPILER=clang++"
halx99 commented 1 year ago

Tests, follow command can generate successfully.

cmake -B build_llvm -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_C_COMPILER=clang" "-DCMAKE_CXX_COMPILER=clang++"

I have build cpp-test.exe successfully with latest LLVM-16.0.0, will create a PR later

halx99 commented 1 year ago

Now the latest version of axmol should support build with official llvm-clang for windows, and the github ci check passed: https://github.com/axmolengine/axmol/actions/runs/4587391600/jobs/8100862503

iAndyHD3 commented 1 year ago

I got the commit and I get a linker error with OpenAL32

The generate log:

C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-tests>cmake -B build_llvm -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE=RelWithDebInfo
-- The C compiler identification is Clang 16.0.0 with GNU-like command-line
-- The CXX compiler identification is Clang 16.0.0 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using system env var _AX_ROOT=C:\Users\user\Desktop\projects\axmol\axmol
-- CMAKE_HOST_SYSTEM_VERSION: 10.0.19044
-- CMAKE_SYSTEM_VERSION: 10.0.19044
-- CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION:
-- CMAKE_C_STANDARD=99
-- CMAKE_CXX_STANDARD=20
-- using Windows clang-cl generate axmol project
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: C:/Program Files/LLVM/bin/clang.exe
-- The ASM_NASM compiler identification is unknown
-- Didn't find assembler
-- The nasm compiler speed up libraries: jpeg(libjpeg-turbo)
CMake Warning at C:/Users/user/Desktop/projects/axmol/axmol/cmake/Modules/AXConfigDefine.cmake:184 (message):
  The nasm compiler doesn't present on your system PATH, please download
  from: https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/
Call Stack (most recent call first):
  C:/Users/user/Desktop/projects/axmol/axmol/cmake/Modules/AXBuildSet.cmake:33 (include)
  CMakeLists.txt:32 (include)

-- PROJECT_NAME:cpp_tests
-- PROJECT_SOURCE_DIR:C:/Users/user/Desktop/projects/axmol/axmol/tests/cpp-tests
-- _AX_ROOT_PATH:C:/Users/user/Desktop/projects/axmol/axmol
-- CMAKE_MODULE_PATH:C:/Users/user/Desktop/projects/axmol/axmol/cmake/Modules/
-- PROJECT_BINARY_DIR:C:/Users/user/Desktop/projects/axmol/axmol/tests/cpp-tests/build_llvm
-- ENGINE_BINARY_PATH:C:/Users/user/Desktop/projects/axmol/axmol/tests/cpp-tests/build_llvm/engine
-- PYTHON_PATH:C:/Users/user/AppData/Local/Programs/Python/Python311/python.exe
-- _AX_COMMAND_PATH:C:/Users/user/Desktop/projects/axmol/axmol/tools/console/bin/axmol
-- HOST_SYSTEM:Windows
-- CMAKE_SYSTEM_NAME:Windows
-- CMAKE_GENERATOR_PLATFORM:
-- CMAKE_SYSTEM_PROCESSOR:AMD64
-- ARCH_ALIAS:x64
-- CMAKE_CXX_COMPILER_ID:Clang
-- _AX_LUAJIT_ROOT:C:/Users/user/Desktop/projects/axmol/axmol/tools/console/bin/../plugins/plugin_luacompile/bin
-- LUAJIT32_COMMAND:LUAJIT32_COMMAND-NOTFOUND
-- LUAJIT64_COMMAND:LUAJIT64_COMMAND-NOTFOUND
-- WINRT=
-- _AX_MEDIA_SRC=C:/Users/user/Desktop/projects/axmol/axmol/core/media/MFUtils.cpp;C:/Users/user/Desktop/projects/axmol/axmol/core/media/MediaEngine.cpp;C:/Users/user/Desktop/projects/axmol/axmol/core/media/MfMediaEngine.cpp;C:/Users/user/Desktop/projects/axmol/axmol/core/media/WmfMediaEngine.cpp
-- Performing Test AX_HAVE_SSE2_SWITCH
-- Performing Test AX_HAVE_SSE2_SWITCH - Success
-- Performing Test AX_HAVE_AVX2_INTRINSICS
-- Performing Test AX_HAVE_AVX2_INTRINSICS - Failed
-- Performing Test AX_HAVE_SSE42_INTRINSICS
-- Performing Test AX_HAVE_SSE42_INTRINSICS - Failed
-- Performing Test AX_HAVE_SSE41_INTRINSICS
-- Performing Test AX_HAVE_SSE41_INTRINSICS - Success
-- Looking for arm_neon.h
-- Looking for arm_neon.h - not found
CMake Warning (dev) at C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/CMakeLists.txt:135 (message):

  AX_ISA_SIMD=sse4.1,AX_HAVE_AVX2_INTRINSICS=,AX_HAVE_SSE42_INTRINSICS=,AX_HAVE_SSE41_INTRINSICS=1,AX_HAVE_SSE2_INTRINSICS=1,AX_HAVE_NEON_INTRINSICS=
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Using plainlua https://lua.org
-- Module support is disabled.
-- Version: 9.1.0
-- Build type: RelWithDebInfo
-- CXX_STANDARD: 20
-- Performing Test has_std_20_flag
-- Performing Test has_std_20_flag - Success
-- Performing Test has_std_2a_flag
-- Performing Test has_std_2a_flag - Success
-- Required features: cxx_variadic_templates
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Success
Configuring Chipmunk2D version 7.0.3
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found ZLIB: C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/zlib/prebuilt/win32/x64/zlib.lib (found version "1.2.13")
-- Found PNG: png (found version "1.6.39")
CMake Warning (dev) at C:/Users/user/Desktop/projects/axmol/axmol/thirdparty/astc/CMakeLists.txt:85 (message):
  ASTC_ISA_SIMD=sse4.1
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Performing Test HAVE___RESTRICT
-- Performing Test HAVE___RESTRICT - Success
-- Performing Test HAVE_LIBATOMIC
-- Performing Test HAVE_LIBATOMIC - Failed
-- Performing Test HAVE_WNO_CXX20_ATTR_EXT
-- Performing Test HAVE_WNO_CXX20_ATTR_EXT - Success
-- Performing Test HAVE_FNO_MATH_ERRNO
-- Performing Test HAVE_FNO_MATH_ERRNO - Success
-- Performing Test HAVE_MSSE2_SWITCH
-- Performing Test HAVE_MSSE2_SWITCH - Success
-- Looking for xmmintrin.h
-- Looking for xmmintrin.h - found
-- Looking for emmintrin.h
-- Looking for emmintrin.h - found
-- Looking for pmmintrin.h
-- Looking for pmmintrin.h - found
-- Looking for smmintrin.h
-- Looking for smmintrin.h - found
-- Looking for arm_neon.h
-- Looking for arm_neon.h - not found
-- Performing Test HAVE_SSE_INTRINSICS
-- Performing Test HAVE_SSE_INTRINSICS - Success
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for cpuid.h
-- Looking for cpuid.h - found
-- Looking for intrin.h
-- Looking for intrin.h - found
-- Looking for guiddef.h
-- Looking for guiddef.h - found
-- Looking for pow in m
-- Looking for pow in m - not found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Performing Test HAVE_GCC_GET_CPUID
-- Performing Test HAVE_GCC_GET_CPUID - Success
-- Performing Test HAVE_CPUID_INTRINSIC
-- Performing Test HAVE_CPUID_INTRINSIC - Success
-- Looking for posix_memalign
-- Looking for posix_memalign - not found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - found
-- Looking for proc_pidpath
-- Looking for proc_pidpath - not found
-- Looking for getopt
-- Looking for getopt - not found
-- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
-- Could NOT find OSS (missing: OSS_INCLUDE_DIR)
-- Could NOT find AudioIO (missing: AUDIOIO_INCLUDE_DIR)
-- Could NOT find SoundIO (missing: SOUNDIO_LIBRARY SOUNDIO_INCLUDE_DIR)
-- Looking for dsound.h
-- Looking for dsound.h - found
-- Looking for mmdeviceapi.h
-- Looking for mmdeviceapi.h - found
-- Could NOT find PortAudio (missing: PORTAUDIO_LIBRARY PORTAUDIO_INCLUDE_DIR)
-- Could NOT find PulseAudio (missing: PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR)
-- Could NOT find JACK (missing: JACK_LIBRARY JACK_INCLUDE_DIR)
-- Could NOT find OpenSL (missing: OPENSL_LIBRARY OPENSL_INCLUDE_DIR OPENSL_ANDROID_INCLUDE_DIR)
-- Could NOT find SDL2
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.39.1.windows.1")
--
-- Building OpenAL with support for the following backends:
--     WinMM, DirectSound, WASAPI, WaveFile, Null
--
-- Building with support for CPU extensions:
--     Default, SSE, SSE2, SSE3, SSE4.1
--
-- Building with legacy EAX extension support
--
-- Embedding HRTF datasets
--
-- NOT installing library and headers
-- Installing sample configuration
-- Installing HRTF data files
-- Installing AmbDec presets
--
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Found Threads: TRUE
-- Including Win32 support
-- AX_USE_ALSOFT=
CMake axmol target_precompile_headers
Feeds used:
  C:\Users\user\.nuget\packages\
  https://api.nuget.org/v3/index.json

Attempting to gather dependency information for package 'Microsoft.Web.WebView2.1.0.992.28' with respect to project 'C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-tests\build_llvm\packages', targeting 'Any,Version=v0.0'
Gathering dependency information took 209 ms
Attempting to resolve dependencies for package 'Microsoft.Web.WebView2.1.0.992.28' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Web.WebView2.1.0.992.28'
Resolved actions to install package 'Microsoft.Web.WebView2.1.0.992.28'
Retrieving package 'Microsoft.Web.WebView2 1.0.992.28' from 'C:\Users\user\.nuget\packages\'.
Adding package 'Microsoft.Web.WebView2.1.0.992.28' to folder 'C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-tests\build_llvm\packages'
Added package 'Microsoft.Web.WebView2.1.0.992.28' to folder 'C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-tests\build_llvm\packages'
Successfully installed 'Microsoft.Web.WebView2 1.0.992.28' to C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-tests\build_llvm\packages
Executing nuget actions took 432 ms
-- Enabled axmol extensions:cocostudio;ImGui;fairygui;DragonBones;spine;physics-nodes;particle3d;assets-manager;GUI;
CMake cpp_tests target_precompile_headers
-- Configuring done (77.6s)
-- Generating done (4.4s)
-- Build files have been written to: C:/Users/user/Desktop/projects/axmol/axmol/tests/cpp-tests/build_llvm

Link error:

C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-tests>cmake --build build_llvm --config RelWithDebInfo
[1/500] cmd.exe /C "cd /D C:\Users\user\Desktop\projects\axmol\axmol\tests\cpp-test...C:\Program Files\CMake\bin\cmake.exe" -E echo "Syncing resources for cpp_tests ...""
Syncing resources for cpp_tests ...
[2/500] Running utility command for SYNC_RESOURCE-cpp_tests
    Syncing to C:/Users/user/Desktop/projects/axmol/axmol/tests/cpp-tests/build_llvm/bin/cpp_tests/RelWithDebInfo/Content
[3/500] Linking CXX shared library bin\RelWithDebInfo\OpenAL32.dll
FAILED: bin/RelWithDebInfo/OpenAL32.dll lib/RelWithDebInfo/OpenAL32.lib
cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -fuse-ld=lld-link -nostartfiles -nostdlib -O2 -D_DEBUG -g -Xclang -gcodeview -D_DLL -D_MT -Xclang --dependent-lib=msvcrt   -shared -o bin\RelWithDebInfo\OpenAL32.dll  -Xlinker /MANIFEST:EMBED -Xlinker /implib:lib\RelWithDebInfo\OpenAL32.lib -Xlinker /pdb:bin\RelWithDebInfo\OpenAL32.pdb -Xlinker /version:1.23 @CMakeFiles\OpenAL.RelWithDebInfo.rsp  && cd ."
lld-link: error: undefined symbol: __declspec(dllimport) _CrtDbgReport
>>> referenced by C:\Users\user\Desktop\projects\axmol\axmol\thirdparty\openal\al\auxeffectslot.cpp:358
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/al/auxeffectslot.cpp.obj:(alGenAuxiliaryEffectSlots)
>>> referenced by C:\Users\user\Desktop\projects\axmol\axmol\thirdparty\openal\al\auxeffectslot.cpp:358
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/al/auxeffectslot.cpp.obj:(alGenAuxiliaryEffectSlots)
>>> referenced by C:\Users\user\Desktop\projects\axmol\axmol\thirdparty\openal\al\auxeffectslot.cpp:247
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/al/auxeffectslot.cpp.obj:(bool __cdecl `anonymous namespace'::EnsureEffectSlots(struct ALCcontext *, unsigned __int64))
>>> referenced 1465 more times

lld-link: error: undefined symbol: __declspec(dllimport) _invalid_parameter
>>> referenced by C:\Users\user\Desktop\projects\axmol\axmol\thirdparty\openal\al\auxeffectslot.cpp:358
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/al/auxeffectslot.cpp.obj:(alGenAuxiliaryEffectSlots)
>>> referenced by C:\Users\user\Desktop\projects\axmol\axmol\thirdparty\openal\al\auxeffectslot.cpp:358
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/al/auxeffectslot.cpp.obj:(alGenAuxiliaryEffectSlots)
>>> referenced by C:\Users\user\Desktop\projects\axmol\axmol\thirdparty\openal\al\auxeffectslot.cpp:247
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/al/auxeffectslot.cpp.obj:(bool __cdecl `anonymous namespace'::EnsureEffectSlots(struct ALCcontext *, unsigned __int64))
>>> referenced 1450 more times

lld-link: error: undefined symbol: __declspec(dllimport) _CrtDbgReportW
>>> referenced by C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ppltasks.h:4028
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/alc/backends/wasapi.cpp.obj:(public: __cdecl Concurrency::task<void>::task<void><class `public: __cdecl std::_Task_async_state<long>::_Task_async_state<long><class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>>>(class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>> &&)'::`1'::<lambda_1>>(class `public: __cdecl std::_Task_async_state<long>::_Task_async_state<long><class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>>>(class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>> &&)'::`1'::<lambda_1>, class Concurrency::task_options const &))
>>> referenced by C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ppltasks.h:4028
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/alc/backends/wasapi.cpp.obj:(public: __cdecl Concurrency::task<void>::task<void><class `public: __cdecl std::_Task_async_state<long>::_Task_async_state<long><class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>>>(class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>> &&)'::`1'::<lambda_1>>(class `public: __cdecl std::_Task_async_state<long>::_Task_async_state<long><class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>>>(class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>> &&)'::`1'::<lambda_1>, class Concurrency::task_options const &))
>>> referenced by C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ppltasks.h:1466
>>>               engine/thirdparty/openal/CMakeFiles/OpenAL.dir/RelWithDebInfo/alc/backends/wasapi.cpp.obj:(public: virtual void __cdecl Concurrency::details::_PPLTaskHandle<unsigned char, struct Concurrency::task<unsigned char>::_InitialTaskHandle<void, class `public: __cdecl std::_Task_async_state<long>::_Task_async_state<long><class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>>>(class std::_Fake_no_copy_callable_adapter<class `public: virtual bool __cdecl WasapiBackendFactory::init(void)'::`1'::<lambda_0>> &&)'::`1'::<lambda_1>, struct Concurrency::details::_TypeSelectorNoAsync>, struct Concurrency::details::_TaskProcHandle>::invoke(void) const)
>>> referenced 38 more times

lld-link: error: undefined symbol: __declspec(dllimport) _free_dbg
>>> referenced by D:\a\_work\1\s\src\vctools\crt\github\stl\src\locale0.cpp:43
>>>               msvcprtd.lib(locale0_implib.obj):($LN3)

lld-link: error: undefined symbol: __declspec(dllimport) _malloc_dbg
>>> referenced by D:\a\_work\1\s\src\vctools\crt\github\stl\src\locale0.cpp:34
>>>               msvcprtd.lib(locale0_implib.obj):($LN6)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[12/500] Building CXX object engine/extensions/assets-manager/CMakeFiles/assets-manager.dir/RelWithDebInfo/Manifest.cpp.obj
ninja: build stopped: subcommand failed.

Not sure what this is, I don't understand how the ci passes

Versions: Clang 16.0 Ninja 1.11.1 CMake 3.26.0-rc5 Windows 10 SDK 10.0.19041.0 Visual Studio 2022 Community 17.5.3

git commit: 7a24a89ca8

halx99 commented 1 year ago

Do you try follow the action ci setup, run at root of axmol engine

halx99 commented 1 year ago

You can also go to axmol engine root directory, and use the powershell ci scirpt:

.\tools\win-ci\build.ps1 -arch x64 -is_clang true

If still have link error, try upgrade cmake to latest.

halx99 commented 1 year ago

I also run on directory axmol/tests/cpp-tests on my local machine, also works.

image
halx99 commented 1 year ago
PS E:\dev\axmol1\axmol\tests\cpp-tests> Invoke-Expression -Command "$env:AX_ROOT\tools\win-ci\build.ps1 -arch x64 -is_clang true -target cpp_tests"
halx99 commented 1 year ago
PS E:\dev\axmol1\axmol\tests\cpp-tests> Invoke-Expression -Command "$env:AX_ROOT\tools\win-ci\build.ps1 -arch x64 -is_clang true -target cpp_tests"

Needs latest commit with tools/win-ci/build.ps1 improvments.

iAndyHD3 commented 1 year ago

to give an update: building cpp-test with powershell script worked fine however on my project im still getting the openal link error. I'm trying different cmake commands but it takes time. will update again later