Build arm64 target build using pyinstaller - python-2.7

Apple has recently launched Macs based on the Apple silicon processor which is Apples in house arm64 based processor.
I am using pyinstaller 3.4 and Python 2.7.18 to create application for Mac.
I tried on Catalina machine with latest Xcode 12. But pyinstaller creates build only for intel arch.
Is there a way to create build with Apple silicon arm64 target.

Related

Termux - how to install Arm64 Deb not Aarch64

I'm trying to run Thunderbird on a Pixel. Have xfce going but can't find an Aarch64 Thunderbird.
Tried add-architecture but then scripting errors.

No compiler can produce code for this Qt version - Apple silicon

I am trying to port a linux project to macOS. However I can't even setup the build environment on an M1 Macbook Air 2020 (Apple silicon). I installed qt-creator, cmake, qt 5.15 and 6.1 using homebrew. I added the qt versions and cmake in the qt-creator settings. When I want to put everything together in the kits tab, I get the error in the title.
Checking the compilers tab, I realized that the autodetected clang compilers are x86 only. So I cloned the x86 clang++ entry and changed the ABI from x64 to arm. This should work I though, since clang++ is a unversial binary as file /usr/bin/clang++ reports
/usr/bin/clang++: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/clang++ (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/clang++ (for architecture arm64e): Mach-O 64-bit executable arm64e
What do I have to do to make Qt Creator able to build universal binaries? Or at least any build at all?
You need to install Qt 6.2 version which brings support for macOS on Apple Silicon. Porting tasks were tracked under this bug report. Currently, Qt5 doesn't support building for M1 chip.
In addition to updating to Qt6.2 you also need to update your Qt Creator version to Qt Creator 6. Alternatively, you can try the build flags below with Qt Creator 5.
As Qt Creator 5 is built as a non-universal binary, it will default to producing x86_64 binaries, regardless of which architecture your machine is. To build for arm64, add -DCMAKE_OSX_ARCHITECTURES=arm64 explicitly to the "Initial CMake parameters" of the project build settings, or QMAKE_APPLE_DEVICE_ARCHS=arm64 to the qmake "Additional arguments" field.

Selecting cross compiler for Raspberry Pi

Looking for cross compiler that could help me build application for Raspberry Pi on my Ubuntu 20.04 machine. I found official tools on Github and I suppose that folder arm-bcm2708 contains cross compilers:
arm-bcm2708hardfp-linux-gnueabi
arm-bcm2708-linux-gnueabi
arm-linux-gnueabihf -> arm-rpi-4.9.3-linux-gnueabihf
arm-rpi-4.9.3-linux-gnueabihf
gcc-linaro-arm-linux-gnueabihf-raspbian
gcc-linaro-arm-linux-gnueabihf-raspbian-x64
I'm confused what directories names is trying to tell me? I know following words:
arm - processor type used on Pi
bcm2708 - processor model used on pi
gnueabi - cross-compiler for armel architecture (you can build binary for ARM on PC)
linaro - company that creates multimedia for ARM
4.9.3 - I suppose is GCC compiler version (why it is so old?)
Which of compilers I should use for my Pi3 and Pi4?
You can use one of the toolchains provided by ARM for your RPI3/4.
If you are running a 32 bit Linux on your RPI3/4, use one of the arm-none-linux-gnueabihf toolchains, if use are running a 64 bit Linux on your RPI3/4, use one of the aarch64-none-linux-gnu one.
Both 10.2 and 9.2 versions of the two toolchains are working fine on my own Ubuntu 20.04.1 LTS x86_64 system. Of course, you can cross-compile programs with the arm-none-linux-gnueabihf toolchain and run them on the 64 bit Linux running on your RPI3/4 as well.

Compiling for macOS arm64 arch

I am using macOS 10.15.7 to build a simple hello world C++ program for macOS arm64 architecture (not iOS). I have Xcode 12 installed. I tried the following:
xcodebuild -project TestApp.xcodeproj clean build ARCHS=arm64 EXCLUDED_ARCHS=""
But received the following error:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
and similar other errors.
I supposed I can cross-build for upcoming ARM-based macs from my x86_64 mac, but it doesn't seem to work.
The SDK for macOS Big Sur wasn't released as part of the public Xcode 12.0 release, it only contains the SDK for Catalina (macOS 10.15).
To target macOS Big Sur (and macOS on Apple Silicon), you need the beta SDK (Xcode 12.2 beta).
It works fine when I removed the 'EXCLUDED_ARCHS' part.

Docker Centos, Cannot Execute Binary File

I have one C++ binary which is running smoothly on local centos. Recently, I started learning docker and trying to run my C++ application on centos docker.
Firstly, I pulled centos:latest from docker hub and installed my C++ application on it and it ran successfully, without any issue. Now i installed docker on raspberry-pi and pulled centos again and tried to ran the same application on it but it gave me error.
bash : cannot execute binary file
Usually, this error comes when we try to run application on different architecture then the one they are built on. I checked cat etc/centos-release on raspberry-pi and result is CentOS Linux release 7.6.1810 (AltArch),where as result on local centos is CentOS Linux release 7.6.1810 (Core)
uname -a on both devices is as follows
raspberry-pi, centos docker Linux c475f349e7c2 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l armv7l armv7l GNU/Linux
centos, centos docker Linux a57f3fc2c1a6 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
EDIT:
Also, file myapplication
TTCHAIN: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.24, BuildID[sha1]=287b501c8206893f7819f215ee0033586212b143, with debug_info, not stripped
My question is how can i ran the same native application of centos, pulled from docker on raspberry-pi model 3.
Your application has been built for x86-64. Intel x86-64 binaries CAN NOT run on an ARM processor.
You have two paths to pursue:
If you don't have source code for the application, you will need an x86-64 emulator that will run on your Raspberry Pi. Considering the Pi's lesser capabilities and Intel's proclivity to sue anyone who creates an emulator for their processors, I doubt you'll find one that's publicly available.
If you have the source code for the application, you need to rebuild it as a Raspberry Pi executable. You seem to know that it was written in C++. GCC and other toolchains are available for the Raspberry Pi (most likely a "yum install gcc" on your Pi will grab the compiler and tools for you). Building the application should be extremely similar to building it for x86_64.
You could find a cross-compiler that would let you build for the Pi from your x86_64 box, but that can get complicated.
Could be that you are trying to run a 64-bit binary on a 32-bit processor, would need more information to know for sure though.
You can check by using the file command in the shell. You may have to re-compile on the original system with the -m32 flag to gcc.
Please do a "uname -a" on both devices and post the results.
Most likely the processor or library type doesn't match.
I presume (hope) you're not trying to run an x86-compiled app on a Pi. Although Docker is available for both processor types, Docker will not run x86 binaries on Pi or vice versa.
Actually, AltArch currently means one of the following architectures... ppc64, ppc64le, i386, armhfp (arm v7 32-bit), aarch64 (arm v8 64-bit). Core suggests the mainstream x86 and x86_64 builds of CentOS.
Yep, I bet that's what it is...you can't just transfer an x86 binary to a Raspbian and expect it to work. The application must be rebuilt for the platform.