From 2a64dc56ea4443aa4567ebd5157aded989d98572 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 08:52:41 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E5=9F=BA=E4=BA=8E5.12.3=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=A2=9E=E5=8A=A0ARM=E6=9E=B6=E6=9E=84=E7=9A=84?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 92 ++++++++++++++++++++++++++-------------------------- qtbase | 2 +- qtmultimedia | 2 +- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.gitmodules b/.gitmodules index f65bd875a51..b4ff6901f25 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,59 +1,59 @@ [submodule "qtbase"] path = qtbase - url = ../qtbase.git + url = https://github.com/shinyTang/qtbase.git branch = 5.12.3 status = essential [submodule "qtsvg"] depends = qtbase path = qtsvg - url = ../qtsvg.git + url = https://github.com/qt/qtsvg.git branch = 5.12.3 status = addon [submodule "qtdeclarative"] depends = qtbase recommends = qtsvg path = qtdeclarative - url = ../qtdeclarative.git + url = https://github.com/qt/qtdeclarative.git branch = 5.12.3 status = essential [submodule "qtactiveqt"] depends = qtbase path = qtactiveqt - url = ../qtactiveqt.git + url = https://github.com/qt/qtactiveqt.git branch = 5.12.3 status = addon [submodule "qtscript"] depends = qtbase recommends = qttools path = qtscript - url = ../qtscript.git + url = https://github.com/qt/qtscript.git branch = 5.12.3 status = deprecated [submodule "qtmultimedia"] depends = qtbase recommends = qtdeclarative path = qtmultimedia - url = ../qtmultimedia.git + url = https://github.com/shinyTang/qtmultimedia.git branch = 5.12.3 status = essential [submodule "qttools"] depends = qtbase recommends = qtdeclarative qtactiveqt path = qttools - url = ../qttools.git + url = https://github.com/qt/qttools.git branch = 5.12.3 status = essential [submodule "qtxmlpatterns"] depends = qtbase recommends = qtdeclarative path = qtxmlpatterns - url = ../qtxmlpatterns.git + url = https://github.com/qt/qtxmlpatterns.git branch = 5.12.3 status = addon [submodule "qttranslations"] depends = qttools path = qttranslations - url = ../qttranslations.git + url = https://github.com/qt/qttranslations.git branch = 5.12.3 status = essential priority = 30 @@ -61,20 +61,20 @@ depends = qtdeclarative qttools recommends = qtmultimedia qtquickcontrols qtquickcontrols2 path = qtdoc - url = ../qtdoc.git + url = https://github.com/qt/qtdoc.git branch = 5.12.3 status = essential priority = 40 [submodule "qtrepotools"] path = qtrepotools - url = ../qtrepotools.git + url = https://github.com/qt/qtrepotools.git branch = master status = essential project = - [submodule "qtqa"] depends = qtbase path = qtqa - url = ../qtqa.git + url = https://github.com/qt/qtqa.git branch = master status = essential priority = 50 @@ -82,226 +82,226 @@ depends = qtbase recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport path = qtlocation - url = ../qtlocation.git + url = https://github.com/qt/qtlocation.git branch = 5.12.3 status = addon [submodule "qtsensors"] depends = qtbase recommends = qtdeclarative path = qtsensors - url = ../qtsensors.git + url = https://github.com/qt/qtsensors.git branch = 5.12.3 status = addon [submodule "qtsystems"] depends = qtbase recommends = qtdeclarative path = qtsystems - url = ../qtsystems.git + url = https://github.com/qt/qtsystems.git branch = dev status = ignore [submodule "qtfeedback"] depends = qtdeclarative recommends = qtmultimedia path = qtfeedback - url = ../qtfeedback.git + url = https://github.com/qt/qtfeedback.git branch = master status = ignore [submodule "qtdocgallery"] depends = qtdeclarative path = qtdocgallery - url = ../qtdocgallery.git + url = https://github.com/qt/qtdocgallery.git branch = master status = ignore [submodule "qtpim"] depends = qtdeclarative path = qtpim - url = ../qtpim.git + url = https://github.com/qt/qtpim.git branch = dev status = ignore [submodule "qtconnectivity"] depends = qtbase recommends = qtdeclarative qtandroidextras path = qtconnectivity - url = ../qtconnectivity.git + url = https://github.com/qt/qtconnectivity.git branch = 5.12.3 status = addon [submodule "qtwayland"] depends = qtbase recommends = qtdeclarative path = qtwayland - url = ../qtwayland.git + url = https://github.com/qt/qtwayland.git branch = 5.12.3 status = addon [submodule "qt3d"] depends = qtbase recommends = qtdeclarative qtimageformats qtgamepad path = qt3d - url = ../qt3d.git + url = https://github.com/qt/qt3d.git branch = 5.12.3 status = addon [submodule "qtimageformats"] depends = qtbase path = qtimageformats - url = ../qtimageformats.git + url = https://github.com/qt/qtimageformats.git branch = 5.12.3 status = addon [submodule "qtgraphicaleffects"] depends = qtdeclarative path = qtgraphicaleffects - url = ../qtgraphicaleffects.git + url = https://github.com/qt/qtgraphicaleffects.git branch = 5.12.3 status = addon [submodule "qtquickcontrols"] depends = qtdeclarative recommends = qtgraphicaleffects path = qtquickcontrols - url = ../qtquickcontrols.git + url = https://github.com/qt/qtquickcontrols.git branch = 5.12.3 status = addon [submodule "qtserialbus"] depends = qtserialport path = qtserialbus - url = ../qtserialbus.git + url = https://github.com/qt/qtserialbus.git branch = 5.12.3 status = addon [submodule "qtserialport"] depends = qtbase path = qtserialport - url = ../qtserialport.git + url = https://github.com/qt/qtserialport.git branch = 5.12.3 status = addon [submodule "qtx11extras"] depends = qtbase path = qtx11extras - url = ../qtx11extras.git + url = https://github.com/qt/qtx11extras.git branch = 5.12.3 status = addon [submodule "qtmacextras"] depends = qtbase path = qtmacextras - url = ../qtmacextras.git + url = https://github.com/qt/qtmacextras.git branch = 5.12.3 status = addon [submodule "qtwinextras"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtwinextras - url = ../qtwinextras.git + url = https://github.com/qt/qtwinextras.git branch = 5.12.3 status = addon [submodule "qtandroidextras"] depends = qtbase path = qtandroidextras - url = ../qtandroidextras.git + url = https://github.com/qt/qtandroidextras.git branch = 5.12.3 status = addon [submodule "qtwebsockets"] depends = qtbase recommends = qtdeclarative path = qtwebsockets - url = ../qtwebsockets.git + url = https://github.com/qt/qtwebsockets.git branch = 5.12.3 status = addon [submodule "qtwebchannel"] depends = qtbase recommends = qtdeclarative qtwebsockets path = qtwebchannel - url = ../qtwebchannel.git + url = https://github.com/qt/qtwebchannel.git branch = 5.12.3 status = addon [submodule "qtwebengine"] depends = qtdeclarative recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools path = qtwebengine - url = ../qtwebengine.git + url = https://github.com/qt/qtwebengine.git branch = 5.12.3 status = addon priority = 10 [submodule "qtcanvas3d"] depends = qtdeclarative path = qtcanvas3d - url = ../qtcanvas3d.git + url = https://github.com/qt/qtcanvas3d.git branch = 5.12.3 status = addon [submodule "qtwebview"] depends = qtdeclarative recommends = qtwebengine path = qtwebview - url = ../qtwebview.git + url = https://github.com/qt/qtwebview.git branch = 5.12.3 status = addon [submodule "qtquickcontrols2"] depends = qtgraphicaleffects recommends = qtimageformats path = qtquickcontrols2 - url = ../qtquickcontrols2.git + url = https://github.com/qt/qtquickcontrols2.git branch = 5.12.3 status = essential [submodule "qtpurchasing"] depends = qtbase recommends = qtdeclarative qtandroidextras path = qtpurchasing - url = ../qtpurchasing.git + url = https://github.com/qt/qtpurchasing.git branch = 5.12.3 status = addon [submodule "qtcharts"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtcharts - url = ../qtcharts.git + url = https://github.com/qt/qtcharts.git branch = 5.12.3 status = addon [submodule "qtdatavis3d"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtdatavis3d - url = ../qtdatavis3d.git + url = https://github.com/qt/qtdatavis3d.git branch = 5.12.3 status = addon [submodule "qtvirtualkeyboard"] depends = qtbase qtdeclarative qtsvg recommends = qtmultimedia qtquickcontrols path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git + url = https://github.com/qt/qtvirtualkeyboard.git branch = 5.12.3 status = addon [submodule "qtgamepad"] depends = qtbase recommends = qtdeclarative path = qtgamepad - url = ../qtgamepad.git + url = https://github.com/qt/qtgamepad.git branch = 5.12.3 status = addon [submodule "qtscxml"] depends = qtbase qtdeclarative path = qtscxml - url = ../qtscxml.git + url = https://github.com/qt/qtscxml.git branch = 5.12.3 status = addon [submodule "qtspeech"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtspeech - url = ../qtspeech.git + url = https://github.com/qt/qtspeech.git branch = 5.12.3 status = addon [submodule "qtnetworkauth"] depends = qtbase path = qtnetworkauth - url = ../qtnetworkauth.git + url = https://github.com/qt/qtnetworkauth.git branch = 5.12.3 status = addon [submodule "qtremoteobjects"] depends = qtbase recommends = qtdeclarative path = qtremoteobjects - url = ../qtremoteobjects.git + url = https://github.com/qt/qtremoteobjects.git branch = 5.12.3 status = addon [submodule "qtwebglplugin"] depends = qtbase qtwebsockets recommends = qtdeclarative path = qtwebglplugin - url = ../qtwebglplugin.git + url = https://github.com/qt/qtwebglplugin.git branch = 5.12.3 status = addon diff --git a/qtbase b/qtbase index 534df5a33bd..9261bd98bdd 160000 --- a/qtbase +++ b/qtbase @@ -1 +1 @@ -Subproject commit 534df5a33bd6a3d0d00194212cf868a9ef57bd53 +Subproject commit 9261bd98bdd342f2e5aeec6c1d3c32b7388e0b54 diff --git a/qtmultimedia b/qtmultimedia index c7e735198c6..6ad847ff120 160000 --- a/qtmultimedia +++ b/qtmultimedia @@ -1 +1 @@ -Subproject commit c7e735198c6cc01201f90b64c8a6d35fc40584fc +Subproject commit 6ad847ff12071fdf5d9ede989399cb776c644f7b From 0db72734981653ff47b636acdd8955e3b486129e Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 13:35:35 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qt.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 qt.conf diff --git a/qt.conf b/qt.conf new file mode 100644 index 00000000000..80e352cee12 --- /dev/null +++ b/qt.conf @@ -0,0 +1,3 @@ +[Paths] +Prefix=.. +Plugins=../plugins \ No newline at end of file From 6b4afa0f877e15ead8bf9e8812673f2f1f5577a0 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 14:12:51 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_opensource.sh | 61 +++++++++++++++++++++++++++++++++++++++++ make_universal.py | 66 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 build_opensource.sh create mode 100644 make_universal.py diff --git a/build_opensource.sh b/build_opensource.sh new file mode 100644 index 00000000000..158f674566b --- /dev/null +++ b/build_opensource.sh @@ -0,0 +1,61 @@ +#!bash + +SCRIPT=$(dirname "$0") +cd $SCRIPT +BASEDIR=`pwd` +ENABLE_QT_DEBUG_VER_BUILD=0 +echo $BASEDIR +prj_path="build_opensource" +if [ "$1" != "" ]; then + prj_path="$1" +fi +echo $prj_path + +mkdir -p $prj_path && cd $prj_path + +build_fun() +{ + BUILD_DIRNAME="build_$1" + QT_INSTALL_DIR="$BASEDIR/$prj_path/Qt5.12.3_$1" + + if [ $ENABLE_QT_DEBUG_VER_BUILD == 1 ]; then + BUILD_DIRNAME="build_$1_debug" + QT_INSTALL_DIR="$BASEDIR/$prj_path/Qt5.12.3_$1_debug" + fi + + + mkdir -p $BUILD_DIRNAME && cd $BUILD_DIRNAME + if [ ! -f Makefile ];then + $BASEDIR/configure -prefix $QT_INSTALL_DIR -skip qt3d -skip qtwebengine -skip qtlocation -skip qtconnectivity -nomake examples -nomake tests -device-option QMAKE_APPLE_DEVICE_ARCHS="$1" QMAKE_MACOSX_DEPLOYMENT_TARGET=10.13 -opensource -confirm-license + + if [ $ENABLE_QT_DEBUG_VER_BUILD == 1 ]; then + $BASEDIR/configure -prefix $QT_INSTALL_DIR -debug -skip qt3d -skip qtwebengine -skip qtlocation -skip qtconnectivity -nomake examples -nomake tests -device-option QMAKE_APPLE_DEVICE_ARCHS="$1" QMAKE_MACOSX_DEPLOYMENT_TARGET=10.13 -opensource -confirm-license + fi + + sed -i "" '/QMAKE *=/ s/$/ QMAKE_APPLE_DEVICE_ARCHS="'$1'"/' Makefile + cd qtbase/qmake/ + make clean + sed -i "" '/CXX =/ s/$/ -arch '$1'/' Makefile + make + cd - + fi + set -e + make -j8 > /dev/null + set +e + make -j8 install > /dev/null + + cd .. +} + +echo build x86_64 debug_ver=$ENABLE_QT_DEBUG_VER_BUILD +build_fun "x86_64" +echo build arm64 debug_ver=$ENABLE_QT_DEBUG_VER_BUILD +build_fun "arm64" +echo make universal +cd $BASEDIR +python3 make_universal.py $prj_path/Qt5.12.3 $prj_path/Qt5.12.3_x86_64 $prj_path/Qt5.12.3_arm64 +# arm64 版本的 macdeployqt 无法正确运行,于是使用 x86_64 的版本 +cp $prj_path/Qt5.12.3_x86_64/bin/macdeployqt $prj_path/Qt5.12.3/bin +# qt.conf 用来指定当前 qmake 所依赖的的 Qt 库 +cp qt.conf $prj_path/Qt5.12.3/bin + diff --git a/make_universal.py b/make_universal.py new file mode 100644 index 00000000000..094220bfd78 --- /dev/null +++ b/make_universal.py @@ -0,0 +1,66 @@ +#!/usr/local/bin/python3 +# -*- coding: UTF-8 -*- +import os +import sys +from os import listdir + +success = 0 +failed = 0 +skipped = 0 + + +def check_arch(file_name, arch): +# print("lipo " + file_name + " -verify_arch " + arch) + return os.system("lipo " + file_name + " -verify_arch " + arch) + + +def lipo(universal_path, arm64_path, x86_64_path): +# print("lipo -create -output " + universal_path + " " + arm64_path + " " + x86_64_path) + return os.system("lipo -create -output " + universal_path + " " + arm64_path + " " + x86_64_path) + + +def merge_binary(universal_path, arm64_path, x86_64_path): + global failed + global success + global skipped + if check_arch(universal_path, "arm64") != 0: + if check_arch(arm64_path, "arm64") == 0: + if lipo(universal_path, arm64_path, x86_64_path) == 0: +# print("success adding arm64 arch to binary") + success += 1 + else: + print("failed adding arm64 arch to binary") + failed += 1 + else: +# print(arm64_path) + print("failed doesn't has arm64 arch in binary") + failed += 1 + else: + skipped += 1 + + +def traverse_path(universal_path, arm64_path, x86_64_path): + for filename in os.listdir(x86_64_path): + x86_64_full_path = x86_64_path + '/' + filename + arm64_full_path = arm64_path + '/' + filename + universal_full_path = universal_path + '/' + filename + if os.path.isdir(x86_64_full_path) is True and os.path.islink(x86_64_full_path) is False: + traverse_path(universal_full_path, arm64_full_path, x86_64_full_path) + elif os.path.isfile(x86_64_full_path) and (os.access(x86_64_full_path, os.X_OK) or x86_64_full_path.endswith(".a")) and check_arch(x86_64_full_path, "x86_64") == 0: + merge_binary(universal_full_path, arm64_full_path, x86_64_full_path) + + +def copy_x86_to_universal(x86_64_path, universal_path): + os.system("rsync -av --progress -l -r " + x86_64_path + "/ " + universal_path) + + +def main(universal_path, x86_64_path, arm64_path): + copy_x86_to_universal(x86_64_path, universal_path) + traverse_path(universal_path, arm64_path, x86_64_path) + print("success file", success, "failed", + failed, "skipped", skipped) + + +if __name__ == '__main__': + if len(sys.argv) != 4: + print("usage: python3 make_universal.py universal_path x86_64_path arm64_path") + main(sys.argv[1], sys.argv[2], sys.argv[3]) From 8b96c15440da8ef37494eeef91d95daf1f2e41fe Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 15:46:44 +0800 Subject: [PATCH 04/17] Add macOS ARM support details to README --- README | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README b/README index dd4af0d545a..f75f9346a44 100644 --- a/README +++ b/README @@ -1,3 +1,55 @@ +Branch Name: qt5.12.3/universal + +Maintainer: shinyTang + +Source Repository: https://github.com/qt/qt5 + +Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch contains modifications to Qt 5.12.3 to add native support for macOS ARM64. + +======== + +Branch Modifications (Differences) + This branch is based on the Qt dev branch at commit 8337e20fadddf, which corresponds to the Qt 5.12.3 release state. The following modifications have been applied: + + 1. qtbase Module: + + Fixed a missing #include in libpng to resolve compilation errors. + + Removed the #error "32-bit builds are not supported" directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. + + Added necessary includes (e.g., #include ) for the macOS graphics stack. + + 2. qtmultimedia Module: + + Refactored code in the AVFoundation plugin to replace deprecated C++98 functional utilities (std::binary_function, std::unary_function, std::not2) with modern C++11/14 equivalents (lambda functions). This ensures compatibility with modern compilers enforcing the C++17 standard. + + Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. + + Build Instructions + ================ + This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. + + Building Universal Libraries (macOS) + 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. + + 2.Create a Merged libxcb Library: + + On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). + + Use the lipo tool to merge the two architecture-specific libraries into one universal library: + - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + + Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. + + 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. + cd qt5.12.3_universal + bash build_opoensource.sh + +Building a Single Architecture + If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. + + + HOW TO BUILD QT5 ================ From 17255718fd3b63e08486c7ceb4c3d4423146805e Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 15:48:27 +0800 Subject: [PATCH 05/17] Update README to remove maintainer details --- README | 2 -- 1 file changed, 2 deletions(-) diff --git a/README b/README index f75f9346a44..aca3a85f179 100644 --- a/README +++ b/README @@ -1,7 +1,5 @@ Branch Name: qt5.12.3/universal -Maintainer: shinyTang - Source Repository: https://github.com/qt/qt5 Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch contains modifications to Qt 5.12.3 to add native support for macOS ARM64. From 20ce079dc87c05142115139b63f323a292b51b46 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 15:51:36 +0800 Subject: [PATCH 06/17] Revise README for macOS ARM64 support details --- README | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index aca3a85f179..0bcbdd0b08e 100644 --- a/README +++ b/README @@ -4,9 +4,9 @@ Source Repository: https://github.com/qt/qt5 Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch contains modifications to Qt 5.12.3 to add native support for macOS ARM64. -======== +================ -Branch Modifications (Differences) +Branch Modifications (Differences): This branch is based on the Qt dev branch at commit 8337e20fadddf, which corresponds to the Qt 5.12.3 release state. The following modifications have been applied: 1. qtbase Module: @@ -23,7 +23,7 @@ Branch Modifications (Differences) Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. - Build Instructions +Build Instructions: ================ This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. @@ -35,7 +35,7 @@ Branch Modifications (Differences) On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). Use the lipo tool to merge the two architecture-specific libraries into one universal library: - - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. @@ -43,7 +43,7 @@ Branch Modifications (Differences) cd qt5.12.3_universal bash build_opoensource.sh -Building a Single Architecture + Building a Single Architecture If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. From 0b75bcae939e3f16d63a8accffa7c67ed33fa0a4 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 15:52:41 +0800 Subject: [PATCH 07/17] Update README with build instructions for single architecture --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 0bcbdd0b08e..5441818c185 100644 --- a/README +++ b/README @@ -40,6 +40,7 @@ Build Instructions: Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. + cd qt5.12.3_universal bash build_opoensource.sh @@ -47,6 +48,7 @@ Build Instructions: If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. + HOW TO BUILD QT5 ================ From ea82901a2110929a60515c4581efa8d739fadfcd Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 15:54:50 +0800 Subject: [PATCH 08/17] Fix formatting and improve README instructions --- README | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README b/README index 5441818c185..b112f4c7e0a 100644 --- a/README +++ b/README @@ -28,24 +28,24 @@ Build Instructions: This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. Building Universal Libraries (macOS) - 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. - - 2.Create a Merged libxcb Library: - - On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). - - Use the lipo tool to merge the two architecture-specific libraries into one universal library: - - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib - - Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. - - 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. - - cd qt5.12.3_universal - bash build_opoensource.sh + 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. + + 2.Create a Merged libxcb Library: + + On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). + + Use the lipo tool to merge the two architecture-specific libraries into one universal library: + - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + + Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. + + 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. + + cd qt5.12.3_universal + bash build_opoensource.sh Building a Single Architecture - If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. + If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. From 8c06816c720cac08e42a5c24303ae02c1a3a41e3 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 16:24:33 +0800 Subject: [PATCH 09/17] Revise README for clarity and build instructions --- README | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index b112f4c7e0a..030c6f3b156 100644 --- a/README +++ b/README @@ -1,8 +1,6 @@ -Branch Name: qt5.12.3/universal - Source Repository: https://github.com/qt/qt5 -Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch contains modifications to Qt 5.12.3 to add native support for macOS ARM64. +Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch provides a patch for Qt 5.12.3 that enables compilation and native execution on macOS ARM64 systems. ================ @@ -23,8 +21,10 @@ Branch Modifications (Differences): Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. +================ + Build Instructions: - ================ + This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. Building Universal Libraries (macOS) @@ -48,7 +48,7 @@ Build Instructions: If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. - +================================================================================================================ HOW TO BUILD QT5 ================ From e5d4e909ce56b7d931e5fb49ead0dbaace302ee2 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Tue, 9 Sep 2025 16:26:22 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README b/README index dd4af0d545a..5237243a6d2 100644 --- a/README +++ b/README @@ -1,3 +1,55 @@ +Source Repository: https://github.com/qt/qt5 + +Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch provides a patch for Qt 5.12.3 that enables compilation and native execution on macOS ARM64 systems. + +================ + +Branch Modifications (Differences): + This branch is based on the Qt dev branch at commit 8337e20fadddf, which corresponds to the Qt 5.12.3 release state. The following modifications have been applied: + + 1. qtbase Module: + + Fixed a missing #include in libpng to resolve compilation errors. + + Removed the #error "32-bit builds are not supported" directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. + + Added necessary includes (e.g., #include ) for the macOS graphics stack. + + 2. qtmultimedia Module: + + Refactored code in the AVFoundation plugin to replace deprecated C++98 functional utilities (std::binary_function, std::unary_function, std::not2) with modern C++11/14 equivalents (lambda functions). This ensures compatibility with modern compilers enforcing the C++17 standard. + + Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. + +================ + +Build Instructions: + + This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. + + Building Universal Libraries (macOS) + 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. + + 2.Create a Merged libxcb Library: + + On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). + + Use the lipo tool to merge the two architecture-specific libraries into one universal library: + - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + + Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. + + 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. + + cd qt5.12.3_universal + bash build_opoensource.sh + + Building a Single Architecture + If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. + + +============================================================================ + HOW TO BUILD QT5 ================ From c29f9710215464f34ea07afe85f08f4a4246b642 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 14:57:46 +0800 Subject: [PATCH 11/17] Revise README for Qt 5.12.3 Universal build Updated README to reflect changes for Qt 5.12.3 Universal build on macOS ARM and Intel architectures, including purpose, modifications, and build instructions. --- README | 255 +++++++++++++++++++++++++++------------------------------ 1 file changed, 119 insertions(+), 136 deletions(-) diff --git a/README b/README index 030c6f3b156..ae36f64d409 100644 --- a/README +++ b/README @@ -1,186 +1,169 @@ -Source Repository: https://github.com/qt/qt5 +# Qt 5.12.3 Universal (Apple Silicon/macOS) -Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch provides a patch for Qt 5.12.3 that enables compilation and native execution on macOS ARM64 systems. +**Source Repository:** [https://github.com/qt/qt5](https://github.com/qt/qt5) -================ +--- -Branch Modifications (Differences): - This branch is based on the Qt dev branch at commit 8337e20fadddf, which corresponds to the Qt 5.12.3 release state. The following modifications have been applied: +## Purpose - 1. qtbase Module: +> The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. +> This branch provides a patch for Qt 5.12.3 that enables compilation and native execution for both Intel (x86_64) and ARM (arm64) architectures, as well as legacy 32-bit Intel (i386). - Fixed a missing #include in libpng to resolve compilation errors. +--- - Removed the #error "32-bit builds are not supported" directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. +## 🚩 **Branch Modifications (Differences)** - Added necessary includes (e.g., #include ) for the macOS graphics stack. +This branch is based on the Qt dev branch at commit `8337e20fadddf` (Qt 5.12.3 release). +**Key changes:** - 2. qtmultimedia Module: +### 1. `qtbase` Module: +- **Fixed:** Missing `#include ` in libpng to resolve compilation errors. +- **Removed:** `#error "32-bit builds are not supported"` directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. +- **Added:** Necessary includes (e.g., `#include `) for the macOS graphics stack. - Refactored code in the AVFoundation plugin to replace deprecated C++98 functional utilities (std::binary_function, std::unary_function, std::not2) with modern C++11/14 equivalents (lambda functions). This ensures compatibility with modern compilers enforcing the C++17 standard. +### 2. `qtmultimedia` Module: +- **Refactored:** AVFoundation plugin code replacing deprecated C++98 functional utilities (`std::binary_function`, `std::unary_function`, `std::not2`) with modern C++11/14 equivalents (lambda functions, etc.). - Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. +**Summary:** +These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal build. -================ +--- -Build Instructions: - - This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. +## 🛠️ **Build Instructions** - Building Universal Libraries (macOS) - 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. - - 2.Create a Merged libxcb Library: - - On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). - - Use the lipo tool to merge the two architecture-specific libraries into one universal library: - - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib - - Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. - - 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. - - cd qt5.12.3_universal - bash build_opoensource.sh +This project uses the `build_opensource.sh` script to compile Qt libraries for both x86_64 and ARM64 architectures, then merges them into a single Universal 2 binary. - Building a Single Architecture - If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. +### Building Universal Libraries (macOS) +1. **Prerequisite – Install Identical `libxcb`:** + Before running the build script, install the **same version** of the `libxcb` library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. -================================================================================================================ - -HOW TO BUILD QT5 -================ +2. **Create a Merged `libxcb` Library:** + - On each machine, locate the `libxcb.dylib` file (usually in `/usr/local/lib` or `/opt/homebrew/lib`). + - Use the `lipo` tool to merge: + ```sh + lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + ``` + - Replace the system library: Copy the universal `./lib/libxcb.dylib` and overwrite the existing `libxcb.dylib` in your library directory (e.g., `/usr/local/lib`). +3. **Execute the Build Script:** + ```sh + cd qt5.12.3_universal + bash build_opensource.sh + ``` - Synopsis - ======== +### Building a Single Architecture - System requirements - ------------------ +If you **do not need** a universal library, you can modify the `build_opensource.sh` script to compile for only one architecture (either x86_64 or arm64). +Edit the script to comment out or remove the lines for the other architecture. - - Perl 5.8 or later - - Python 2.7 or later - - C++ compiler supporting the C++11 standard +--- - For other platform specific requirements, - please see section "Setting up your machine" on: - http://wiki.qt.io/Get_The_Source +## +============================================================ +## Original Qt README - Licensing: - ---------- +### HOW TO BUILD QT5 - Opensource users: +#### Synopsis - = -opensource +##### System requirements +- Perl 5.8 or later +- Python 2.7 or later +- C++ compiler supporting the C++11 standard - Commercial users: +For other platform-specific requirements, see ["Setting up your machine"](http://wiki.qt.io/Get_The_Source). - = -commercial +##### Licensing - Linux, Mac: - ----------- +- Opensource users: + ` = -opensource` +- Commercial users: + ` = -commercial` - cd / - ./configure -prefix $PWD/qtbase -nomake tests - make -j 4 +##### Linux, Mac +```sh +cd / +./configure -prefix $PWD/qtbase -nomake tests +make -j 4 +``` - Windows: - -------- +##### Windows +Open a command prompt. +Ensure the following tools are in your path: +- Supported compiler (Visual Studio 2012+, MinGW-builds gcc 4.9+) +- Perl 5.12+ [ActivePerl](http://www.activestate.com/activeperl/) +- Python 2.7+ [ActivePython](http://www.activestate.com/activepython/) +- Ruby 1.9.3+ [RubyInstaller](http://rubyinstaller.org/) - Open a command prompt. - Ensure that the following tools can be found in the path: - * Supported compiler (Visual Studio 2012 or later, - MinGW-builds gcc 4.9 or later) - * Perl version 5.12 or later [http://www.activestate.com/activeperl/] - * Python version 2.7 or later [http://www.activestate.com/activepython/] - * Ruby version 1.9.3 or later [http://rubyinstaller.org/] +```bat +cd \ +configure -prefix %CD%\qtbase -nomake tests +nmake // jom // mingw32-make +``` - cd \ - configure -prefix %CD%\qtbase -nomake tests - nmake // jom // mingw32-make +To accelerate qmake bootstrap with MSVC, use `-make-tool jom` or add `/MP` to the CL environment variable. - To accelerate the bootstrap of qmake with MSVC, it may be useful to pass - "-make-tool jom" on the configure command line. If you do not use jom, - adding "/MP" to the CL environment variable is a good idea. +--- - More details follow. +### Build Process - Build! - ====== +A typical configure & make build process is used. - A typical `configure; make' build process is used. +#### Some relevant configure options: - Some relevant configure options (see configure -help): +- `-release` Compile Qt with debugging off +- `-debug` Compile Qt with debugging on +- `-nomake tests` Disable building of tests +- `-nomake examples` Disable building of examples +- `-confirm-license` Automatically acknowledge the LGPL 2.1 license - -release Compile and link Qt with debugging turned off. - -debug Compile and link Qt with debugging turned on. - -nomake tests Disable building of tests to speed up compilation - -nomake examples Disable building of examples to speed up compilation - -confirm-license Automatically acknowledge the LGPL 2.1 license. +**Example for release build:** +```sh +./configure -prefix $PWD/qtbase +make -j4 +``` - Example for a release build: - (adjust the `-jN' parameter as appropriate for your system) +**Example for developer build:** +```sh +./configure -developer-build +make -j4 +``` - ./configure -prefix $PWD/qtbase - make -j4 +See output of `./configure -help` for more options. - Example for a developer build: - (enables more autotests, builds debug version of libraries, ...) +You can build selected modules with their dependencies: +`make module-` (e.g., `make module-qtdeclarative`) - ./configure -developer-build - make -j4 +--- - See output of `./configure -help' for documentation on various options to - configure. +### Hints - The above examples will build whatever Qt5 modules have been enabled by - default in the build system. +The submodule repository **qtrepotools** contains useful scripts for developers and release engineers. +Consider adding `qtrepotools/bin` to your PATH. - It is possible to build selected modules with their dependencies by doing - a `make module-'. For example, to build only qtdeclarative, - and the modules it depends on: +--- - ./configure -prefix $PWD/qtbase - make -j4 module-qtdeclarative +### Building Qt5 from git - This can save a lot of time if you are only interested in a subset of Qt5. +See [Building_Qt_5_from_Git](http://wiki.qt.io/Building_Qt_5_from_Git) and README.git for more info. +See [Qt_5 reference platforms](http://wiki.qt.io/Qt_5). +--- - Hints - ===== +### Documentation - The submodule repository qtrepotools contains useful scripts for - developers and release engineers. Consider adding qtrepotools/bin - to your PATH environment variable to access them. +After configuring and compiling Qt, build docs with: +```sh +make docs +``` +Install with: +```sh +make install_docs +``` +Docs are installed in `$QT_INSTALL_DOCS`. +`qmake -query` will list the path. - The qt5_tool in qtrepotools has some more features which may be of interest. - Try `qt5_tool --help'. - - - Building Qt5 from git - ===================== - See http://wiki.qt.io/Building_Qt_5_from_Git and README.git - for more information. - See http://wiki.qt.io/Qt_5 for the reference platforms. - - - Documentation - ============= - - After configuring and compiling Qt, building the documentation is possible by running - "make docs". - - After having built the documentation, you need to install it with the following - command: - - make install_docs - - The documentation is installed in the path set to $QT_INSTALL_DOCS. - Running "qmake -query" will list the value of QT_INSTALL_DOCS. - - Information about Qt 5's documentation is located in qtbase/doc/README - or in the following page: http://wiki.qt.io/Qt5DocumentationProject - - Note: Building the documentation is only tested on desktop platforms. +Further info: +- `qtbase/doc/README` +- [Qt5 Documentation Project](http://wiki.qt.io From 2a3ef4592295586ac9abfa892e0bd049f49a3a67 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 15:05:46 +0800 Subject: [PATCH 12/17] Rename README to README.md for Markdown preview --- README | 169 ------------------------------------------------- README.md | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+), 169 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index ae36f64d409..00000000000 --- a/README +++ /dev/null @@ -1,169 +0,0 @@ -# Qt 5.12.3 Universal (Apple Silicon/macOS) - -**Source Repository:** [https://github.com/qt/qt5](https://github.com/qt/qt5) - ---- - -## Purpose - -> The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. -> This branch provides a patch for Qt 5.12.3 that enables compilation and native execution for both Intel (x86_64) and ARM (arm64) architectures, as well as legacy 32-bit Intel (i386). - ---- - -## 🚩 **Branch Modifications (Differences)** - -This branch is based on the Qt dev branch at commit `8337e20fadddf` (Qt 5.12.3 release). -**Key changes:** - -### 1. `qtbase` Module: -- **Fixed:** Missing `#include ` in libpng to resolve compilation errors. -- **Removed:** `#error "32-bit builds are not supported"` directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. -- **Added:** Necessary includes (e.g., `#include `) for the macOS graphics stack. - -### 2. `qtmultimedia` Module: -- **Refactored:** AVFoundation plugin code replacing deprecated C++98 functional utilities (`std::binary_function`, `std::unary_function`, `std::not2`) with modern C++11/14 equivalents (lambda functions, etc.). - -**Summary:** -These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal build. - ---- - -## 🛠️ **Build Instructions** - -This project uses the `build_opensource.sh` script to compile Qt libraries for both x86_64 and ARM64 architectures, then merges them into a single Universal 2 binary. - -### Building Universal Libraries (macOS) - -1. **Prerequisite – Install Identical `libxcb`:** - Before running the build script, install the **same version** of the `libxcb` library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. - -2. **Create a Merged `libxcb` Library:** - - On each machine, locate the `libxcb.dylib` file (usually in `/usr/local/lib` or `/opt/homebrew/lib`). - - Use the `lipo` tool to merge: - ```sh - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib - ``` - - Replace the system library: Copy the universal `./lib/libxcb.dylib` and overwrite the existing `libxcb.dylib` in your library directory (e.g., `/usr/local/lib`). - -3. **Execute the Build Script:** - ```sh - cd qt5.12.3_universal - bash build_opensource.sh - ``` - -### Building a Single Architecture - -If you **do not need** a universal library, you can modify the `build_opensource.sh` script to compile for only one architecture (either x86_64 or arm64). -Edit the script to comment out or remove the lines for the other architecture. - ---- - -## -============================================================ -## Original Qt README - -### HOW TO BUILD QT5 - -#### Synopsis - -##### System requirements -- Perl 5.8 or later -- Python 2.7 or later -- C++ compiler supporting the C++11 standard - -For other platform-specific requirements, see ["Setting up your machine"](http://wiki.qt.io/Get_The_Source). - -##### Licensing - -- Opensource users: - ` = -opensource` -- Commercial users: - ` = -commercial` - -##### Linux, Mac -```sh -cd / -./configure -prefix $PWD/qtbase -nomake tests -make -j 4 -``` - -##### Windows -Open a command prompt. -Ensure the following tools are in your path: -- Supported compiler (Visual Studio 2012+, MinGW-builds gcc 4.9+) -- Perl 5.12+ [ActivePerl](http://www.activestate.com/activeperl/) -- Python 2.7+ [ActivePython](http://www.activestate.com/activepython/) -- Ruby 1.9.3+ [RubyInstaller](http://rubyinstaller.org/) - -```bat -cd \ -configure -prefix %CD%\qtbase -nomake tests -nmake // jom // mingw32-make -``` - -To accelerate qmake bootstrap with MSVC, use `-make-tool jom` or add `/MP` to the CL environment variable. - ---- - -### Build Process - -A typical configure & make build process is used. - -#### Some relevant configure options: - -- `-release` Compile Qt with debugging off -- `-debug` Compile Qt with debugging on -- `-nomake tests` Disable building of tests -- `-nomake examples` Disable building of examples -- `-confirm-license` Automatically acknowledge the LGPL 2.1 license - -**Example for release build:** -```sh -./configure -prefix $PWD/qtbase -make -j4 -``` - -**Example for developer build:** -```sh -./configure -developer-build -make -j4 -``` - -See output of `./configure -help` for more options. - -You can build selected modules with their dependencies: -`make module-` (e.g., `make module-qtdeclarative`) - ---- - -### Hints - -The submodule repository **qtrepotools** contains useful scripts for developers and release engineers. -Consider adding `qtrepotools/bin` to your PATH. - ---- - -### Building Qt5 from git - -See [Building_Qt_5_from_Git](http://wiki.qt.io/Building_Qt_5_from_Git) and README.git for more info. -See [Qt_5 reference platforms](http://wiki.qt.io/Qt_5). - ---- - -### Documentation - -After configuring and compiling Qt, build docs with: -```sh -make docs -``` -Install with: -```sh -make install_docs -``` -Docs are installed in `$QT_INSTALL_DOCS`. -`qmake -query` will list the path. - -Further info: -- `qtbase/doc/README` -- [Qt5 Documentation Project](http://wiki.qt.io diff --git a/README.md b/README.md new file mode 100644 index 00000000000..030c6f3b156 --- /dev/null +++ b/README.md @@ -0,0 +1,186 @@ +Source Repository: https://github.com/qt/qt5 + +Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch provides a patch for Qt 5.12.3 that enables compilation and native execution on macOS ARM64 systems. + +================ + +Branch Modifications (Differences): + This branch is based on the Qt dev branch at commit 8337e20fadddf, which corresponds to the Qt 5.12.3 release state. The following modifications have been applied: + + 1. qtbase Module: + + Fixed a missing #include in libpng to resolve compilation errors. + + Removed the #error "32-bit builds are not supported" directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. + + Added necessary includes (e.g., #include ) for the macOS graphics stack. + + 2. qtmultimedia Module: + + Refactored code in the AVFoundation plugin to replace deprecated C++98 functional utilities (std::binary_function, std::unary_function, std::not2) with modern C++11/14 equivalents (lambda functions). This ensures compatibility with modern compilers enforcing the C++17 standard. + + Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. + +================ + +Build Instructions: + + This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. + + Building Universal Libraries (macOS) + 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. + + 2.Create a Merged libxcb Library: + + On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). + + Use the lipo tool to merge the two architecture-specific libraries into one universal library: + - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + + Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. + + 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. + + cd qt5.12.3_universal + bash build_opoensource.sh + + Building a Single Architecture + If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. + + +================================================================================================================ + +HOW TO BUILD QT5 +================ + + + Synopsis + ======== + + System requirements + ------------------ + + - Perl 5.8 or later + - Python 2.7 or later + - C++ compiler supporting the C++11 standard + + For other platform specific requirements, + please see section "Setting up your machine" on: + http://wiki.qt.io/Get_The_Source + + Licensing: + ---------- + + Opensource users: + + = -opensource + + Commercial users: + + = -commercial + + Linux, Mac: + ----------- + + cd / + ./configure -prefix $PWD/qtbase -nomake tests + make -j 4 + + Windows: + -------- + + Open a command prompt. + Ensure that the following tools can be found in the path: + * Supported compiler (Visual Studio 2012 or later, + MinGW-builds gcc 4.9 or later) + * Perl version 5.12 or later [http://www.activestate.com/activeperl/] + * Python version 2.7 or later [http://www.activestate.com/activepython/] + * Ruby version 1.9.3 or later [http://rubyinstaller.org/] + + cd \ + configure -prefix %CD%\qtbase -nomake tests + nmake // jom // mingw32-make + + To accelerate the bootstrap of qmake with MSVC, it may be useful to pass + "-make-tool jom" on the configure command line. If you do not use jom, + adding "/MP" to the CL environment variable is a good idea. + + More details follow. + + Build! + ====== + + A typical `configure; make' build process is used. + + Some relevant configure options (see configure -help): + + -release Compile and link Qt with debugging turned off. + -debug Compile and link Qt with debugging turned on. + -nomake tests Disable building of tests to speed up compilation + -nomake examples Disable building of examples to speed up compilation + -confirm-license Automatically acknowledge the LGPL 2.1 license. + + Example for a release build: + (adjust the `-jN' parameter as appropriate for your system) + + ./configure -prefix $PWD/qtbase + make -j4 + + Example for a developer build: + (enables more autotests, builds debug version of libraries, ...) + + ./configure -developer-build + make -j4 + + See output of `./configure -help' for documentation on various options to + configure. + + The above examples will build whatever Qt5 modules have been enabled by + default in the build system. + + It is possible to build selected modules with their dependencies by doing + a `make module-'. For example, to build only qtdeclarative, + and the modules it depends on: + + ./configure -prefix $PWD/qtbase + make -j4 module-qtdeclarative + + This can save a lot of time if you are only interested in a subset of Qt5. + + + Hints + ===== + + The submodule repository qtrepotools contains useful scripts for + developers and release engineers. Consider adding qtrepotools/bin + to your PATH environment variable to access them. + + The qt5_tool in qtrepotools has some more features which may be of interest. + Try `qt5_tool --help'. + + + Building Qt5 from git + ===================== + See http://wiki.qt.io/Building_Qt_5_from_Git and README.git + for more information. + See http://wiki.qt.io/Qt_5 for the reference platforms. + + + Documentation + ============= + + After configuring and compiling Qt, building the documentation is possible by running + "make docs". + + After having built the documentation, you need to install it with the following + command: + + make install_docs + + The documentation is installed in the path set to $QT_INSTALL_DOCS. + Running "qmake -query" will list the value of QT_INSTALL_DOCS. + + Information about Qt 5's documentation is located in qtbase/doc/README + or in the following page: http://wiki.qt.io/Qt5DocumentationProject + + Note: Building the documentation is only tested on desktop platforms. From dad02abf1c381b1a3710c70ba3485923070e49c9 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 15:09:15 +0800 Subject: [PATCH 13/17] Adjust the readme format --- README.md | 87 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 030c6f3b156..9c4e0e5aa58 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,67 @@ -Source Repository: https://github.com/qt/qt5 +# Qt 5.12.3 Universal (Apple Silicon/macOS) -Purpose: The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. This branch provides a patch for Qt 5.12.3 that enables compilation and native execution on macOS ARM64 systems. +**Source Repository:** [https://github.com/qt/qt5](https://github.com/qt/qt5) -================ +--- -Branch Modifications (Differences): - This branch is based on the Qt dev branch at commit 8337e20fadddf, which corresponds to the Qt 5.12.3 release state. The following modifications have been applied: +## Purpose - 1. qtbase Module: +> The official Qt 5.12.3 release lacks support for compilation on macOS ARM (Apple Silicon) architectures. +> This branch provides a patch for Qt 5.12.3 that enables compilation and native execution for both Intel (x86_64) and ARM (arm64) architectures, as well as legacy 32-bit Intel (i386). - Fixed a missing #include in libpng to resolve compilation errors. +--- - Removed the #error "32-bit builds are not supported" directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. +## 🚩 **Branch Modifications (Differences)** - Added necessary includes (e.g., #include ) for the macOS graphics stack. +This branch is based on the Qt dev branch at commit `8337e20fadddf` (Qt 5.12.3 release). +**Key changes:** - 2. qtmultimedia Module: +### 1. `qtbase` Module: +- **Fixed:** Missing `#include ` in libpng to resolve compilation errors. +- **Removed:** `#error "32-bit builds are not supported"` directives and related code in Cocoa platform plugins to enable 32-bit (i386) compilation support on macOS. +- **Added:** Necessary includes (e.g., `#include `) for the macOS graphics stack. - Refactored code in the AVFoundation plugin to replace deprecated C++98 functional utilities (std::binary_function, std::unary_function, std::not2) with modern C++11/14 equivalents (lambda functions). This ensures compatibility with modern compilers enforcing the C++17 standard. +### 2. `qtmultimedia` Module: +- **Refactored:** AVFoundation plugin code replacing deprecated C++98 functional utilities (`std::binary_function`, `std::unary_function`, `std::not2`) with modern C++11/14 equivalents (lambda functions, etc.). - Summary: These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal binary build. +**Summary:** +These changes ensure Qt 5.12.3 can be compiled for both Intel (x86_64) and ARM (arm64) architectures on macOS, as well as for the legacy 32-bit Intel (i386) target, creating a more universal build. -================ +--- + +## 🛠️ **Build Instructions** + +This project uses the `build_opensource.sh` script to compile Qt libraries for both x86_64 and ARM64 architectures, then merges them into a single Universal 2 binary. + +### Building Universal Libraries (macOS) + +1. **Prerequisite – Install Identical `libxcb`:** + Before running the build script, install the **same version** of the `libxcb` library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. + +2. **Create a Merged `libxcb` Library:** + - On each machine, locate the `libxcb.dylib` file (usually in `/usr/local/lib` or `/opt/homebrew/lib`). + - Use the `lipo` tool to merge: + ```sh + lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib + ``` + - Replace the system library: Copy the universal `./lib/libxcb.dylib` and overwrite the existing `libxcb.dylib` in your library directory (e.g., `/usr/local/lib`). + +3. **Execute the Build Script:** + ```sh + cd qt5.12.3_universal + bash build_opensource.sh + ``` + +### Building a Single Architecture + +If you **do not need** a universal library, you can modify the `build_opensource.sh` script to compile for only one architecture (either x86_64 or arm64). +Edit the script to comment out or remove the lines for the other architecture. -Build Instructions: - - This project uses the build_opensource.sh script to compile Qt libraries for both x86_64 and ARM64 architectures, subsequently merging them into a single Universal 2 (universal) binary. - - Building Universal Libraries (macOS) - 1.Prerequisite - Install Identical libxcb: Before running the build script, you must install the exact same version of the libxcb library on both your x86_64 (Intel) and ARM64 (Apple Silicon) machines. - - 2.Create a Merged libxcb Library: - - On each machine, locate the libxcb.dylib file you installed (typically in /usr/local/lib or /opt/homebrew/lib). - - Use the lipo tool to merge the two architecture-specific libraries into one universal library: - - lipo -create /path/on/x86_machine/libxcb.dylib /path/on/arm_machine/libxcb.dylib -output ./lib/libxcb.dylib - - Replace the System Library: Copy the newly created universal ./lib/libxcb.dylib file and overwrite the existing libxcb.dylib in the library directory on your primary build machine (e.g., /usr/local/lib/). This step is crucial for the universal Qt build to link correctly. - - 3.Execute the Build Script: Run the script to start the compilation process for both architectures and merge the Qt libraries. - - cd qt5.12.3_universal - bash build_opoensource.sh - - Building a Single Architecture - If you do not require a universal library, you can modify the build_opensource.sh script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the build commands for the architecture you don't need. +--- +## +============================================================ +## Original Qt README ================================================================================================================ From 743a3ccd64f56463c39601c37f252dbc2f495a61 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 15:14:58 +0800 Subject: [PATCH 14/17] Revise readme format --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 9c4e0e5aa58..68b0e647d1b 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,9 @@ This project uses the `build_opensource.sh` script to compile Qt libraries for b If you **do not need** a universal library, you can modify the `build_opensource.sh` script to compile for only one architecture (either x86_64 or arm64). Edit the script to comment out or remove the lines for the other architecture. ---- - ## ============================================================ ## Original Qt README - -================================================================================================================ HOW TO BUILD QT5 ================ From 38d98a771e73c526e3316654ac87bd62093f05b9 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 15:16:07 +0800 Subject: [PATCH 15/17] Revise readme format. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 68b0e647d1b..7dec8c685df 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,6 @@ If you **do not need** a universal library, you can modify the `build_opensource Edit the script to comment out or remove the lines for the other architecture. ## -============================================================ ## Original Qt README HOW TO BUILD QT5 From e8d2d636f536bf6c6be8a02536314d04d274ded7 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 15:23:56 +0800 Subject: [PATCH 16/17] Resubmit the configuration script --- qt.conf | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 qt.conf diff --git a/qt.conf b/qt.conf deleted file mode 100644 index 80e352cee12..00000000000 --- a/qt.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Paths] -Prefix=.. -Plugins=../plugins \ No newline at end of file From 6fbc6dd226f0d08f94d566986e7e41e96103fc79 Mon Sep 17 00:00:00 2001 From: jingjing_tang Date: Mon, 15 Sep 2025 15:35:00 +0800 Subject: [PATCH 17/17] Fix the compilation error of adding the ARM architecture --- .gitmodules | 1 + build_opensource.sh | 1 - make_universal.py | 1 - qt.conf | 3 +++ qtbase | 2 +- qtmultimedia | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 qt.conf diff --git a/.gitmodules b/.gitmodules index b4ff6901f25..92d3bdfe13f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -305,3 +305,4 @@ url = https://github.com/qt/qtwebglplugin.git branch = 5.12.3 status = addon + diff --git a/build_opensource.sh b/build_opensource.sh index 158f674566b..8bce3384992 100644 --- a/build_opensource.sh +++ b/build_opensource.sh @@ -58,4 +58,3 @@ python3 make_universal.py $prj_path/Qt5.12.3 $prj_path/Qt5.12.3_x86_64 $prj_path cp $prj_path/Qt5.12.3_x86_64/bin/macdeployqt $prj_path/Qt5.12.3/bin # qt.conf 用来指定当前 qmake 所依赖的的 Qt 库 cp qt.conf $prj_path/Qt5.12.3/bin - diff --git a/make_universal.py b/make_universal.py index 094220bfd78..327af82b366 100644 --- a/make_universal.py +++ b/make_universal.py @@ -8,7 +8,6 @@ failed = 0 skipped = 0 - def check_arch(file_name, arch): # print("lipo " + file_name + " -verify_arch " + arch) return os.system("lipo " + file_name + " -verify_arch " + arch) diff --git a/qt.conf b/qt.conf new file mode 100644 index 00000000000..7c8013cf9ae --- /dev/null +++ b/qt.conf @@ -0,0 +1,3 @@ +[Paths] +Prefix=.. +Plugins=../plugins diff --git a/qtbase b/qtbase index 9261bd98bdd..a46c2553f44 160000 --- a/qtbase +++ b/qtbase @@ -1 +1 @@ -Subproject commit 9261bd98bdd342f2e5aeec6c1d3c32b7388e0b54 +Subproject commit a46c2553f4402f113629138ba8db3d7498ef22bf diff --git a/qtmultimedia b/qtmultimedia index 6ad847ff120..6191083e483 160000 --- a/qtmultimedia +++ b/qtmultimedia @@ -1 +1 @@ -Subproject commit 6ad847ff12071fdf5d9ede989399cb776c644f7b +Subproject commit 6191083e4837fad094ca4eff7406c3e4f8bc1c4e