DREAMER

Jetson Nano Cross Compile in QT 본문

카테고리 없음

Jetson Nano Cross Compile in QT

연소민 2022. 9. 16. 16:52
728x90
반응형

 

 

 

2. Creating a sysroot

디렉토리 정확히 입력

cd qt5jnano
rsync -avz nano@192.168.55.1:/lib sysroot
rsync -avz nano@192.168.55.1:/usr/include sysroot/usr
rsync -avz nano@192.168.55.1:/usr/lib sysroot/usr

 

wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
chmod +x sysroot-relativelinks.py
./sysroot-relativelinks.py sysroot

 

#!/usr/bin/env python
import sys
import os

# Take a sysroot directory and turn all the abolute symlinks and turn them into
# relative ones such that the sysroot is usable within another system.

if len(sys.argv) != 2:
    print("Usage is " + sys.argv[0] + "<directory>")
    sys.exit(1)

topdir = sys.argv[1]
topdir = os.path.abspath(topdir)

def handlelink(filep, subdir):
    link = os.readlink(filep)
    if link[0] != "/":
        return
    if link.startswith(topdir):
        return
    #print("Replacing %s with %s for %s" % (link, topdir+link, filep))
    print("Replacing %s with %s for %s" % (link, os.path.relpath(topdir+link, subdir), filep))
    os.unlink(filep)
    os.symlink(os.path.relpath(topdir+link, subdir), filep)

for subdir, dirs, files in os.walk(topdir):
    for f in files:
        filep = os.path.join(subdir, f)
        if os.path.islink(filep):
            #print("Considering %s" % filep)
            handlelink(filep, subdir)

 

 

 

3. Install QT

 

 

 

5.9.5

 

single

qt-everywhere-opensource-src-5.9.5.tar.xz

 

4. Add Jetson Nano Device

 

linux-jetson-nano.zip

 

qmake.conf

#
# qmake configuration for the Jetson TK1 boards running Linux For Tegra
#
# Note that this environment has been tested with X11 only.
#
# A typical configure line might look like:
# configure \
#   -device linux-jetson-tk1-g++ \
#   -device-option CROSS_COMPILE=/opt/nvidia/toolchains/tegra-4.8.1-nv/usr/bin/arm-cortex_a15-linux-gnueabi/arm-cortex_a15-linux-gnueabi- \
#   -sysroot /opt/nvidia/l4t/targetfs

include(../common/linux_device_pre.conf)

QMAKE_INCDIR_POST += \
    $$[QT_SYSROOT]/usr/include \
    $$[QT_SYSROOT]/usr/include/aarch64-linux-gnu

QMAKE_LIBDIR_POST += \
    $$[QT_SYSROOT]/usr/lib \
    $$[QT_SYSROOT]/lib/aarch64-linux-gnu \
    $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu

QMAKE_RPATHLINKDIR_POST += \
    $$[QT_SYSROOT]/usr/lib \
    $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
    $$[QT_SYSROOT]/lib/aarch64-linux-gnu
    
QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu/tegra-egl

DISTRO_OPTS                  += aarch64
COMPILER_FLAGS               += -march=armv8-a+crypto+crc

EGLFS_DEVICE_INTEGRATION = eglfs_kms_egldevice

include(../common/linux_arm_device_post.conf)
load(qt_config)

 

qplatformdefs.h

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "../../linux-g++/qplatformdefs.h"

 

5. Configure QT to Cross Compile

 

../qt-everywhere-opensource-src-5.9.5/configure -opengl es2 -device linux-jetson-nano -device-option CROSS_COMPILE=/home/user/Public/user/04_Works/NVIDIA/prebuilts/gcc/kernel/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- -sysroot /home/user/Public/user/04_Works/NVIDIA/sources/company/qt5jnano/sysroot -prefix /usr/local/qt5jnano -opensource -confirm-license -skip qtscript -skip wayland -skip qtwebengine -force-debug-info -skip qtlocation -nomake examples -make libs -pkg-config -no-use-gold-linker -v

../qt-everywhere-opensource-src-5.9.5/configure

 -opengl es2

 -device linux-jetson-nano

 -device-option CROSS_COMPILE=/home/user/Public/soyun/04_Works/NVIDIA/prebuilts/gcc/kernel/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

 -sysroot /home/user/Public/user/04_Works/NVIDIA/sources/company/qt5jnano/sysroot

 -prefix /usr/local/qt5jnano

 -opensource

 -confirm-license

 -skip qtscript

 -skip wayland

 -skip qtwebengine

 -force-debug-info

 -skip qtlocation

 -nomake examples

 -make libs

 -pkg-config

 -no-use-gold-linker

 -v

 

 

 

 

6. QT Creator Kits Configuration

 

 

 

 

참고:

https://lifeofcode.net/?p=132 

 

Cross Compiling Qt for Embedded Systems - Life Of Code

In this tutorial, we will be covering how you can cross compile qt to various single board computers such as the Raspberry Pi or Jetson Nano

lifeofcode.net

 

728x90
반응형
Comments