Repository: borgbackup/borg

Issue:
build issue (with potential fix) on bigendian architectures
## Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

## Is this a BUG / ISSUE report or a QUESTION?

Bug, seems already resolved in master but present in 1.1 branch (at least no sign of `__BIG_ENDIAN__` in `setup.py` in master)

## System information. For client/server mode post info for both machines.

#### Your borg version (borg -V).
1.1.17

#### Operating system (distribution) and version.
SynoCommunity, Synology DSM-6 (linux)

#### Hardware / network configuration, and filesystems used. 
PPC qoriq arch

#### How much data is handled by borg?
n/a - build issue only on PPC due to endianess

#### Full borg commandline that lead to the problem (leave away excludes and passwords)
n/a

## Describe the problem you're observing.
build log:
```
Collecting borgbackup==1.1.17
  Using cached borgbackup-1.1.17.tar.gz (3.8 MB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: borgbackup
  Building wheel for borgbackup (setup.py): started
  Building wheel for borgbackup (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/crossenv/cross/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-t50qub2n/borgbackup_de5df87e60224e6ca41dbf5168a72ac2/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-t50qub2n/borgbackup_de5df87e60224e6ca41dbf5168a72ac2/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-zr688xe_
       cwd: /tmp/pip-wheel-t50qub2n/borgbackup_de5df87e60224e6ca41dbf5168a72ac2/
  Complete output (125 lines):
  Detected and preferring liblz4 over bundled LZ4
  Detected and preferring libb2 over bundled BLAKE2
  Detected and preferring libzstd over bundled ZSTD
  /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/crossenv/build/lib/python3.10/site-packages/setuptools/__init__.py:148: SetuptoolsDeprecationWarning: setup_requires is deprecated. Supply build dependencies using PEP 517 pyproject.toml build-requires.
    warnings.warn(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/__init__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/__main__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/_version.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/archive.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/archiver.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/cache.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/constants.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/fuse.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/helpers.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/locking.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/logger.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/lrucache.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/nanorst.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/patterns.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/remote.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/repository.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/selftest.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/shellpattern.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/upgrader.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/version.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/xattr.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms
  copying src/borg/algorithms/__init__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/crypto
  copying src/borg/crypto/__init__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/crypto
  copying src/borg/crypto/file_integrity.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/crypto
  copying src/borg/crypto/key.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/crypto
  copying src/borg/crypto/keymanager.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/crypto
  copying src/borg/crypto/nonces.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/crypto
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/platform
  copying src/borg/platform/__init__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/platform
  copying src/borg/platform/base.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/platform
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/__init__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/archive.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/archiver.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/benchmark.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/cache.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/checksums.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/chunker.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/compress.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/crypto.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/file_integrity.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/hashindex.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/helpers.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/item.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/key.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/locking.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/logger.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/lrucache.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/nanorst.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/nonces.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/patterns.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/platform.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/remote.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/repository.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/shellpattern.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/upgrader.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/version.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  copying src/borg/testsuite/xattr.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  creating build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms/msgpack
  copying src/borg/algorithms/msgpack/__init__.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms/msgpack
  copying src/borg/algorithms/msgpack/_version.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms/msgpack
  copying src/borg/algorithms/msgpack/exceptions.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms/msgpack
  copying src/borg/algorithms/msgpack/fallback.py -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/algorithms/msgpack
  running egg_info
  writing src/borgbackup.egg-info/PKG-INFO
  writing dependency_links to src/borgbackup.egg-info/dependency_links.txt
  writing entry points to src/borgbackup.egg-info/entry_points.txt
  writing requirements to src/borgbackup.egg-info/requires.txt
  writing top-level names to src/borgbackup.egg-info/top_level.txt
  listing git files failed - pretending there aren't any
  reading manifest file 'src/borgbackup.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files found matching '.coafile'
  warning: no previously-included files found matching '.editorconfig'
  warning: no previously-included files found matching '.gitattributes'
  warning: no previously-included files found matching '.gitignore'
  warning: no previously-included files found matching '.mailmap'
  warning: no previously-included files found matching 'Vagrantfile'
  no previously-included directories found matching '.github'
  adding license file 'LICENSE'
  adding license file 'AUTHORS'
  writing manifest file 'src/borgbackup.egg-info/SOURCES.txt'
  copying src/borg/paperkey.html -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg
  copying src/borg/testsuite/attic.tar.gz -> build/lib.powerpc-e500v2-linux-gnuspe-3.10/borg/testsuite
  running build_ext
  skipping 'src/borg/algorithms/msgpack/_packer.cpp' Cython extension (up-to-date)
  skipping 'src/borg/algorithms/msgpack/_unpacker.cpp' Cython extension (up-to-date)
  skipping 'src/borg/compress.c' Cython extension (up-to-date)
  skipping 'src/borg/crypto/low_level.c' Cython extension (up-to-date)
  skipping 'src/borg/hashindex.c' Cython extension (up-to-date)
  skipping 'src/borg/item.c' Cython extension (up-to-date)
  skipping 'src/borg/chunker.c' Cython extension (up-to-date)
  skipping 'src/borg/algorithms/checksums.c' Cython extension (up-to-date)
  skipping 'src/borg/platform/posix.c' Cython extension (up-to-date)
  skipping 'src/borg/platform/linux.c' Cython extension (up-to-date)
  skipping 'src/borg/platform/syncfilerange.c' Cython extension (up-to-date)
  building 'borg.algorithms.msgpack._packer' extension
  creating build/temp.powerpc-e500v2-linux-gnuspe-3.10
  creating build/temp.powerpc-e500v2-linux-gnuspe-3.10/src
  creating build/temp.powerpc-e500v2-linux-gnuspe-3.10/src/borg
  creating build/temp.powerpc-e500v2-linux-gnuspe-3.10/src/borg/algorithms
  creating build/temp.powerpc-e500v2-linux-gnuspe-3.10/src/borg/algorithms/msgpack
  /home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include -mcpu=8548 -mhard-float -mfloat-gprs=double -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install//var/packages/borgbackup/target/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -L /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/lib -I /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include -I/home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include -mcpu=8548 -mhard-float -mfloat-gprs=double -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install//var/packages/borgbackup/target/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -L /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/lib -I /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include -I/home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include -mcpu=8548 -mhard-float -mfloat-gprs=double -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install//var/packages/borgbackup/target/include -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include/python3.10 -I/home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include -mcpu=8548 -mhard-float -mfloat-gprs=double -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install//var/packages/borgbackup/target/include -fPIC -D__LITTLE_ENDIAN__=1 -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include -Isrc/borg/algorithms/xxh64/. -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/crossenv/cross/include -I/home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include/python3.10 -c src/borg/algorithms/msgpack/_packer.cpp -o build/temp.powerpc-e500v2-linux-gnuspe-3.10/src/borg/algorithms/msgpack/_packer.o
  In file included from /home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include/endian.h:36:0,
                   from /home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include/bits/waitstatus.h:64,
                   from /home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include/stdlib.h:42,
                   from /home/spksrc/borgbackup-udpate/spksrc/spk/borgbackup/work-qoriq-6.1/install/var/packages/borgbackup/target/include/python3.10/Python.h:34,
                   from src/borg/algorithms/msgpack/_packer.cpp:6:
  /home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include/bits/endian.h:26:4: error: #error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
   #  error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
      ^
  error: command '/home/spksrc/borgbackup-udpate/spksrc/toolchain/syno-qoriq-6.1/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for borgbackup
  Running setup.py clean for borgbackup
Failed to build borgbackup
ERROR: Failed to build one or more wheels

```

#### Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
Always, only fails on PPC.

#### 
Include any warning/errors/backtraces from the system logs
 Actual patch we use to circumvent this (a workaround upstream part of next release would be really great!)
https://github.com/SynoCommunity/spksrc/commit/72866f653fcff3f6862a417545a070f618c2d907#diff-7b228d5ca562f5bc3b0ebfbbe98d851ed882feab3721fbb04b57ad844256eb78
```
Disables pseudo logic made to enforce setting of macros which are actually already defined in corresponding headers.

--- setup.py
+++ setup.py
@@ -804,20 +804,16 @@ if not on_rtd:
                                                system_prefix=libb2_prefix, system=libb2_system,
                                                **crypto_ext_kwargs)

-    msgpack_endian = '__BIG_ENDIAN__' if (sys.byteorder == 'big') else '__LITTLE_ENDIAN__'
-    msgpack_macros = [(msgpack_endian, '1')]
     msgpack_packer_ext_kwargs = dict(
         sources=[msgpack_packer_source],
         include_dirs=include_dirs,
         library_dirs=library_dirs,
-        define_macros=msgpack_macros,
         language='c++',
     )
     msgpack_unpacker_ext_kwargs = dict(
         sources=[msgpack_unpacker_source],
         include_dirs=include_dirs,
         library_dirs=library_dirs,
-        define_macros=msgpack_macros,
         language='c++',
     )
```



Discussion:
Big endian isn't much tested any more (at least not by me personally) due to the lack of big endian platforms / OSes.

Maybe the debian build farm has some insights?

https://buildd.debian.org/status/package.php?p=borgbackup&suite=sid

it seems to work on debian sid ppc64, which is also big endian.
It's strange that both BIG and LITTLE ENDIAN are defined.

Can you grep -r on that system where these macros are defined?
Also, what does your python3 `sys.byteorder` say?
@FelixSchwarz do you remember why we have that code? git says the changeset was based on a patch by you.
@ThomasWaldmann Do you have a git commit for me so I can have a look?

Edit: I think you referred to f9cb04079dc6d3f0ffcb7193ebf757d3d1345a69
I guess "my patch" was referring to a change I created for Fedora's borgbackup package so it would bundle msgpack:

