baresip/re

Build error on Windows ARM

Closed this issue · 3 comments

Configure:

[1/2] "D:/downloads/tools/cmake-3.25.1-windows/cmake-3.25.1-windows-i386/bin/cmake.exe" -E chdir ".." "D:/downloads/tools/cmake-3.25.1-windows/cmake-3.25.1-windows-i386/bin/cmake.exe" "D:/buildtrees/libre/src/v3.0.0-dbb7e97127.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:/packages/libre_arm64-windows" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DCMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/a/1/s/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=arm64-windows" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v143" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=C:/a/1/s/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=arm64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=C:/a/1/s" "-D_VCPKG_INSTALLED_DIR=D:/installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
-- The C compiler identification is MSVC 19.35.32217.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.35.32215/bin/Hostx64/arm64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test COMPILER_SUPPORTS_WATOMIC
-- Performing Test COMPILER_SUPPORTS_WATOMIC - Failed
-- Looking for backtrace
-- Looking for backtrace - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) 
-- 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
-- Found Threads: TRUE  
-- Found ZLIB: optimized;D:/installed/arm64-windows/lib/zlib.lib;debug;D:/installed/arm64-windows/debug/lib/zlibd.lib (found version "1.2.13") 
-- Found OpenSSL: optimized;D:/installed/arm64-windows/lib/libcrypto.lib;debug;D:/installed/arm64-windows/debug/lib/libcrypto.lib (found suitable version "3.1.0", minimum required is "1.1.0")  
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for syslog.h
-- Looking for syslog.h - not found
-- Looking for getopt.h
-- Looking for getopt.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for res_ninit
-- Looking for res_ninit - not found
-- Looking for thrd_create
-- Looking for thrd_create - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for sys/prctl.h
-- Looking for sys/prctl.h - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    FETCHCONTENT_FULLY_DISCONNECTED
    _VCPKG_ROOT_DIR


-- Build files have been written to: D:/buildtrees/libre/arm64-windows-rel
[2/2] "D:/downloads/tools/cmake-3.25.1-windows/cmake-3.25.1-windows-i386/bin/cmake.exe" -E chdir "../../arm64-windows-dbg" "D:/downloads/tools/cmake-3.25.1-windows/cmake-3.25.1-windows-i386/bin/cmake.exe" "D:/buildtrees/libre/src/v3.0.0-dbb7e97127.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=D:/packages/libre_arm64-windows/debug" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DCMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/a/1/s/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=arm64-windows" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v143" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=C:/a/1/s/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=arm64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=C:/a/1/s" "-D_VCPKG_INSTALLED_DIR=D:/installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
-- The C compiler identification is MSVC 19.35.32217.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.35.32215/bin/Hostx64/arm64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test COMPILER_SUPPORTS_WATOMIC
-- Performing Test COMPILER_SUPPORTS_WATOMIC - Failed
-- Looking for backtrace
-- Looking for backtrace - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) 
-- 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
-- Found Threads: TRUE  
-- Found ZLIB: optimized;D:/installed/arm64-windows/lib/zlib.lib;debug;D:/installed/arm64-windows/debug/lib/zlibd.lib (found version "1.2.13") 
-- Found OpenSSL: optimized;D:/installed/arm64-windows/lib/libcrypto.lib;debug;D:/installed/arm64-windows/debug/lib/libcrypto.lib (found suitable version "3.1.0", minimum required is "1.1.0")  
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for syslog.h
-- Looking for syslog.h - not found
-- Looking for getopt.h
-- Looking for getopt.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for res_ninit
-- Looking for res_ninit - not found
-- Looking for thrd_create
-- Looking for thrd_create - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for sys/prctl.h
-- Looking for sys/prctl.h - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR) 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    FETCHCONTENT_FULLY_DISCONNECTED
    _VCPKG_ROOT_DIR


-- Build files have been written to: D:/buildtrees/libre/arm64-windows-dbg

Build:

[35/238] C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1435~1.322\bin\Hostx64\arm64\cl.exe   -DARCH=\"ARM64\" -DHAVE_ATOMIC -DHAVE_INET6 -DHAVE_IO_H -DHAVE_SELECT -DHAVE_UNIXSOCK=1 -DOS=\"Windows\" -DUSE_DTLS -DUSE_OPENSSL -DUSE_OPENSSL_AES -DUSE_OPENSSL_DTLS -DUSE_OPENSSL_HMAC -DUSE_OPENSSL_SRTP -DUSE_TLS -DUSE_ZLIB -DVERSION=\"3.0.0\" -DVER_MAJOR=3 -DVER_MINOR=0 -DVER_PATCH=0 -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_WIN32_WINNT=0x0600 -ID:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\. -ID:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\include -ID:\installed\arm64-windows\include /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP  /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  /W3 /showIncludes /FoCMakeFiles\re-objs.dir\src\mem\mem.c.obj /FdCMakeFiles\re-objs.dir\ /FS -c D:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\src\mem\mem.c
FAILED: CMakeFiles/re-objs.dir/src/mem/mem.c.obj 
C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1435~1.322\bin\Hostx64\arm64\cl.exe   -DARCH=\"ARM64\" -DHAVE_ATOMIC -DHAVE_INET6 -DHAVE_IO_H -DHAVE_SELECT -DHAVE_UNIXSOCK=1 -DOS=\"Windows\" -DUSE_DTLS -DUSE_OPENSSL -DUSE_OPENSSL_AES -DUSE_OPENSSL_DTLS -DUSE_OPENSSL_HMAC -DUSE_OPENSSL_SRTP -DUSE_TLS -DUSE_ZLIB -DVERSION=\"3.0.0\" -DVER_MAJOR=3 -DVER_MINOR=0 -DVER_PATCH=0 -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_WIN32_WINNT=0x0600 -ID:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\. -ID:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\include -ID:\installed\arm64-windows\include /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP  /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  /W3 /showIncludes /FoCMakeFiles\re-objs.dir\src\mem\mem.c.obj /FdCMakeFiles\re-objs.dir\ /FS -c D:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\src\mem\mem.c
D:\buildtrees\libre\src\v3.0.0-dbb7e97127.clean\include\re_atomic.h(617): error C2065: 'mo': undeclared identifier

the relevant code:

static __forceinline unsigned __int64 _re_atomic_load(
	size_t size, const void *a)
{
	unsigned __int64 v;
	assert(size == 1u || size == 2u || size == 4u || size == 8u);
	_ReadWriteBarrier();

	switch (size) {
	case 1u:
		v = __iso_volatile_load8((const unsigned __int8*)a);
		break;
	case 2u:
		v = __iso_volatile_load16((const unsigned __int16*)a);
		break;
	case 4u:
		v = __iso_volatile_load32((const unsigned __int32*)a);
		break;
	default:
		v = __iso_volatile_load64((const unsigned __int64*)a);
		break;
	}

	_ReadWriteBarrier();

	if (mo != re_memory_order_relaxed && mo <= re_memory_order_acquire)  // <---!
		__dmb(0x0b); /* dmb ish */

	_ReadWriteBarrier();

	return v;
}

what is "mo" ?

what is "mo" ?

Stands for memory order (arg is missing), is mostly unneeded for load, but arm is a special case I think.

@Lastique can you have a look.

Yes, this is supposed to be a memory order argument. Please, check if #766 fixes this.