Add Yocto SDK with QT5 to QT Creator: Difference between revisions
Mschmoeller (talk | contribs) |
Pzimmermann (talk | contribs) No edit summary |
||
Line 46: | Line 46: | ||
Add a new kit selecting your new Qt5 version and compiler and setting the sysroot to /opt/dhlinux/nodistro.0/sysroots/cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi and leave the Qt mkspec empty. | Add a new kit selecting your new Qt5 version and compiler and setting the sysroot to /opt/dhlinux/nodistro.0/sysroots/cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi and leave the Qt mkspec empty. | ||
Then select your device | |||
[[Image:Qtcreator-add-kit.jpg|850px]] | [[Image:Qtcreator-add-kit.jpg|850px]] | ||
As the final point you have to set the environment of the kit: Select "Change" at "Environment:". Now a window for editing text opens. Copy all environment variables (all lines with "export"-statement) from the environment setup script /opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi and its imported files (at the end of the script) into the window. Each line should contain one environment variable assignment and "export" has to be removed. | |||
<div class="toccolours mw-collapsible mw-collapsed" style="overflow:auto;"> | |||
<div style="font-weight:bold;">Examlpe for setting the environment variables</div> | |||
<div class="mw-collapsible-content"> | |||
/opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi also includes the files /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/cmake.sh , /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/openssl.sh and /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/qt5.sh . The files have the following content: | |||
/opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi: | |||
<tt># Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice | |||
# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80 | |||
# http://xahlee.info/UnixResource_dir/_/ldpath.html | |||
# Only disable this check if you are absolutely know what you are doing! | |||
if [ ! -z "$LD_LIBRARY_PATH" ]; then | |||
echo "Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'" | |||
echo "but please check why this was set in the first place and that it's safe to unset." | |||
echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set." | |||
echo "For more references see:" | |||
echo " http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80" | |||
echo " http://xahlee.info/UnixResource_dir/_/ldpath.html" | |||
return 1 | |||
fi | |||
export SDKTARGETSYSROOT=/opt/dhlinux/nodistro.0/sysroots/cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi | |||
export PATH=/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/sbin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/bin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/sbin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/../x86_64-oesdk-linux/bin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-gnueabi:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-musl:$PATH | |||
export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT | |||
export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig | |||
export CONFIG_SITE=/opt/dhlinux/nodistro.0/site-config-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi | |||
export OECORE_NATIVE_SYSROOT="/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux" | |||
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT" | |||
export OECORE_ACLOCAL_OPTS="-I /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/share/aclocal" | |||
export OECORE_BASELIB="lib" | |||
export OECORE_TARGET_ARCH="arm" | |||
export OECORE_TARGET_OS="linux-gnueabi" | |||
unset command_not_found_handle | |||
export CC="arm-dhlinux-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" | |||
export CXX="arm-dhlinux-linux-gnueabi-g++ -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" | |||
export CPP="arm-dhlinux-linux-gnueabi-gcc -E -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" | |||
export AS="arm-dhlinux-linux-gnueabi-as " | |||
export LD="arm-dhlinux-linux-gnueabi-ld --sysroot=$SDKTARGETSYSROOT" | |||
export GDB=arm-dhlinux-linux-gnueabi-gdb | |||
export STRIP=arm-dhlinux-linux-gnueabi-strip | |||
export RANLIB=arm-dhlinux-linux-gnueabi-ranlib | |||
export OBJCOPY=arm-dhlinux-linux-gnueabi-objcopy | |||
export OBJDUMP=arm-dhlinux-linux-gnueabi-objdump | |||
export READELF=arm-dhlinux-linux-gnueabi-readelf | |||
export AR=arm-dhlinux-linux-gnueabi-ar | |||
export NM=arm-dhlinux-linux-gnueabi-nm | |||
export M4=m4 | |||
export TARGET_PREFIX=arm-dhlinux-linux-gnueabi- | |||
export CONFIGURE_FLAGS="--target=arm-dhlinux-linux-gnueabi --host=arm-dhlinux-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=$SDKTARGETSYSROOT" | |||
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types " | |||
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types " | |||
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed" | |||
export CPPFLAGS="" | |||
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT" | |||
export OECORE_DISTRO_VERSION="0.0.1" | |||
export OECORE_SDK_VERSION="nodistro.0" | |||
export ARCH=arm | |||
export CROSS_COMPILE=arm-dhlinux-linux-gnueabi- | |||
# Append environment subscripts | |||
if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then | |||
for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do | |||
. $envfile | |||
done | |||
fi | |||
if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then | |||
for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do | |||
. $envfile | |||
done | |||
fi</tt> | |||
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/cmake.sh: | |||
<tt>export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake" | |||
export OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX="`echo $OECORE_BASELIB | sed -e s/lib//`"</tt> | |||
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/openssl.sh: | |||
<tt>export PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH | |||
export OE_QMAKE_CFLAGS="$CFLAGS" | |||
export OE_QMAKE_CXXFLAGS="$CXXFLAGS" | |||
export OE_QMAKE_LDFLAGS="$LDFLAGS" | |||
export OE_QMAKE_CC="$CC" | |||
export OE_QMAKE_CXX="$CXX" | |||
export OE_QMAKE_LINK="$CXX" | |||
export OE_QMAKE_AR=$AR | |||
export OE_QMAKE_STRIP=$STRIP | |||
export QT_CONF_PATH=$OECORE_NATIVE_SYSROOT/usr/bin/qt.conf | |||
export OE_QMAKE_LIBDIR_QT=`qmake -query QT_INSTALL_LIBS` | |||
export OE_QMAKE_INCDIR_QT=`qmake -query QT_INSTALL_HEADERS` | |||
export OE_QMAKE_MOC=$OECORE_NATIVE_SYSROOT/usr/bin/moc | |||
export OE_QMAKE_UIC=$OECORE_NATIVE_SYSROOT/usr/bin/uic | |||
export OE_QMAKE_RCC=$OECORE_NATIVE_SYSROOT/usr/bin/rcc | |||
export OE_QMAKE_QDBUSCPP2XML=$OECORE_NATIVE_SYSROOT/usr/bin/qdbuscpp2xml | |||
export OE_QMAKE_QDBUSXML2CPP=$OECORE_NATIVE_SYSROOT/usr/bin/qdbusxml2cpp | |||
export OE_QMAKE_QT_CONFIG=`qmake -query QT_INSTALL_LIBS`/mkspecs/qconfig.pri | |||
export OE_QMAKE_PATH_HOST_BINS=$OECORE_NATIVE_SYSROOT/usr/bin | |||
export QMAKESPEC=`qmake -query QT_INSTALL_LIBS`/mkspecs/linux-oe-g++</tt> | |||
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/qt5.sh: | |||
<tt>export OPENSSL_CONF="$OECORE_NATIVE_SYSROOT/usr/lib/ssl-1.1/openssl.cnf"</tt> | |||
This results in the following environment configuration: | |||
[[File:Qtcreator-set-environment.png|1000px]] | |||
</div></div> | |||
If there is a warning/error shown, please click apply between each step | If there is a warning/error shown, please click apply between each step |
Revision as of 12:16, 26 June 2020
The following instructions are based on DHCOM STM32MP1 computer on module and Yocto version "zeus"
Prepairing your virtual machine
Get the Virtual Machine for Application Development.
Install the following package:
$ sudo apt-get install qtcreator qt5default
Download and install the SDK package
Get the QT5 SDK for STM32mp1
Unpack the archive and install the toolchain.
$ sh ./dhlinux-glibc-x86_64-meta-toolchain-qt5-cortexa7t2hf-neon-vfpv4-toolchain-nodistro.0.sh
Choose the installation directory (default: /opt/dhlinux/nodistro.0/).
The toolchain is now installed to your system.
Configure Qt Creator
Run QT Creator
In Qt Creator go to Tools > Options > Devices and add your Wandboard as a generic linux device.
go to Tools > Options > Build & Run and:
Add a new c++ compiler. Select your compiler: /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-gnueabi/arm-dhlinux-linux-gnueabi-g++
Add a new debugger. Select your debugger: /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-gnueabi/arm-dhlinux-linux-gnueabi-gdb
Add your Qt version by selecting the qmake located in /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/qmake
Add a new kit selecting your new Qt5 version and compiler and setting the sysroot to /opt/dhlinux/nodistro.0/sysroots/cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi and leave the Qt mkspec empty. Then select your device
As the final point you have to set the environment of the kit: Select "Change" at "Environment:". Now a window for editing text opens. Copy all environment variables (all lines with "export"-statement) from the environment setup script /opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi and its imported files (at the end of the script) into the window. Each line should contain one environment variable assignment and "export" has to be removed.
/opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi also includes the files /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/cmake.sh , /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/openssl.sh and /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/qt5.sh . The files have the following content:
/opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi:
# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice # http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80 # http://xahlee.info/UnixResource_dir/_/ldpath.html # Only disable this check if you are absolutely know what you are doing! if [ ! -z "$LD_LIBRARY_PATH" ]; then echo "Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'" echo "but please check why this was set in the first place and that it's safe to unset." echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set." echo "For more references see:" echo " http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80" echo " http://xahlee.info/UnixResource_dir/_/ldpath.html" return 1 fi export SDKTARGETSYSROOT=/opt/dhlinux/nodistro.0/sysroots/cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi export PATH=/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/sbin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/bin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/sbin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/../x86_64-oesdk-linux/bin:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-gnueabi:/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-musl:$PATH export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig export CONFIG_SITE=/opt/dhlinux/nodistro.0/site-config-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi export OECORE_NATIVE_SYSROOT="/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux" export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT" export OECORE_ACLOCAL_OPTS="-I /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/share/aclocal" export OECORE_BASELIB="lib" export OECORE_TARGET_ARCH="arm" export OECORE_TARGET_OS="linux-gnueabi" unset command_not_found_handle export CC="arm-dhlinux-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" export CXX="arm-dhlinux-linux-gnueabi-g++ -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" export CPP="arm-dhlinux-linux-gnueabi-gcc -E -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" export AS="arm-dhlinux-linux-gnueabi-as " export LD="arm-dhlinux-linux-gnueabi-ld --sysroot=$SDKTARGETSYSROOT" export GDB=arm-dhlinux-linux-gnueabi-gdb export STRIP=arm-dhlinux-linux-gnueabi-strip export RANLIB=arm-dhlinux-linux-gnueabi-ranlib export OBJCOPY=arm-dhlinux-linux-gnueabi-objcopy export OBJDUMP=arm-dhlinux-linux-gnueabi-objdump export READELF=arm-dhlinux-linux-gnueabi-readelf export AR=arm-dhlinux-linux-gnueabi-ar export NM=arm-dhlinux-linux-gnueabi-nm export M4=m4 export TARGET_PREFIX=arm-dhlinux-linux-gnueabi- export CONFIGURE_FLAGS="--target=arm-dhlinux-linux-gnueabi --host=arm-dhlinux-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=$SDKTARGETSYSROOT" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types " export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types " export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed" export CPPFLAGS="" export KCFLAGS="--sysroot=$SDKTARGETSYSROOT" export OECORE_DISTRO_VERSION="0.0.1" export OECORE_SDK_VERSION="nodistro.0" export ARCH=arm export CROSS_COMPILE=arm-dhlinux-linux-gnueabi- # Append environment subscripts if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do . $envfile done fi if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do . $envfile done fi
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/cmake.sh:
export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake" export OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX="`echo $OECORE_BASELIB | sed -e s/lib//`"
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/openssl.sh:
export PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH export OE_QMAKE_CFLAGS="$CFLAGS" export OE_QMAKE_CXXFLAGS="$CXXFLAGS" export OE_QMAKE_LDFLAGS="$LDFLAGS" export OE_QMAKE_CC="$CC" export OE_QMAKE_CXX="$CXX" export OE_QMAKE_LINK="$CXX" export OE_QMAKE_AR=$AR export OE_QMAKE_STRIP=$STRIP export QT_CONF_PATH=$OECORE_NATIVE_SYSROOT/usr/bin/qt.conf export OE_QMAKE_LIBDIR_QT=`qmake -query QT_INSTALL_LIBS` export OE_QMAKE_INCDIR_QT=`qmake -query QT_INSTALL_HEADERS` export OE_QMAKE_MOC=$OECORE_NATIVE_SYSROOT/usr/bin/moc export OE_QMAKE_UIC=$OECORE_NATIVE_SYSROOT/usr/bin/uic export OE_QMAKE_RCC=$OECORE_NATIVE_SYSROOT/usr/bin/rcc export OE_QMAKE_QDBUSCPP2XML=$OECORE_NATIVE_SYSROOT/usr/bin/qdbuscpp2xml export OE_QMAKE_QDBUSXML2CPP=$OECORE_NATIVE_SYSROOT/usr/bin/qdbusxml2cpp export OE_QMAKE_QT_CONFIG=`qmake -query QT_INSTALL_LIBS`/mkspecs/qconfig.pri export OE_QMAKE_PATH_HOST_BINS=$OECORE_NATIVE_SYSROOT/usr/bin export QMAKESPEC=`qmake -query QT_INSTALL_LIBS`/mkspecs/linux-oe-g++
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/qt5.sh:
export OPENSSL_CONF="$OECORE_NATIVE_SYSROOT/usr/lib/ssl-1.1/openssl.cnf"
This results in the following environment configuration:
If there is a warning/error shown, please click apply between each step