- [RedHat bugzilla #1669083](https://bugzilla.redhat.com/show_bug.cgi?id=1669083)
- [Fedora git commit](https://src.fedoraproject.org/rpms/borgbackup/c/3db4b35c3e76af2088457f3ba995b0ca4732aec8?branch=rawhide)

I don't remember any specifics, I probably just did some copy&paste of various code until the magic incantations aligned. I experienced some big endian build issues on Fedora's s390x infrastructure but that was also due to flaky tests.
The question is somehow why we need to define that in our setup.py, guess it should be in some C header, like `endian.h` (or `endian2.h`)?

endian2.h comes from the spksrc cross-compile build environment.
I agree that two mechanisms to define the byte order are bad.

I guess my inspiration was the code from [msgpack's `setup.py`](https://github.com/msgpack/msgpack-python/blob/b3f72541925cda3b018942db45a59936184727e3/setup.py#L85):

    if sys.byteorder == "big":
        macros = [("__BIG_ENDIAN__", "1")]
    else:
        macros = [("__LITTLE_ENDIAN__", "1")]
Suspicion: is the issue because you use a little-endian python with headers for a big-endian target system in your crosscompiling environment?
@methane do you remember why you do that endian magic in your msgpack setup.py?

https://github.com/msgpack/msgpack-python/commit/7c03f322fa73901620b2cd188186003dd9e02841
@ThomasWaldmann it only fails when cross-compiling (host is always x64_64) to qoriq PPC target (powerpc-e500v2-linux-gnuspe)

I was able to find `endian.h` (files joined) [qoriq-endian.tar.gz](https://github.com/borgbackup/borg/files/7810523/qoriq-endian.tar.gz) :
```
$ find . -name "endian*.h"
./powerpc-e500v2-linux-gnuspe/sysroot/usr/include/endian.h
./powerpc-e500v2-linux-gnuspe/sysroot/usr/include/bits/endian.h
```

Hope this helps :shrug: 

EDIT: Also, found here https://www.nxp.com/docs/en/reference-manual/E500CORERM.pdf page 1-34 it seems it is little endian and would align with the `endian.h` file.  Also page 48 : _Support for big-endian and true little-endian memory on a per-page basis_
> @methane do you remember why you do that endian magic in your msgpack setup.py?

Because it is simple than detecting endian from C/C++ source (note that we needed to support old VC++) and I didn't think `setup.py` should support cross compiling.
@methane so you think that the suggested patch (just removing that code and relying on the stuff in the C/CPP header files) should not be applied upstream?
> @methane so you think that the suggested patch (just removing that code and relying on the stuff in the C/CPP header files) should not be applied upstream?

Situation is changed from when I added the code (e.g. I don't need to support Python 2.7 & VC++ 2008 anymore). So I am not sure for now.
But I expect I can not just apply the patch. Need to check many compilers.
@methane and @ThomasWaldmann , just re-mentioning if that helps, there are no traces of that code on master already.
@th0ma7 you mean borg master? yes, that is because we only bundle a known-good working msgpack into borg 1.1.x (1.1-maint branch).

for master, we just require msgpack (and because of additional wrapper only present in master, we are more flexible concerning new msgpack versions than in 1.1.x). but the msgpack setup.py also has that endian stuff, so the problem then just happens elsewhere.
@methane it would be great if you could look into fixing this upstream (we would then just copy your solution to our borg 1.1-maint branch setup.py).

Guess it doesn't make much sense fixing it just here for 1.1-maint and still run into same issue in master branch (soon borg 1.2.x) where we use msgpack's setup.py for this.
So, for borg this is "wait for upstream fix" now, thus tagged "later". Also added 1.1.x scope.
Looking at recent upstream fix from @methane, I now wonder (and for release planning purpose), should I simply wait for a new 1.2.x or 2.x release in the short-term using master, hence fixing the bigendian issue?  Or is it expected that a port of the upstream fix to be applied over the 1.1.x?

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -816,8 +816,11 @@ def run(self):
                                                system_prefix=libxxhash_prefix, system=libxxhash_system,
                                                **crypto_ext_kwargs)
 
-    msgpack_endian = '__BIG_ENDIAN__' if (sys.byteorder == 'big') else '__LITTLE_ENDIAN__'
-    msgpack_macros = [(msgpack_endian, '1')]
+    msgpack_macros = []  # setup.py of msgpack 0.5.6 defines __LITTLE_ENDIAN__ / __BIG_ENDIAN__ - which
+                         # leads to troubles when trying cross-platform builds, see borg issue #6105.
+                         # in current msgpack, this was fixed to ONLY define __LITTLE_ENDIAN__ ON WIN32.
+                         # as borg 1.1.x does not support native win32 anyway, we do not have that here.
+
     msgpack_packer_ext_kwargs = dict(
         sources=[msgpack_packer_source],
         include_dirs=include_dirs,


Test patch: