首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

arm-linux-cc 4

  • 25-03-07 16:50
  • 2128
  • 5159
blog.csdn.net

配置完后执行编译安装命令。

make
make install

  • 1
  • 2
  • 3

执行make install的时候遇到了如下错误:

./libtool: line 1719: arm-none-linux-gnueabi-ranlib: command not found
Makefile:5118: recipe for target 'install-usrlib\_execLTLIBRARIES' failed

  • 1
  • 2
  • 3

出现错误的原因可以参考这篇文章make install时"arm-linux-ranlib command not found",参照里面的方案切换成root用户执行install:

sudo su
make install

  • 1
  • 2
  • 3

install完成后记得不要忘了切换回原来的用户。

su usename

  • 1
  • 2

3 重新配置makefile,编译出libuuid。

./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ \
--prefix=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi \
--host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi  \
--without-python --without-tinfo --without-ncursesw \
--without-ncurses --without-systemd \
-disable-libmount --disable-libblkid --disable-libfdisk

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

然后执行make install ,install 之前同样要使用su命令。之所以先编译libuuid是因为libfdisk和libblkid的编译依赖libuuid,否则会出现如下错误:

./.libs/libblkid.so: undefined reference to `uuid_unparse@UUID_1.0'
collect2: ld returned 1 exit status
Makefile:5977: recipe for target 'blkid' failed

  • 1
  • 2
  • 3
  • 4

4 编译libblkid,因为libfdisk的编译依赖libblkid。

./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ \
--prefix=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi \
--host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi  \
--without-python --without-tinfo --without-ncursesw --without-ncurses \
--without-systemd -disable-libmount --disable-libfdisk

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

5 编译libfdisk,libmount的编译依赖libfdisk。

./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ \
--prefix=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi \
--host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi  \
--without-python --without-tinfo --without-ncursesw --without-ncurses \
--without-systemd -disable-libmount 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

6 编译libmount

./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ \
--prefix=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi \
--host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi  \
--without-python --without-tinfo --without-ncursesw --without-ncurses \
--without-systemd

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

终于编译除了libmount,像俄罗斯套娃一样。note:如果编译的时候某个项目缺少依赖的lib,可以先disable该项目,先编译出依赖再开启。
libmount install完成后重新配置meson,但是仍然会出现找不到该lib的错误。

glib| Run-time dependency mount found: NO
subprojects/glib/meson.build:1868:2: ERROR: Pkg-config binary for machine MachineChoice.HOST not found. Giving up.

  • 1
  • 2
  • 3

install 仍然找不到lib是因为pkgconfig文件路径不正确,pkgconfig文件的后缀名是.pc,里面指明了该lib的头文件以及so地址,如mount.pc。

prefix=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi
exec\_prefix=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi
libdir=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/lib
includedir=/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/include

Name: mount
Description: mount library
Version: 2.32.1
Requires.private: blkid
Cflags: -I${includedir}/libmount
Libs: -L${libdir} -lmount

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

之前编译的libmount install 在了toolchain目录,所以在cross_file.txt中更新pkgconfig路径。

[properties]
pkg_config_libdir = ['/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/lib/pkgconfig']

[binaries]
c = 'arm-none-linux-gnueabi-gcc'
cpp = 'arm-none-linux-gnueabi-g++'
ar = 'arm-none-linux-gnueabi-ar'
strip = 'arm-none-linux-gnueabi-strip'
pkgconfig = 'pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'ARM9'
endian = 'little'

[build_machine]
system = 'linux'
cpu_family = 'x86\_64'
cpu = 'i686'
endian = 'little'

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

更新pkgconfig就可以meson配置时就可以检测到该lib了,会出现以下log。

Run-time dependency mount found: YES 2.32.1

  • 1
  • 2
3 gst-omx配置错误

meson 配置gst-omx时会出现以下错误:

subprojects/gst-omx/meson.build:220:2: ERROR: Problem encountered: Unsupported omx target specified. Use the -Dtarget option

  • 1
  • 2

原因option 中target参数没有指定的原因,所以通过-D参数修改subprojects/gst-omx目录下meson_option.txt中target选项。

meson build --cross-file cross_file.txt -D gst-omx:target=rpi 

  • 1
  • 2

不出意外的话这次会配置成功,会出现以下log:

All GStreamer modules 1.18.5.1

  Subprojects
    FFmpeg                    : YES 12 warnings
    avtp                      : YES
    dssim                     : NO Dependency "libpng" not found, tried pkgconfig
    gl-headers                : YES
    glib                      : YES 4 warnings
    glib-networking           : NO Problem encountered: No TLS backends enabled. Please enable at least one TLS backend
    gst-devtools              : YES
    gst-editing-services      : NO Feature 'ges' disabled
    gst-examples              : YES
    gst-integration-testsuites: YES
    gst-libav                 : YES
    gst-omx                   : NO Feature 'omx' disabled
    gst-plugins-bad           : YES 1 warnings
    gst-plugins-base          : YES 2 warnings
    gst-plugins-good          : YES 2 warnings
    gst-plugins-rs            : NO Feature 'rs' disabled
    gst-plugins-ugly          : NO Requested variable "plugins\_cache\_generator" not found.
    gst-python                : NO Subproject "subprojects/pygobject" required but not found.
    gst-rtsp-server           : YES
    gstreamer                 : YES 3 warnings
    gstreamer-sharp           : NO Feature 'sharp' disabled
    gstreamer-vaapi           : NO Feature 'vaapi' disabled
    json-glib                 : YES
    libdrm                    : YES
    libffi                    : YES
    libmicrodns               : YES
    libnice                   : NO Problem encountered: Either GnuTLS or OpenSSL is required as crypto library, but neither was found
    libopenjp2                : NO Dependency "wxWidgets" not found, tried config-tool
    libpsl                    : YES
    libsoup                   : YES 4 warnings
    libxml2                   : YES
    openh264                  : NO Program 'nasm nasm.exe' not found
    openssl                   : NO Neither a subproject directory nor a openssl.wrap file was found.
    orc                       : YES 3 warnings
    pygobject                 : NO Python dependency not found
    sqlite                    : YES
    tinyalsa                  : NO Neither a subproject directory nor a tinyalsa.wrap file was found.
    x264                      : YES

Found ninja-1.10.2.git.kitware.jobserver-1 at /usr/local/bin/ninja

  • 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

3 编译过程中遇到的问题

配置成功后可以执行编译命令:

ninja -C build

  • 1
  • 2

编译的过程中遇到了不少问题,逐一记录解决方案。

1 编译glib失败

编译glib中遇到了以下错误:

../subprojects/glib/glib/gnulib/xsize.h:65: error: no previous prototype for 'xsum'
../subprojects/glib/glib/gnulib/xsize.h:76: error: no previous prototype for 'xsum3'
../subprojects/glib/glib/gnulib/xsize.h:86: error: no previous prototype for 'xsum4'
../subprojects/glib/glib/gnulib/xsize.h:96: error: no previous prototype for 'xmax'

  • 1
  • 2
  • 3
  • 4
  • 5

解决方案可以参考arm-linux-cc 4.4.3 交叉编译glib 2.70.1。
直接subprojects/glib目录meson.build文件中加一句use_system_printf = true,强制使用系统print,不编译vasnprintf。

# Our printf is 'good' only if vsnpintf()/snprintf()/printf() supports C99 well enough
use_system_printf = have_good_vsnprintf and have_good_snprintf and have_good_printf
use_system_printf = true
glib_conf.set('USE\_SYSTEM\_PRINTF', use_system_printf)
glibconfig_conf.set('GLIB\_USING\_SYSTEM\_PRINTF', use_system_printf)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
2 编译gst-plugins-base遇到“declarations are only allowed in C99 mode”错误

错误信息如下:

../subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c:2772: error: 'for' loop initial declarations are only allowed in C99 mode
../subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c:2772: note: use option -std=c99 or -std=gnu99 to compile your code

  • 1
  • 2
  • 3

出现错误的原因是gcc是基于c89标准的,而C89标准不支持循环语句如下这样定义:

for(int i=0; i
  • 1
  • 2

必须要写成下面这样:

int i;
for(i=0;i
  • 1
  • 2
  • 3

卧底个乖乖,难道要逐一改用到for循环的源码吗,那岂不是要人命!当然不是,编译的时候可以通过添加参数换成gnu99标准就可以了,编译单个文件可以这样写:

gcc src.c -std=gnu99 -o src

  • 1
  • 2

meson 编译在cross_file.txt中添加参数就可以了,更改后文件如下:

[properties]
pkg_config_libdir = ['/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/lib/pkgconfig', '/home/zhy/code/toolchain\_lib/lib/pkgconfig']
c_args = ['-std=gnu99']

[binaries]
c = 'arm-none-linux-gnueabi-gcc'
cpp = 'arm-none-linux-gnueabi-g++'
ar = 'arm-none-linux-gnueabi-ar'
strip = 'arm-none-linux-gnueabi-strip'
pkgconfig = 'pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'ARM9'
endian = 'little'

[build_machine]
system = 'linux'
cpu_family = 'x86\_64'
cpu = 'x86\_64'
endian = 'little'

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
3 编译gst-plugins-good遇到“‘O_CLOEXEC’ undeclared”错误

错误信息入下:

../subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c:3032: error: 'O\_CLOEXEC' undeclared (first use in this function)
../subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c:3032: error: (Each undeclared identifier is reported only once
../subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c:3032: error: for each function it appears in.)

  • 1
  • 2
  • 3
  • 4

原因是O_CLOEXEC宏未定义,同样在cross_file.txt添加宏定义,添加后的cross_file.txt:

[properties]
pkg_config_libdir = ['/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/lib/pkgconfig', '/home/zhy/code/toolchain\_lib/lib/pkgconfig']
c_args = ['-std=gnu99', '-D\_GNU\_SOURCE']

[binaries]
c = 'arm-none-linux-gnueabi-gcc'
cpp = 'arm-none-linux-gnueabi-g++'
ar = 'arm-none-linux-gnueabi-ar'
strip = 'arm-none-linux-gnueabi-strip'
pkgconfig = 'pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'ARM9'
endian = 'little'

[build_machine]
system = 'linux'
cpu_family = 'x86\_64'
cpu = 'x86\_64'
endian = 'little'

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

cross_file.txt来来回回改了三次,因为是记录过程,所以没有一次性写清楚。

4 编译libdrm遇到“undefined reference to ‘clock_gettime’”错误

错误信息如下:

subprojects/libdrm-2.4.100/amdgpu/libdrm_amdgpu.so.1.0.0.p/amdgpu_cs.c.o: In function `amdgpu\_cs\_calculate\_timeout':
/home/zhy/code/gstreamer/source\_code/gst-build/build/../subprojects/libdrm-2.4.100/amdgpu/amdgpu\_cs.c:407: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status

  • 1
  • 2
  • 3
  • 4

查看错误信息是在编译libdrm_amdgpu时出错,因为不需要amdgpu模块,所以选择不编译,将gst-build/subprojects/libdrm-2.4.100/meson_option.txt中amdgpu设置为false。

option(
  'amdgpu',
  type : 'combo',
  value : 'false',
  choices : ['true', 'false', 'auto'],
  description : '''Enable support for amdgpu's KMS API.''',
)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
5 编译ges遇到“redefinition of typedef ‘GESMarkerList’”错误

错误信息如下:

../subprojects/gst-editing-services/ges/ges-marker-list.h:49: error: redefinition of typedef 'GESMarkerList'

  • 1
  • 2
注:本文转载自blog.csdn.net的2401_85125383的文章"https://blog.csdn.net/2401_85125383/article/details/141965092"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2492) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

123
硬件开发
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2025 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top