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

时间:2017-03-21 18:49:37

标签: qt makefile compiler-errors cross-compiling valgrind

我试图在我的Fedora VM上交叉编译Valgrind,以使其在自定义嵌入式Linux设备上运行(使用带有ARM Cortex M4 CPU的Kinetis KL2x MCU运行Yacto)。我有一个正确配置的QT IDE来交叉编译和部署QT项目到设备。我想知道跨越编译非QT应用程序的最佳途径是什么。我尝试使用现有项目(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.

我不确定如何解决它。是否可以使用交叉编译器本身编译Valgrind(arm-poky-linux-gnueabi-g ++)?我最好更改makefile以使用交叉编译器而不是gcc然后使用scp将文件发送到我的设备(如果是这样,我使用了多个不同的makefile?)?还是有更好的方法让我失踪?系统没有任何自己的包管理工具或编译器。任何帮助/意见都将非常感激。

交叉编译环境设置后构建配方时出错:

[----@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'

2 个答案:

答案 0 :(得分:2)

使用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

此处,安装目录为out,您也可以使用${SDKTARGETSYSROOT}/usr安装到--prefix="${SDKTARGETSYSROOT}/usr"

使用Yocto SDK检查this link交叉编译的基本示例

答案 1 :(得分:1)

我认为最简单的方法是在你的yocto构建环境中构建它 (source poky / oe_init_build_env) 并使用

构建valgrind

bitbake -c build valgrind

然后查看构建文件夹tmp / work /&#34; plattform&#34; / valgrind /&#34; version&#34; / image / for files