XuQi's Blog

  • 首页

  • 归档

树莓派交叉编译

发表于 2019-08-03 更新于 2019-10-20

挂载共享smb

1
2
3
4
sudo apt install cifs-utils 
sudo mount -t cifs //ip/文件夹 /mnt/文件夹 -o username=用户名,password=密码,vers=1.0

sudo mount -t cifs //192.168.1.100/93ee/software /mnt/

Ubuntu 上配置树莓派的交叉编译环境envbuild.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
mkdir -p ~/toolchain
cd ~
if [ $1 == "pi" ]; then
url="https://s3.amazonaws.com/RTI/Community/ports/toolchains/raspbian-toolchain-gcc-4.7.2-linux32.tar.gz"
name="$(pwd)/toolchain/raspbian-toolchain-gcc-4.7.2-linux32"

if [ ! -d "$name" ]; then
wget $url
tar -zxvf raspbian-toolchain-gcc-4.7.2-linux32.tar.gz $name
fi
export PATH=$name/bin:$PATH
export CROSS_COMPILE=arm-raspbian-linux-gnueabi-
export ARCH=arm

fi
cd -

使用方法:

1
. envbuild.sh pi

Ubuntu编译QT

https://blog.csdn.net/christine14122/article/details/83621585

编辑脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
./configure \
-prefix ../qt-output \
-xplatform linux-g++-64 \
-no-static \
-qt-libpng \
-qt-libjpeg \
-qt-zlib \
-no-strip \
-no-framework \
-no-sse2 \
-no-sse3 \
-no-sse4.1 \
-no-sse4.2 \
-no-avx \
-no-avx2 \
-no-avx512 \
-no-mips_dsp \
-no-mips_dspr2 \
-no-icu \
-no-sql-sqlite \
-no-accessibility \
-no-ssl \
-disable-system-proxies \
-no-cups \
-no-gtk \
-no-opengles3 \
-no-xcb \
-no-ico \
-no-opengl \
-no-eglfs \
-no-direct2d \
-no-directfb \
-no-gbm \
-no-kms \
-no-mirclient \
-no-xcb \
-no-xkbcommon-evdev \
-no-xkbcommon-x11 \
-no-doubleconversion \
-enable-linuxfb \
-qt-freetype \
-make libs \
-nomake examples \
-nomake tests \
-nomake tools \
-opensource \
-confirm-license \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtcharts \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdeclarative \
-skip qtdoc \
-skip qtgamepad \
-skip qtgraphicaleffects \
-skip qtlocation \
-skip qtmacextras \
-skip qtmultimedia \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtquickcontrols \
-skip qtquickcontrols2 \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtserialbus \
-skip qtserialport \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtvirtualkeyboard \
-skip qtwayland \
-skip qtwebchannel \
-skip qtwebengine \
-skip qtwebglplugin \
-skip qtwebsockets \
-skip qtwebview \
-skip qtwinextras \
-skip qtxmlpatterns \
-skip qtx11extras \
-no-iconv \
-no-harfbuzz \
-no-evdev

树莓派交叉环境编译

配置交叉编译环境
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
mkdir -p ~/toolchain
cd ~
if [ $1 == "pi" ]; then
url="https://s3.amazonaws.com/RTI/Community/ports/toolchains/raspbian-toolchain-gcc-4.7.2-linux32.tar.gz"
name="$(pwd)/toolchain/raspbian-toolchain-gcc-4.7.2-linux32"

if [ ! -d "$name" ]; then
wget $url
tar -zxvf raspbian-toolchain-gcc-4.7.2-linux32.tar.gz $name
fi
export PATH=$name/bin:$PATH
export CROSS_COMPILE=arm-raspbian-linux-gnueabi-
export CC="$CROSS_COMPILE"gcc
export CXX="$CROSS_COMPILE"g++
fi

cd -
修改qmake.conf

复制一份qt-everywhere-opensource-src-5.1.1/qtbase/mkspecs/arm-raspbian-linux-gnueabi-g++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental gdb_dwarf_index
QMAKE_INCREMENTAL_STYLE = sublib

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

QT_QPA_DEFAULT_PLATFORM=linuxfb

# modifications to g++.conf
QMAKE_CC = arm-raspbian-linux-gnueabi-gcc
QMAKE_CXX = arm-raspbian-linux-gnueabi-g++
QMAKE_LINK = arm-raspbian-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-raspbian-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR = arm-raspbian-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-raspbian-linux-gnueabi-objcopy
QMAKE_NM = arm-raspbian-linux-gnueabi-nm -P
QMAKE_STRIP = arm-raspbian-linux-gnueabi-strip
load(qt_config)
编写脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh  
tar xvf ../arm-raspbian-linux-gnueabi-g++.tar.gz -C ./qtbase/mkspecs/
./configure -prefix ../qt-output_pi/ \
-opensource \
-release \
-confirm-license \
-xplatform arm-raspbian-linux-gnueabi-g++ \
-no-opengl \
-no-pch \
-shared \
-no-iconv \
-no-xcb \
-nomake examples \
-nomake tests \
-nomake tools \
编译
1
make -j4 && make install
CMake编译QT
Linux管道pipe
  • 文章目录
  • 站点概览

XuQi

44 日志
30 标签
  1. 1. 挂载共享smb
  2. 2. Ubuntu 上配置树莓派的交叉编译环境envbuild.sh
    1. 2.1. Ubuntu编译QT
    2. 2.2. 树莓派交叉环境编译
      1. 2.2.1. 配置交叉编译环境
      2. 2.2.2. 修改qmake.conf
      3. 2.2.3. 编写脚本
      4. 2.2.4. 编译
© 2019 XuQi
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Muse v7.3.0