配置完后执行编译安装命令。
make
make install
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
配置完后执行编译安装命令。
make
make install
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
执行make install的时候遇到了如下错误:
./libtool: line 1719: arm-none-linux-gnueabi-ranlib: command not found
Makefile:5118: recipe for target 'install-usrlib\_execLTLIBRARIES' failed
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
出现错误的原因可以参考这篇文章make install时"arm-linux-ranlib command not found",参照里面的方案切换成root用户执行install:
sudo su
make install
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
install完成后记得不要忘了切换回原来的用户。
su usename
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
然后执行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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
终于编译除了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.
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
之前编译的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'
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
class="hide-preCode-box">
更新pkgconfig就可以meson配置时就可以检测到该lib了,会出现以下log。
Run-time dependency mount found: YES 2.32.1
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
meson 配置gst-omx时会出现以下错误:
subprojects/gst-omx/meson.build:220:2: ERROR: Problem encountered: Unsupported omx target specified. Use the -Dtarget option
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
原因option 中target参数没有指定的原因,所以通过-D参数修改subprojects/gst-omx目录下meson_option.txt中target选项。
meson build --cross-file cross_file.txt -D gst-omx:target=rpi
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
不出意外的话这次会配置成功,会出现以下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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
class="hide-preCode-box">
配置成功后可以执行编译命令:
ninja -C build
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
编译的过程中遇到了不少问题,逐一记录解决方案。
编译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'
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
解决方案可以参考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)
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
错误信息如下:
../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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
出现错误的原因是gcc是基于c89标准的,而C89标准不支持循环语句如下这样定义:
for(int i=0; i
必须要写成下面这样:
int i;
for(i=0;i
卧底个乖乖,难道要逐一改用到for循环的源码吗,那岂不是要人命!当然不是,编译的时候可以通过添加参数换成gnu99标准就可以了,编译单个文件可以这样写:
gcc src.c -std=gnu99 -o src
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
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'
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
class="hide-preCode-box">
错误信息入下:
../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.)
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
原因是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'
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
class="hide-preCode-box">
cross_file.txt来来回回改了三次,因为是记录过程,所以没有一次性写清楚。
错误信息如下:
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
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
查看错误信息是在编译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.''',
)
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
错误信息如下:
../subprojects/gst-editing-services/ges/ges-marker-list.h:49: error: redefinition of typedef 'GESMarkerList'
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
评论记录:
回复评论: