It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

QMake cross compile build error Edited

I want to cross compile a Qt project using pipelines. My config looks like this:

pipelines:  branches:    master:
      - step:          script:
          - echo "setting up build environment ..."
          - . /opt/XXXXXXXX/$DOCKER_IMAGEVERSION/environment-setup
          - qmake --version
          - qmake -query
          - qmake -d qt-build-test.pro
          - make

The environment-setup file looks like this:

# 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/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi
export PATH=/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/sbin:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/bin:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/sbin:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/../x86_64-XXXXXXXXXXXsdk-linux/bin:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/arm-XXXXXXXXXXX-linux-gnueabi:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/arm-XXXXXXXXXXX-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/XXXXXXXXXXX/0.9.0/site-config-cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi
export OECORE_NATIVE_SYSROOT="/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux"
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"
export OECORE_ACLOCAL_OPTS="-I /opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-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-XXXXXXXXXXX-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export CXX="arm-XXXXXXXXXXX-linux-gnueabi-g++ -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export CPP="arm-XXXXXXXXXXX-linux-gnueabi-gcc -E -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
export AS="arm-XXXXXXXXXXX-linux-gnueabi-as "
export LD="arm-XXXXXXXXXXX-linux-gnueabi-ld --sysroot=$SDKTARGETSYSROOT"
export GDB=arm-XXXXXXXXXXX-linux-gnueabi-gdb
export STRIP=arm-XXXXXXXXXXX-linux-gnueabi-strip
export RANLIB=arm-XXXXXXXXXXX-linux-gnueabi-ranlib
export OBJCOPY=arm-XXXXXXXXXXX-linux-gnueabi-objcopy
export OBJDUMP=arm-XXXXXXXXXXX-linux-gnueabi-objdump
export AR=arm-XXXXXXXXXXX-linux-gnueabi-ar
export NM=arm-XXXXXXXXXXX-linux-gnueabi-nm
export M4=m4
export TARGET_PREFIX=arm-XXXXXXXXXXX-linux-gnueabi-
export CONFIGURE_FLAGS="--target=arm-XXXXXXXXXXX-linux-gnueabi --host=arm-XXXXXXXXXXX-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.9.0"
export OECORE_SDK_VERSION="0.9.0"
export ARCH=arm
export CROSS_COMPILE=arm-XXXXXXXXXXX-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

and in native sysroot there is a qt.sh script which does this:

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++

 

 when I run the pipeline locally in the docker container output of qmake -query is:

OE_QMAKE_AR:arm-XXXXXXXXXXX-linux-gnueabi-ar
QMAKE_AR:/opt/XXXXXXXXXXX/0.1/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/arm-XXXXXXXXXXX-linux-gnueabi/arm-XXXXXXXXXXX-linux-gnueabi-ar
test:dfdgdfg
QT_SYSROOT:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi
QT_INSTALL_PREFIX:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr
QT_INSTALL_PREFIX/raw:/usr
QT_INSTALL_ARCHDATA:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/lib
QT_INSTALL_ARCHDATA/raw:/usr/lib
QT_INSTALL_DATA:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/share
QT_INSTALL_DATA/raw:/usr/share
QT_INSTALL_DOCS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/share/doc
QT_INSTALL_DOCS/raw:/usr/share/doc
QT_INSTALL_HEADERS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/include
QT_INSTALL_HEADERS/raw:/usr/include
QT_INSTALL_LIBS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/lib
QT_INSTALL_LIBS/raw:/usr/lib
QT_INSTALL_LIBEXECS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/lib/libexec
QT_INSTALL_LIBEXECS/raw:/usr/lib/libexec
QT_INSTALL_BINS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/bin
QT_INSTALL_BINS/raw:/usr/bin
QT_INSTALL_TESTS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/share/tests
QT_INSTALL_TESTS/raw:/usr/share/tests
QT_INSTALL_PLUGINS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/lib/plugins
QT_INSTALL_PLUGINS/raw:/usr/lib/plugins
QT_INSTALL_IMPORTS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/imports
QT_INSTALL_IMPORTS/raw:/usr/imports
QT_INSTALL_QML:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/lib/qml
QT_INSTALL_QML/raw:/usr/lib/qml
QT_INSTALL_TRANSLATIONS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/share/translations
QT_INSTALL_TRANSLATIONS/raw:/usr/share/translations
QT_INSTALL_CONFIGURATION:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/etc
QT_INSTALL_CONFIGURATION/raw:/etc
QT_INSTALL_EXAMPLES:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/share/examples
QT_INSTALL_EXAMPLES/raw:/usr/share/examples
QT_INSTALL_DEMOS:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/share/examples
QT_INSTALL_DEMOS/raw:/usr/share/examples
QT_HOST_PREFIX:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux
QT_HOST_DATA:/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi/usr/lib
QT_HOST_BINS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_HOST_LIBS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/lib
QMAKE_SPEC:linux-oe-g++
QMAKE_XSPEC:linux-oe-g++
QMAKE_VERSION:3.1
QT_VERSION:5.12.3

 and the output of the qmake -query inside the bitbucket pipeline is:

QT_SYSROOT:
QT_INSTALL_PREFIX:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_INSTALL_ARCHDATA:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_INSTALL_DATA:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_INSTALL_DOCS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/doc
QT_INSTALL_HEADERS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/include
QT_INSTALL_LIBS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/lib
QT_INSTALL_LIBEXECS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/libexec
QT_INSTALL_BINS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/bin
QT_INSTALL_TESTS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/tests
QT_INSTALL_PLUGINS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/plugins
QT_INSTALL_IMPORTS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/imports
QT_INSTALL_QML:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/qml
QT_INSTALL_TRANSLATIONS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/translations
QT_INSTALL_CONFIGURATION:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_INSTALL_EXAMPLES:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/examples
QT_INSTALL_DEMOS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/examples
QT_HOST_PREFIX:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_HOST_DATA:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin
QT_HOST_BINS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/bin
QT_HOST_LIBS:/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux/usr/bin/lib
QMAKE_SPEC:linux-oe-g++
QMAKE_XSPEC:linux-oe-g++
QMAKE_VERSION:3.1
QT_VERSION:5.12.3 

So to sum it up the issue is that all paths are using the host path (/opt/XXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXsdk-linux) instead of the target path (/opt/XXXXXXXXXXX/0.9.0/sysroots/cortexa9hf-neon-XXXXXXXXXXX-linux-gnueabi)

Why are the paths used by qmake different when run in bitbucket pipelines compared to when running it locally in my docker container?

1 answer

I went trough the output of printenv of my local docker container and the bitbucket pipeline and found that those ones are different:

* OE_QMAKE_QT_CONFIG=/opt/XXXXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXXXsdk-linux/usr/bin/lib/mkspecs/qconfig.pri
* OE_QMAKE_LIBDIR_QT=/opt/XXXXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXXXsdk-linux/usr/bin/lib
* QMAKESPEC=/opt/XXXXXXXXXXXXX/0.9.0/sysroots/x86_64-XXXXXXXXXXXXXsdk-linux/usr/bin/lib/mkspecs/linux-oe-g++

So it seems like the qt5.sh script when calling:

export VAR=`qmake -query QT_INSTALL_LIBS´/some/path 

yields two different paths

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,051 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you