Building Qt for Qualcomm Snapdragon 8155P Board
Install INTEGRITY and Qualcomm environment according to the provided instructions from Green Hills and Qualcomm.
To set up the development environment for Qt for INTEGRITY, build Qt from the sources for the Qualcomm Snapdragon 8155P board. Before building Qt, create a shell script that will set up the build environment.
Creating a shell script
Create a new shell script setEnvironment.sh, and save it under your home folder. Add the following export commands to the script:
export PATH=$PATH:/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/comp export INTEGRITY_DIR=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/integrity export INTEGRITY_BSP=platform-sa8155 export INTEGRITY_BUILD_TARGET=chk export QC_MULTIMEDIA_INC_DIR=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/include/amss/multimedia export GL_INC_DIR=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/include/public export GL_LIB_DIR=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/rel/libs/base:/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/rel/libs/multimedia/display:/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/rel/libs/multimedia/graphics:/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/rel/libs/platform/:/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/opengl/esx/build/integrity/prebuilt/
These exports assume you have used the /work/ghs/*
installation directories while installing MULTI IDE and INTEGRITY (see Installing Platform Dependencies). If you have not used the default directories, adjust the exported paths accordingly.
To initialize your build environment, run the following command in a terminal:
source ~/setEnvironment.sh
Note: Run this command in your terminal every time you build Qt, or use the qmake
or CMake build systems.
Getting Qt sources
You can download the Qt source code from your Qt Account.
You can also get the Qt sources from the Git repo. Qt Wiki has instructions for getting Qt sources from Git, see Getting source code.
Note: Qt sources version must be 6.2 or laler.
Note: The init-repository script initializes the Qt 6 repository and clones various Qt 6 sub-modules (see Getting the submodule source code). Qt modules supported by Qt for INTEGRITY are listed in Supported Qt Modules.
Building Qt Desktop for cross-compiling tools usage
The cross-compiling Qt requires a host build of Qt being available. During the build, tools such as moc, rcc, qmlcachegen, qsb, and others, are invoked from there. For more detailed information please read Cross-compiling Qt.
Run the following commands for Linux Host build:
mkdir hostbuild cd hostbuild/ ../qt5/configure -nomake tests -nomake examples -release -developer-build cmake --build . --parallel 6
Creating a toolchain file for INTEGRITY
To cross-compile a project with CMake, one must specify a toolchain file. This CMake-language file sets the right values for the platform name, used compiler/linker, and a whole bunch of other toolchain-specific things. For Integrity build create toolchain.cmake with follow content:
set(TARGET_ROOT_PATH "/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot") set(CMAKE_BUILD_TYPE "Release") set(CMAKE_C_COMPILER cxintarm64) set(CMAKE_CXX_COMPILER cxintarm64) set(CMAKE_ASM_COMPILER cxintarm64) #generic set(CMAKE_SYSTEM_NAME Integrity) set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_CROSSCOMPILING True) set(EGL_FOUND True) set(UNIX True) set (CMAKE_C_COMPILE_FEATURES c_std_99) set (CMAKE_CXX_COMPILE_FEATURES cxx_alias_templates cxx_alignas cxx_alignof cxx_attributes cxx_auto_type cxx_constexp cxx_decltype cxx_delegating_constructors cxx_explicit_conversions cxx_extern_templates cxx_inheriting_constructors cxx_lambdas cxx_noexcept cxx_nonstatic_member_init cxx_nullptr cxx_override cxx_range_for cxx_raw_string_literals cxx_reference_qualified_functions cxx_rvalue_references cxx_static_assert cxx_std_17 cxx_thread_local cxx_unicode_literals cxx_uniform_initialization cxx_unrestricted_unions cxx_variadic_macros cxx_variadic_templates) #base set(CMAKE_C_FLAGS "-bsp $ENV{INTEGRITY_BSP} -os_dir $ENV{INTEGRITY_DIR} -non_shared -startfile_dir=$ENV{INTEGRITY_DIR}/libs/$ENV{INTEGRITY_BSP}/$ENV{INTEGRITY_BUILD_TARGET} --rtos_library_directory=libs/$ENV{INTEGRITY_BSP}/$ENV{INTEGRITY_BUILD_TARGET} --rtos_library_directory=libs/arm64/$ENV{INTEGRITY_BUILD_TARGET} -bigswitch -DINTEGRITY -llibivfs.a -llibposix.a -llibpaged_alloc.a -llibnet.a -llibsocket.a") set(CMAKE_C_FLAGS_DEBUG "-g -Omaxdebug") set(CMAKE_C_FLAGS_RELEASE "-Ospeed -Olink -Omax") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --signed_fields --diag_suppress=1,82,228,236,381,611,961,997,1795,1931,1974,3148 --c++17 --thread_local_storage --exceptions --defer_parse_function_templates") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} --signed_fields --no_implicit_include --link_once_templates -non_shared --new_outside_of_constructor -I $ENV{QC_MULTIMEDIA_INC_DIR}") set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${TARGET_ROOT_PATH} -L${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/out/rel/libs/multimedia/graphics -L${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/out/rel/libs/base -L${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/opengl/esx/build/integrity/prebuilt -L${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/out/rel/libs/platform -L${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/out/rel/libs/multimedia/display/ --commons") set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "") set(QT_CFLAGS_OPTIMIZE_FULL "-Ospeed -Olink -Omax") set(GLSLANG_OSDEP_PATH ../3rdparty/glslang/glslang/OSDependent/Unix) set(GL_INC_DIR ${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/include/public) set(EGL_INCLUDE_DIR ${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/include/public) set(PKG_EGL_LIBRARY_DIRS ${TARGET_ROOT_PATH}) set(EGL_LIBRARY ${TARGET_ROOT_PATH}/libeglmegapack.a) set(GLESv2_LIBRARY ${TARGET_ROOT_PATH}/libeglmegapack.a) set(GLESv2_INCLUDE_DIR ${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/include/public) set(OPENGL_INCLUDE_DIR ${TARGET_ROOT_PATH}/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/include/public) set(OPENGL_opengl_LIBRARY ${TARGET_ROOT_PATH}/libeglmegapack.a)
Creating EGL pack
For CMake find EGL module to properly detect EGL, repack the needed egl libraries into one archive called libeglmegapack:
ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libESXEGL_Adreno.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libadreno_utils.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libESXGLESv2_Adreno.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libadreno_utils.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libGSLUser.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libOSUser.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/graphics/libpanel.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/integrity/libs/arm64/chk/libivfs.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/platform/libpmem.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/platform/libtzbsp.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/integrity/libs/arm64/chk/libpaged_alloc.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/opengl/esx/build/integrity/prebuilt/libglnext-llvm.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/multimedia/display/libopenwfd.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/base/libplanedef.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/platform/liblogger.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/base/librfs_client.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/integrity/libs/arm64/chk/libshm_client.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/base/libmmosalrfs.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/base/libmmosalfile.a ar -x ../hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/out/chk/libs/base/libOSAbstraction.a ar r libeglmegapack.a *.o rm *.o
Copy the resulting libeglmegapack.a
to your installation directory hlos_dev_boot
.
Configuring Qt for INTEGRITY
Configure Qt for the Qualcomm Snapdragon 8155P board using these following commands:
cd <Qt installation directory> cmake ../qt5/ -DQT_HOST_PATH=/work/ghs/hostbuild/qtbase -DCMAKE_TOOLCHAIN_FILE=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/toolchain_integrity.cmake -DQT_QMAKE_TARGET_MKSPEC=devices/integrity-armv8-SA8155P -DBUILD_qtdoc=OFF -DBUILD_qttranslations=OFF -DFEATURE_printdialog=OFF --debug-trycompile -DFEATURE_dbus=OFF -GNinja -DUNIX=ON -DEGL_LIBRARY=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/libeglmegapack.a -DEGL_INCLUDE_DIR=/work/ghs/sa8155/es7/es7_dev_env/hlos_dev_boot/apps/ghs_apps_proc/qc_bsp/AMSS/multimedia/graphics/include/public -DFEATURE_dnslookup=OFF -DFEATURE_glib=OFF -DFEATURE_libudev=OFF -DFEATURE_system_pcre2=OFF -DFEATURE_sql_mysql=OFF
Note: INTEGRITY supports only static Qt builds.
Note: QT_HOST_PATH
variable introduced in Qt 6. When cross-compiling, this must be set to the install location of Qt for the host platform. It is used to locate tools to be run on the host (moc, rcc, androiddeployqt, and so on).
Building Qt for INTEGRITY
Build Qt by calling cmake
in the terminal. You can run cmake
with as many cores on your host machine as you desire. In our example we use six cores:
cmake --build . --parallel 6
Installing Qt
If you have not used the configure option -prefix $PWD/qtbase
in Configuring Qt, run the following commands in a terminal:
cd <Qt installation directory> cmake --install .
If you have used the configure option -prefix $PWD/qtbase
, you can use Qt from the build directory, without running the cmake install
command.
Qt is now configured and built for the sa8155 board.