Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Werner <stewreo@gmail.com>2020-07-16 10:25:55 +0300
committerStefan Werner <stewreo@gmail.com>2020-07-16 10:37:38 +0300
commit9715ad5acad9a42b65efd64b6c7fbe157f949bfb (patch)
tree9a68c332ede76d239ee45e970171df6864bf4633 /build_files/build_environment/patches
parentad4928a1710fe96749484b3823513d3f7c5624aa (diff)
macOS: Support arm64 architecture.
Enabling all `make deps` dependencies with the exception of Embree and OIDN. After that, Blender can be compiled on an Apple Silicon Mac just like on any Intel based Mac. There are still compiler warnings that need to be investigated and there are probably a couple of bug still to be discovered and to be fixed. Most patches to the dependencies are simple and are about disabling SSE and setting the proper architecture to compiile for. Notable exception is Python, where I back ported a yet to be accepted PR for upstream Python: https://github.com/python/cpython/pull/21249 Cross compiling or buliding a Universal Binary is not supported yet. The minimum macOS target version for x86_64 remains at 10.13, the target for arm64 is 11.00. Differential Revision: https://developer.blender.org/D8236
Diffstat (limited to 'build_files/build_environment/patches')
-rw-r--r--build_files/build_environment/patches/blosc.diff38
-rw-r--r--build_files/build_environment/patches/numpy.diff27
-rw-r--r--build_files/build_environment/patches/opencollada.diff44
-rw-r--r--build_files/build_environment/patches/openmp.diff23
-rw-r--r--build_files/build_environment/patches/python_macos.diff289
-rw-r--r--build_files/build_environment/patches/sqlite.diff14
-rw-r--r--build_files/build_environment/patches/theora.diff18
-rw-r--r--build_files/build_environment/patches/usd.diff33
8 files changed, 486 insertions, 0 deletions
diff --git a/build_files/build_environment/patches/blosc.diff b/build_files/build_environment/patches/blosc.diff
index ee5826a2e98..0080694fae1 100644
--- a/build_files/build_environment/patches/blosc.diff
+++ b/build_files/build_environment/patches/blosc.diff
@@ -91,3 +91,41 @@ diff -Naur external_blosc.orig/blosc/blosc.c external_blosc/blosc/blosc.c
/* Some useful units */
+ diff --git a/blosc/shuffle.c b/blosc/shuffle.c
+ index 84b5095..23053b4 100644
+ --- a/blosc/shuffle.c
+ +++ b/blosc/shuffle.c
+ @@ -490,12 +490,12 @@ void unshuffle(size_t bytesoftype, size_t blocksize,
+ #else /* no __SSE2__ available */
+
+ void shuffle(size_t bytesoftype, size_t blocksize,
+ - uint8_t* _src, uint8_t* _dest) {
+ + const uint8_t* _src, uint8_t* _dest) {
+ _shuffle(bytesoftype, blocksize, _src, _dest);
+ }
+
+ void unshuffle(size_t bytesoftype, size_t blocksize,
+ - uint8_t* _src, uint8_t* _dest) {
+ + const uint8_t* _src, uint8_t* _dest) {
+ _unshuffle(bytesoftype, blocksize, _src, _dest);
+ }
+ --- a/cmake/FindSSE.cmake
+ +++ b/cmake/FindSSE.cmake
+ @@ -49,6 +49,17 @@
+ set(AVX_FOUND false CACHE BOOL "AVX available on host")
+ ENDIF (AVX_TRUE)
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ + execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ + message(STATUS "Detected architecture ${ARCHITECTURE}")
+ + IF("${ARCHITECTURE}" STREQUAL "arm64")
+ + set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
+ + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
+ + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
+ + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
+ + set(AVX_FOUND false CACHE BOOL "AVX available on host")
+ + return()
+ + ENDIF()
+ +
+ EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
+ CPUINFO)
+ \ No newline at end of file
diff --git a/build_files/build_environment/patches/numpy.diff b/build_files/build_environment/patches/numpy.diff
new file mode 100644
index 00000000000..a9b783dd856
--- /dev/null
+++ b/build_files/build_environment/patches/numpy.diff
@@ -0,0 +1,27 @@
+diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
+index ba2b1f4..b10f7df 100644
+--- a/numpy/distutils/system_info.py
++++ b/numpy/distutils/system_info.py
+@@ -2164,8 +2164,8 @@ class accelerate_info(system_info):
+ 'accelerate' in libraries):
+ if intel:
+ args.extend(['-msse3'])
+- else:
+- args.extend(['-faltivec'])
++# else:
++# args.extend(['-faltivec'])
+ args.extend([
+ '-I/System/Library/Frameworks/vecLib.framework/Headers'])
+ link_args.extend(['-Wl,-framework', '-Wl,Accelerate'])
+@@ -2174,8 +2174,8 @@ class accelerate_info(system_info):
+ 'veclib' in libraries):
+ if intel:
+ args.extend(['-msse3'])
+- else:
+- args.extend(['-faltivec'])
++# else:
++# args.extend(['-faltivec'])
+ args.extend([
+ '-I/System/Library/Frameworks/vecLib.framework/Headers'])
+ link_args.extend(['-Wl,-framework', '-Wl,vecLib'])
+
diff --git a/build_files/build_environment/patches/opencollada.diff b/build_files/build_environment/patches/opencollada.diff
index cd4cc2c1652..e8efc1a6909 100644
--- a/build_files/build_environment/patches/opencollada.diff
+++ b/build_files/build_environment/patches/opencollada.diff
@@ -86,3 +86,47 @@ index 1f9a3ee..d151e9a 100644
return isnan( value );
#else
return std::isnan(value);
+
+
+diff --git a/DAEValidator/library/src/Dae.cpp b/DAEValidator/library/src/Dae.cpp
+index 9256ee1..241ad67 100644
+--- a/DAEValidator/library/src/Dae.cpp
++++ b/DAEValidator/library/src/Dae.cpp
+@@ -304,7 +304,7 @@ namespace opencollada
+ if (auto root_node = root())
+ {
+ const auto & nodes = root_node.selectNodes("//*[@id]");
+- for (const auto & node : nodes)
++ for (const auto node : nodes)
+ {
+ string id = node.attribute("id").value();
+ mIdCache.insert(id);
+@@ -312,4 +312,4 @@ namespace opencollada
+ }
+ }
+ }
+-}
+\ No newline at end of file
++}
+diff --git a/DAEValidator/library/src/DaeValidator.cpp b/DAEValidator/library/src/DaeValidator.cpp
+index 715d903..24423ce 100644
+--- a/DAEValidator/library/src/DaeValidator.cpp
++++ b/DAEValidator/library/src/DaeValidator.cpp
+@@ -162,7 +162,7 @@ namespace opencollada
+
+ // Find xsi:schemaLocation attributes in dae and try to validate against specified xsd documents
+ const auto & elements = dae.root().selectNodes("//*[@xsi:schemaLocation]");
+- for (const auto & element : elements)
++ for (const auto element : elements)
+ {
+ if (auto schemaLocation = element.attribute("schemaLocation"))
+ {
+@@ -274,7 +274,7 @@ namespace opencollada
+ int result = 0;
+ map<string, size_t> ids;
+ const auto & nodes = dae.root().selectNodes("//*[@id]");
+- for (const auto & node : nodes)
++ for (const auto node : nodes)
+ {
+ string id = node.attribute("id").value();
+ size_t line = node.line();
diff --git a/build_files/build_environment/patches/openmp.diff b/build_files/build_environment/patches/openmp.diff
new file mode 100644
index 00000000000..201ab5c7713
--- /dev/null
+++ b/build_files/build_environment/patches/openmp.diff
@@ -0,0 +1,23 @@
+diff --git a/runtime/src/z_Linux_asm.S b/runtime/src/z_Linux_asm.S
+index 0d8885e..42aa5ad 100644
+--- a/runtime/src/z_Linux_asm.S
++++ b/runtime/src/z_Linux_asm.S
+@@ -1540,10 +1540,12 @@ __kmp_unnamed_critical_addr:
+ .comm .gomp_critical_user_,32,8
+ .data
+ .align 8
+- .global __kmp_unnamed_critical_addr
+-__kmp_unnamed_critical_addr:
++ .global ___kmp_unnamed_critical_addr
++___kmp_unnamed_critical_addr:
+ .8byte .gomp_critical_user_
+- .size __kmp_unnamed_critical_addr,8
++# if !(KMP_OS_DARWIN)
++ .size ___kmp_unnamed_critical_addr,8
++# endif
+ #endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 */
+
+ #if KMP_OS_LINUX
+
+
+
diff --git a/build_files/build_environment/patches/python_macos.diff b/build_files/build_environment/patches/python_macos.diff
new file mode 100644
index 00000000000..22ccbebee2f
--- /dev/null
+++ b/build_files/build_environment/patches/python_macos.diff
@@ -0,0 +1,289 @@
+diff -ru a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
+--- a/Doc/library/ctypes.rst 2020-03-10 07:11:12.000000000 +0100
++++ b/Doc/library/ctypes.rst 2020-07-14 08:10:10.000000000 +0200
+@@ -1551,6 +1551,13 @@
+ value usable as argument (integer, string, ctypes instance). This allows
+ defining adapters that can adapt custom objects as function parameters.
+
++ .. attribute:: variadic
++
++ Assign a boolean to specify that the function takes a variable number of
++ arguments. This does not matter on most platforms, but for Apple arm64
++ platforms variadic functions have a different calling convention than
++ normal functions.
++
+ .. attribute:: errcheck
+
+ Assign a Python function or another callable to this attribute. The
+diff -ru a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
+--- a/Modules/_ctypes/_ctypes.c 2020-03-10 07:11:12.000000000 +0100
++++ b/Modules/_ctypes/_ctypes.c 2020-07-14 08:14:41.000000000 +0200
+@@ -3175,6 +3175,35 @@
+ }
+
+ static int
++PyCFuncPtr_set_variadic(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
++{
++ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
++ assert(dict);
++ int r = PyObject_IsTrue(ob);
++ if (r == 1) {
++ dict->flags |= FUNCFLAG_VARIADIC;
++ return 0;
++ } else if (r == 0) {
++ dict->flags &= ~FUNCFLAG_VARIADIC;
++ return 0;
++ } else {
++ return -1;
++ }
++}
++
++static PyObject *
++PyCFuncPtr_get_variadic(PyCFuncPtrObject *self, void *Py_UNUSED(ignored))
++{
++ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
++ assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
++ if (dict->flags & FUNCFLAG_VARIADIC)
++ Py_RETURN_TRUE;
++ else
++ Py_RETURN_FALSE;
++}
++
++
++static int
+ PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
+ {
+ PyObject *converters;
+@@ -5632,6 +5661,7 @@
+ PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
+ PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
+ PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
++ PyModule_AddObject(m, "FUNCFLAG_VARIADIC", PyLong_FromLong(FUNCFLAG_VARIADIC));
+ PyModule_AddStringConstant(m, "__version__", "1.1.0");
+
+ PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
+diff -ru a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
+--- a/Modules/_ctypes/callproc.c 2020-03-10 07:11:12.000000000 +0100
++++ b/Modules/_ctypes/callproc.c 2020-07-14 08:18:33.000000000 +0200
+@@ -767,7 +767,8 @@
+ ffi_type **atypes,
+ ffi_type *restype,
+ void *resmem,
+- int argcount)
++ int argcount,
++ int argtypecount)
+ {
+ PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
+ PyObject *error_object = NULL;
+@@ -793,15 +794,38 @@
+ if ((flags & FUNCFLAG_CDECL) == 0)
+ cc = FFI_STDCALL;
+ #endif
+- if (FFI_OK != ffi_prep_cif(&cif,
+- cc,
+- argcount,
+- restype,
+- atypes)) {
+- PyErr_SetString(PyExc_RuntimeError,
+- "ffi_prep_cif failed");
+- return -1;
+- }
++#if HAVE_FFI_PREP_CIF_VAR
++ /* Everyone SHOULD set f.variadic=True on variadic function pointers, but
++ * lots of existing code will not. If there's at least one arg and more
++ * args are passed than are defined in the prototype, then it must be a
++ * variadic function. */
++ if ((flags & FUNCFLAG_VARIADIC) ||
++ (argtypecount != 0 && argcount > argtypecount))
++ {
++ if (FFI_OK != ffi_prep_cif_var(&cif,
++ cc,
++ argtypecount,
++ argcount,
++ restype,
++ atypes)) {
++ PyErr_SetString(PyExc_RuntimeError,
++ "ffi_prep_cif_var failed");
++ return -1;
++ }
++ } else {
++#endif
++ if (FFI_OK != ffi_prep_cif(&cif,
++ cc,
++ argcount,
++ restype,
++ atypes)) {
++ PyErr_SetString(PyExc_RuntimeError,
++ "ffi_prep_cif failed");
++ return -1;
++ }
++#if HAVE_FFI_PREP_CIF_VAR
++ }
++#endif
+
+ if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) {
+ error_object = _ctypes_get_errobj(&space);
+@@ -1185,9 +1209,8 @@
+
+ if (-1 == _call_function_pointer(flags, pProc, avalues, atypes,
+ rtype, resbuf,
+- Py_SAFE_DOWNCAST(argcount,
+- Py_ssize_t,
+- int)))
++ Py_SAFE_DOWNCAST(argcount, Py_ssize_t, int),
++ Py_SAFE_DOWNCAST(argtype_count, Py_ssize_t, int)))
+ goto cleanup;
+
+ #ifdef WORDS_BIGENDIAN
+diff -ru a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
+--- a/Modules/_ctypes/ctypes.h 2020-03-10 07:11:12.000000000 +0100
++++ b/Modules/_ctypes/ctypes.h 2020-07-14 08:30:53.000000000 +0200
+@@ -285,6 +285,7 @@
+ #define FUNCFLAG_PYTHONAPI 0x4
+ #define FUNCFLAG_USE_ERRNO 0x8
+ #define FUNCFLAG_USE_LASTERROR 0x10
++#define FUNCFLAG_VARIADIC 0x20
+
+ #define TYPEFLAG_ISPOINTER 0x100
+ #define TYPEFLAG_HASPOINTER 0x200
+diff -ru a/configure b/configure
+--- a/configure 2020-03-10 07:11:12.000000000 +0100
++++ b/configure 2020-07-14 08:03:27.000000000 +0200
+@@ -3374,7 +3374,7 @@
+ # has no effect, don't bother defining them
+ Darwin/[6789].*)
+ define_xopen_source=no;;
+- Darwin/1[0-9].*)
++ Darwin/[12][0-9].*)
+ define_xopen_source=no;;
+ # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
+ # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
+@@ -9251,6 +9251,9 @@
+ ppc)
+ MACOSX_DEFAULT_ARCH="ppc64"
+ ;;
++ arm64)
++ MACOSX_DEFAULT_ARCH="arm64"
++ ;;
+ *)
+ as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
+ ;;
+diff -ru a/configure.ac b/configure.ac
+--- a/configure.ac 2020-03-10 07:11:12.000000000 +0100
++++ b/configure.ac 2020-07-14 08:03:27.000000000 +0200
+@@ -2456,6 +2456,9 @@
+ ppc)
+ MACOSX_DEFAULT_ARCH="ppc64"
+ ;;
++ arm64)
++ MACOSX_DEFAULT_ARCH="arm64"
++ ;;
+ *)
+ AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
+ ;;
+diff -ru a/setup.py b/setup.py
+--- a/setup.py 2020-03-10 07:11:12.000000000 +0100
++++ b/setup.py 2020-07-14 08:28:12.000000000 +0200
+@@ -141,6 +141,13 @@
+ os.unlink(tmpfile)
+
+ return MACOS_SDK_ROOT
++
++def is_macosx_at_least(vers):
++ if host_platform == 'darwin':
++ dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
++ if dep_target:
++ return tuple(map(int, dep_target.split('.'))) >= vers
++ return False
+
+ def is_macosx_sdk_path(path):
+ """
+@@ -150,6 +157,13 @@
+ or path.startswith('/System/')
+ or path.startswith('/Library/') )
+
++def grep_headers_for(function, headers):
++ for header in headers:
++ with open(header, 'r') as f:
++ if function in f.read():
++ return True
++ return False
++
+ def find_file(filename, std_dirs, paths):
+ """Searches for the directory where a given file is located,
+ and returns a possibly-empty list of additional directories, or None
+@@ -1972,7 +1986,11 @@
+ return True
+
+ def detect_ctypes(self, inc_dirs, lib_dirs):
+- self.use_system_libffi = False
++ if not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and is_macosx_at_least((10,15)):
++ self.use_system_libffi = True
++ else:
++ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
++
+ include_dirs = []
+ extra_compile_args = []
+ extra_link_args = []
+@@ -2016,32 +2034,48 @@
+ ext_test = Extension('_ctypes_test',
+ sources=['_ctypes/_ctypes_test.c'],
+ libraries=['m'])
++ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
++ ffi_lib = None
++
+ self.extensions.extend([ext, ext_test])
+
+ if host_platform == 'darwin':
+- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
++ if not self.use_system_libffi:
+ return
+- # OS X 10.5 comes with libffi.dylib; the include files are
+- # in /usr/include/ffi
+- inc_dirs.append('/usr/include/ffi')
+-
+- ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
+- if not ffi_inc or ffi_inc[0] == '':
+- ffi_inc = find_file('ffi.h', [], inc_dirs)
+- if ffi_inc is not None:
+- ffi_h = ffi_inc[0] + '/ffi.h'
++ ffi_in_sdk = os.path.join(macosx_sdk_root(), "usr/include/ffi")
++ if os.path.exists(ffi_in_sdk):
++ ffi_inc = ffi_in_sdk
++ ffi_lib = 'ffi'
++ else:
++ # OS X 10.5 comes with libffi.dylib; the include files are
++ # in /usr/include/ffi
++ ffi_inc_dirs.append('/usr/include/ffi')
++
++ if not ffi_inc:
++ found = find_file('ffi.h', [], ffi_inc_dirs)
++ if found:
++ ffi_inc = found[0]
++ if ffi_inc:
++ ffi_h = ffi_inc + '/ffi.h'
+ if not os.path.exists(ffi_h):
+ ffi_inc = None
+ print('Header file {} does not exist'.format(ffi_h))
+- ffi_lib = None
+- if ffi_inc is not None:
++ if ffi_lib is None and ffi_inc:
+ for lib_name in ('ffi', 'ffi_pic'):
+ if (self.compiler.find_library_file(lib_dirs, lib_name)):
+ ffi_lib = lib_name
+ break
+
+ if ffi_inc and ffi_lib:
+- ext.include_dirs.extend(ffi_inc)
++ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
++ if grep_headers_for('ffi_closure_alloc', ffi_headers):
++ try:
++ sources.remove('_ctypes/malloc_closure.c')
++ except ValueError:
++ pass
++ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
++ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
++ ext.include_dirs.append(ffi_inc)
+ ext.libraries.append(ffi_lib)
+ self.use_system_libffi = True
+
diff --git a/build_files/build_environment/patches/sqlite.diff b/build_files/build_environment/patches/sqlite.diff
new file mode 100644
index 00000000000..80f1384f9cf
--- /dev/null
+++ b/build_files/build_environment/patches/sqlite.diff
@@ -0,0 +1,14 @@
+Only in external_sqlite_orig: config.log
+diff -ru external_sqlite_orig/config.sub external_sqlite/config.sub
+--- external_sqlite_orig/config.sub 2020-07-10 14:06:42.000000000 +0200
++++ external_sqlite/config.sub 2020-07-10 14:10:24.000000000 +0200
+@@ -314,6 +314,7 @@
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
++ | aarch64-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+Only in external_sqlite: mksourceid
+Only in external_sqlite: sqlite3session.h
diff --git a/build_files/build_environment/patches/theora.diff b/build_files/build_environment/patches/theora.diff
new file mode 100644
index 00000000000..3abadb66be9
--- /dev/null
+++ b/build_files/build_environment/patches/theora.diff
@@ -0,0 +1,18 @@
+--- config.sub
++++ config.sub
+@@ -226,6 +226,7 @@
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
++ | aarch64 \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+@@ -286,6 +287,7 @@
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
++ | aarch64-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
diff --git a/build_files/build_environment/patches/usd.diff b/build_files/build_environment/patches/usd.diff
index 8f457271a5c..fe767829a70 100644
--- a/build_files/build_environment/patches/usd.diff
+++ b/build_files/build_environment/patches/usd.diff
@@ -97,3 +97,36 @@ diff -Naur external_usd_base/cmake/macros/Public.cmake external_usd/cmake/macros
endforeach()
foreach(lib ${PXR_OBJECT_LIBS})
set(objects "${objects};\$<TARGET_OBJECTS:${lib}>")
+
+diff --git a/pxr/base/arch/align.h b/pxr/base/arch/align.h
+index f3cabf4..ebc8a69 100644
+--- a/pxr/base/arch/align.h
++++ b/pxr/base/arch/align.h
+@@ -77,7 +77,11 @@ ArchAlignMemory(void *base)
+ /// The size of a CPU cache line on the current processor architecture in bytes.
+ ///
+ /// \hideinitializer
++#if defined(ARCH_OS_DARWIN) && defined(ARCH_CPU_ARM)
++#define ARCH_CACHE_LINE_SIZE 128
++#else
+ #define ARCH_CACHE_LINE_SIZE 64
++#endif
+
+ ///@}
+
+diff --git a/pxr/base/arch/math.h b/pxr/base/arch/math.h
+index 3e66c37..64a052c 100644
+--- a/pxr/base/arch/math.h
++++ b/pxr/base/arch/math.h
+@@ -42,7 +42,7 @@ PXR_NAMESPACE_OPEN_SCOPE
+ /// \addtogroup group_arch_Math
+ ///@{
+
+-#if defined (ARCH_CPU_INTEL) || defined(doxygen)
++#if defined (ARCH_CPU_INTEL) || defined(ARCH_CPU_ARM) || defined(doxygen)
+
+ /// This is the smallest value e such that 1+e^2 == 1, using floats.
+ /// True for all IEEE754 chipsets.
+
+
+