[英]cross compiling gstreamer fails: x86-64 -> ARMv6 32-bit
I am trying to build a project on an x86_64 (linux)system for an RPi 1. I have a working tool chain - I have built a small program and run it on the RPi ("Hello World"). 我正在尝试在x86_64(linux)系统上为RPi 1构建一个项目。我有一个工作工具链 - 我已经构建了一个小程序并在RPi上运行它(“Hello World”)。
The project that I am trying to build is gstreamer . 我正在尝试构建的项目是gstreamer 。
In the configure script , I added the appropriate --host= , and it finds all of the right tools and successfully completes. 在configure脚本中 ,我添加了相应的--host = ,它找到了所有正确的工具并成功完成。 But then, when I make the project, I get the following errors:
但是,当我制作项目时,我收到以下错误:
In file included from gsttracerutils.h:30:0,
from gst_private.h:68,
from gst.c:96:
../gst/gstutils.h: In function '__gst_slow_read64_be':
../gst/gstutils.h:111:61: error: left shift count >= width of type [-Werror=shift-count-overflow]
(((guint##__size) (((const guint8 *) (__data))[__idx])) << (__shift))
^
../gst/gstutils.h:164:36: note: in expansion of macro '_GST_GET'
#define _GST_READ_UINT64_BE(data) (_GST_GET (data, 0, 64, 56) | \
^
../gst/gstutils.h:184:10: note: in expansion of macro '_GST_READ_UINT64_BE'
return _GST_READ_UINT64_BE (data);
^
It seems (at least to me) like the compiler complaining about a 64bit type on a 32 bit cpu (which is right). 似乎(至少对我而言)编译器抱怨32位cpu上的64位类型(这是正确的)。
Is this a problem with the toolchain compiler? 这是工具链编译器的问题吗? Or something else?
或者是其他东西?
I originally built (successfully) gstreamer on the rpi itself. 我最初在rpi本身上建立了(成功)gstreamer。 But since that took a very long time, and I need to be able to re-make the app, I wanted to build it on a fast system.
但由于这需要很长时间,而且我需要能够重新制作应用程序,我想在快速系统上构建它。
For clarification: The build toolchain I am using is crosstool-ng . 为了澄清:我使用的构建工具链是crosstool-ng 。 I ran the configure command as:
我运行configure命令:
./configure --disable-gtk-doc --disable-examples --disable-benchmarks --disable-gtk-doc-html --host=armv6-rpi-linux-gnueabihf
and from the configure log (config.log): 从配置日志(config.log):
## ----------- ##
## Core tests. ##
## ----------- ##
configure:3217: checking build system type
configure:3231: result: x86_64-unknown-linux-gnu
configure:3251: checking host system type
configure:3264: result: armv6-rpi-linux-gnueabihf
configure:3284: checking target system type
configure:3297: result: armv6-rpi-linux-gnueabihf
configure:3343: checking for a BSD-compatible install
configure:3411: result: /usr/bin/install -c
configure:3422: checking whether build environment is sane
configure:3477: result: yes
configure:3536: checking for armv6-rpi-linux-gnueabihf-strip
configure:3552: found /nas/temp/build/rpi/tc/x-tools/armv6-rpi-linux-gnueabihf/bin/armv6-rpi-linux-gnueabihf-strip
configure:3563: result: armv6-rpi-linux-gnueabihf-strip
this shows the build system is x86_64, the host and the target are armv6(...). 这表明构建系统是x86_64,主机和目标是armv6(...)。
The errors, as shown above, relate to macros that deal with 64 bit data. 如上所示,错误与处理64位数据的宏有关。
I can take this identical project tree, run autogen.sh,configure.sh, and make on the rpi-1 itself (using the pignus version of gcc tools - pignus is a fedora 23 spin specifically for the rpi-1), and it completely builds successfully. 我可以使用这个相同的项目树,运行autogen.sh,configure.sh,并在rpi-1本身上制作(使用gign工具的pignus版本 - pignus是一个专门用于rpi-1的fedora 23旋转),它完全建立成功。 I also built this project on, and for, the x86_64 system, which was also successful.
我还在x86_64系统上构建了这个项目,该系统也很成功。
And, as mentioned at the beginning, I have built a simple program using the same toolchain - the "Hello World" program - and it compiled and linked successfully on the x86_64 system, and then ran successfully on the rpi. 并且,正如开头所提到的,我使用相同的工具链 - “Hello World”程序构建了一个简单的程序 - 它在x86_64系统上成功编译和链接,然后在rpi上成功运行。
So, again, my question is: could this be a problem/bug with the cross compiler toolchain, or perhaps something in the project source? 所以,我的问题是:这可能是交叉编译工具链的问题/错误,或者可能是项目源中的某些内容? Any suggestions on where to look, or what to try?
关于在哪里寻找或尝试什么的任何建议?
TIA TIA
ken 肯
From unpicking those macros , what the compiler is specifically complaining about is that shifting a value of type guint64
left by 56 bits overflows the type, and is thus undefined. 从取消激活这些宏开始 ,编译器特别抱怨的是将
guint64
类型的值移位56位溢出该类型,因此未定义。
Now, what that says to me is that you're picking up your host machine's glibconfig.h, where guint64
must be a typedef of unsigned long
, ie a 64 bit type on that machine, but 32 bits once you feed it into the 32-bit ARM compiler. 现在,对我说的是你正在拿起主机的 glibconfig.h,其中
guint64
必须是unsigned long
的typedef,即该机器上的64位类型,但是一旦你将它输入32位就是32位位ARM编译器。 On the Pi itself you probably have an appropriately-configured glibconfig.h where guint64
is a typedef of unsigned long long
instead, hence building natively works. 在Pi本身你可能有一个适当配置的glibconfig.h,其中
guint64
是unsigned long long
的typedef,因此构建本身就可以工作。
You need to point the build at the Pi's GLib headers and libraries rather than the host machine's (this compilation error is almost certainly just delaying an ultimate failure to link when the cross-linker finds x86 libraries and rejects them). 你需要将构建指向Pi的GLib头和库而不是主机(这种编译错误几乎肯定只是在交叉链接找到x86库并拒绝它们时延迟链接的最终失败)。 I've no experience with GStreamer myself, so I can't say exactly how to do that, but according to this mailing list post I found, the correct approach would seem to involve overriding PKG_CONFIG_PATH.
我自己没有GStreamer的经验,所以我不能确切地说如何做到这一点,但根据我发现的这个邮件列表帖子 ,正确的方法似乎涉及覆盖PKG_CONFIG_PATH。
The problem I am having is exactly that - get the cross compiler to see the target environment and not the build's.
我遇到的问题就是 - 让交叉编译器看到目标环境而不是构建。
Mounting the Rpi in a subdirectory is also something I'm working on past days, I found a description for an OsX-host, but as I only have Windows-computers I made some workarounds to get the RPi1 booting on an NFS-share of a Trusty-virtual machine instead of the SD-card: https://github.com/rmast/rpi-build-and-boot 将Rpi挂载到一个子目录中也是我过去几天工作的东西,我找到了一个OsX主机的描述,但由于我只有Windows计算机,我做了一些解决方法让RPi1在NFS-share上启动一个Trusty虚拟机而不是SD卡: https : //github.com/rmast/rpi-build-and-boot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.