简体   繁体   English

交叉编译 Valgrind 并将其部署到嵌入式 Linux 设备

[英]Cross compiling and deploying Valgrind to an embedded linux device

I am trying to cross compile Valgrind on my Fedora VM in order to get it to run on a custom embedded Linux device (running Yacto with a Kinetis KL2x MCU w/ ARM Cortex M4 CPU).我试图在我的 Fedora VM 上交叉编译 Valgrind,以便让它在定制的嵌入式 Linux 设备上运行(运行 Yacto 和 Kinetis KL2x MCU w/ARM Cortex M4 CPU)。 I have a QT IDE properly configured to cross compile and deploy QT projects to the device.我有一个正确配置的 QT IDE,可以交叉编译 QT 项目并将其部署到设备。 I was wondering what the best route to cross compile a non QT application.我想知道交叉编译非 QT 应用程序的最佳途径是什么。 I tried making a new project (in QT>New Project>Import Project>Import Existing Project) using an existing project (Valgrind source code @ http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 ) and i keep getting this error:我尝试使用现有项目(Valgrind 源代码 @ http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 )制作一个新项目(在 QT>New Project>Import Project>Import Existing Project)和我不断收到此错误:

17:20:46: Running steps for project valgrind...
17:20:46: Starting: "/usr/bin/make" all
make: *** No rule to make target `all'.  Stop.
17:20:46: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project valgrind (kit: ----)
When executing step "Make"
17:20:46: Elapsed time: 00:00.

and I am not sure how to address it.我不知道如何解决它。 Is it possible to compile Valgrind just using the cross compiler itself (arm-poky-linux-gnueabi-g++)?是否可以仅使用交叉编译器本身(arm-poky-linux-gnueabi-g++)来编译 Valgrind? Am I better off changing the makefile to use the cross compiler instead of gcc and then use scp to send the file to my device(if so which of the many different makefiles do i use?)?我最好将 makefile 更改为使用交叉编译器而不是 gcc,然后使用 scp 将文件发送到我的设备(如果是这样,我使用许多不同的 makefile 中的哪一个?)? Or is there a better way that I am missing?或者有没有更好的方法让我失踪? The system doesn't have any package management tools or compilers of its own.该系统没有任何包管理工具或它自己的编译器。 Any help/ input will be GREATLY appreciated.任何帮助/输入将不胜感激。

Errors while building recipe after cross compile environment setup:交叉编译环境设置后构建配方时出错:

[----@localhost valgrind]$ source /opt/poky/default/environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi 
[----@localhost valgrind]$ bitbake -c build valgrind_3.12.0.bb 
Traceback (most recent call last):
  File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 553, in <module>
    main()
  File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 535, in main
    known_paths = addusersitepackages(known_paths)
  File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 230, in getuserbase
    from sysconfig import get_config_var
  File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/sysconfig.py", line 10, in <module>
    'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
AttributeError: 'module' object has no attribute 'lib'

An example of cross compiling valgrind with Yocto toolchain would be :使用 Yocto 工具链交叉编译valgrind的示例是:

# setup workspace
mkdir workspace && cd workspace

# download Yocto sdk
wget http://gumstix-yocto.s3.amazonaws.com/sdk.sh

#Install it to workspace/sdk
./sdk.sh

source sdk/environment-setup-cortexa8hf-neon-poky-linux-gnueabi

# download valgrind tarball
wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2

# extract source
tar jxf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0

# this fix issue with unknown arm architecture (see http://stackoverflow.com/questions/29514706/cross-compiling-valgrind-for-arm)
sed -i -e "s#armv7#arm#g" configure

./configure --host=arm-poky-linux-gnueabi --prefix="$(pwd)/out"

make -j16

make install

Here, the installation directory is out , you can also install to ${SDKTARGETSYSROOT}/usr with --prefix="${SDKTARGETSYSROOT}/usr"到这里,安装目录out ,你也可以用--prefix="${SDKTARGETSYSROOT}/usr"安装到${SDKTARGETSYSROOT}/usr

Check this link for the basic example of cross compile with Yocto SDK检查此链接以获取使用 Yocto SDK 进行交叉编译的基本示例

i think the easiest way is to build it in your yocto build environment (source poky/oe_init_build_env) and the build valgrind with我认为最简单的方法是在您的 yocto 构建环境中构建它(源 poky/oe_init_build_env)和构建 valgrind

bitbake -c build valgrind

then look in the build folder tmp/work/"plattform"/valgrind/"version"/image/ for the files然后在构建文件夹tmp/work/"plattform"/valgrind/"version"/image/查找文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM