Cross compiling and deploying Valgrind to an embedded linux device - qt

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). I have a QT IDE properly configured to cross compile and deploy QT projects to the device. I was wondering what the best route to cross compile a non QT application. 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:
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++)? 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?)? 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 :
# 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"
Check this link for the basic example of cross compile with 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
bitbake -c build valgrind
then look in the build folder tmp/work/"plattform"/valgrind/"version"/image/ for the files

Related

PlatformIO unable to resolve Keyboard / HID / PluggableUSB dependency?

My development environment consists of a Teensy 3.5, PlatformIO, and CLion. How can I make use of the standard Arduino Keyboard library?
I'm working on a project to convert a previously RS422-based device to USB. Earlier on, I used the (sadly rather horrible) Arduino IDE so I know that my code for when to send which keystrokes should work; the problem is getting the new IDE and compiler to understand the dependencies.
All along, I've been using the Serial interface to provide debug output, so I know that Serial works just fine. Ditto for using the Keyboard library from within the Arduino IDE.
However, after switching to CLion and adapting to the PlatformIO framework, I ran into problems when it came time to include the Keyboard library.
The line
#include <Arduino.h>
resolves to the file ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/Arduino.h which itself seems to simply be a shim for ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/WProgram.h which implements the expected Arduino functionality.
However, the line
#include <Keyboard.h>
resolves to the file ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/Keyboard.h which quite frankly states that it is an empty Keyboard.h file, for compability with Arduino's Keyboard examples and does not implement anything.
I have been trying to find ways of importing the original Arduino library (by way of platformio.ini, but it seems to depend on HID and PluggableUSB that I simply cannot find.
Here is my current platformio.ini file:
[env:teensy35]
platform = teensy
board = teensy35
framework = arduino
; Avoid the Teensy loader gui app
upload_protocol = teensy-cli
lib_deps =
Keyboard
and this is the build output I am getting:
====================[ Build | Production | teensy35 ]===========================
~/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/223.8617.54/bin/cmake/linux/x64/bin/cmake --build ~/code/teensy-axial/cmake-build-teensy35 --target Production -j 6
[1/1] cd ~/code/teensy-axial && platformio -c clion run -eteensy35
FAILED: CMakeFiles/Production ~/code/teensy-axial/cmake-build-teensy35/CMakeFiles/Production
cd ~/code/teensy-axial && platformio -c clion run -eteensy35
Processing teensy35 (platform: teensy; board: teensy35; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy35.html
PLATFORM: Teensy (4.17.0) > Teensy 3.5
HARDWARE: MK64FX512 120MHz, 255.99KB RAM, 512KB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy # 1.157.220801 (1.57)
- toolchain-gccarmnoneeabi # 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> [redacted for StackExchange]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 94 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Keyboard # 1.0.4
Building in release mode
Compiling .pio/build/teensy35/src/AxialKeyboard.cpp.o
Compiling .pio/build/teensy35/src/main.cpp.o
Compiling .pio/build/teensy35/lib882/Keyboard/Keyboard.cpp.o
Compiling .pio/build/teensy35/lib882/Keyboard/KeyboardLayout_da_DK.cpp.o
Compiling .pio/build/teensy35/lib882/Keyboard/KeyboardLayout_de_DE.cpp.o
In file included from .pio/libdeps/teensy35/Keyboard/src/Keyboard.cpp:22:0:
.pio/libdeps/teensy35/Keyboard/src/Keyboard.h:25:17: fatal error: HID.h: No such file or directory
*************************************************************
* Looking for HID.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:HID.h"
* Web > https://registry.platformio.org/search?q=header:HID.h
*
*************************************************************
compilation terminated.
[...]
I have obviously visited the registry as suggested and tried to implement both mitchman631/HID and levi--g/USBLibrarySTM32 but still I end up missing either HID or PluggableUSB dependencies, and I cannot find a PluggableUSB.h file anywhere. Surely, there must be something fundamental I am not seeing?
Amending platformio.ini with the path to the Arduino libraries did not resolve the error.
lib_extra_dirs =
/usr/share/arduino/libraries
so I removed these lines again.
I have also tried enabling the --verbose option by copying the command from the above output:
~/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/223.8617.54/bin/cmake/linux/x64/bin/cmake --verbose --build ~/code/teensy-axial/cmake-build-teensy35
but oddly that results in
CMake Error: Unknown argument --build
even though it should know it:
~/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/223.8617.54/bin/cmake/linux/x64/bin/cmake --help | grep build
cmake [options] <path-to-existing-build>
cmake [options] -S <path-to-source> -B <path-to-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
-B <path-to-build> = Explicitly specify a build directory.
-G <generator-name> = Specify a build system generator.
--build <dir> = Build a CMake-generated project binary tree.
I suspect my question is similar to this one, although my problem is with adding any library.

JOM files not being generated

I'm porting a qt project that compiles on a MacOS to Windows. I've managed to more or less fix all of the compiler errors, but I'm now met with this:
18 warnings generated.
/OUT:debug\editor.exe #C:\Users\User\AppData\Local\Temp\editor.exe.10472.84781.jom
The system cannot find the path specified.
jom: C:\Source\build-project-qt-Desktop_Qt_5_12_9_MSVC2017_64bit-Debug\src\Makefile.Debug [debug\editor.exe] Error 1
jom: C:\Source\build-project-qt-Desktop_Qt_5_12_9_MSVC2017_64bit-Debug\src\Makefile [debug] Error 2
jom: C:\Source\build-project-qt-Desktop_Qt_5_12_9_MSVC2017_64bit-Debug\Makefile [sub-src-make_first] Error 2
02:32:53: The process "C:\Users\User\msvc_make.bat" exited with code 2.
Error while building/deploying project project (kit: Desktop Qt 5.12.9 MSVC2017 64bit)
When executing step "Make"
I've been looking for hours and I have no idea why this isn't being generated. I would very much like to not disable JOM if I don't have to (not that I haven't tried, setting CMake generator in the kit to NMake Makefiles with Codeblock instead of NMake Makefiles JOM with Codeblocks just gives me the same error).
EDIT: This is the part of the Makefile.debug file which seems to invoke the editor.exe:
####### Build rules
first: all
all: Makefile.Debug debug\editor.exe
debug\editor.exe: C:\Source\build-project-Desktop_Qt_5_12_9_MSVC2017_64bit-Debug\src\..\lib\cocos2d\debug\cocos2d.lib C:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\Qt5OpenGLd.lib C:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\Qt5Widgetsd.lib C:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\Qt5Guid.lib C:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\Qt5Xmld.lib C:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\Qt5Cored.lib C:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\qtmaind.lib ui_mainwindow.h ui_setprojectpathdialog.h $(OBJECTS)
$(LIBAPP) $(LIBFLAGS) /OUT:$(DESTDIR_TARGET) #<<
[here is a list of paths to a bunch of obj files in a debug folder]
<<
Here are the variables I was able to find:
DESTDIR = debug\ #avoid trailing-slash linebreak
TARGET = editor.exe
DESTDIR_TARGET = debug\editor.exe
OBJECTS is a list of obj files in the debug folder.
It would seem that LIBAPP is indeed unset. Why that is the case, I don't know. It's dependency, using the same kit and compiler has it set just fine.
Solution I employed is to just set LIBAPP to, in my case, llvm-lib /NOLOGO.
I absolutely hate everything about this.

pcl/pcl_config.h: No such file or directory

My environment is below.
・Operating System and version:windows 10 64bit
・Compiler:C:\msys64\mingw64\bin\g++.exe
・PCL Version:1.9.1
pcl_config.h not found as below error occurred when compiled under above env..
Certainly this header file is not included.
Let me know how to solve it.
PS C:\pcl\pcl\examples\common> g++ -o minmax -I ../../io/include -I ../../common/include .\example_get_max_min_coordinates.cpp
In file included from ../../common/include/pcl/PCLHeader.h:10,
from ../../common/include/pcl/point_cloud.h:47,
from ../../io/include/pcl/io/pcd_io.h:42,
from .\example_get_max_min_coordinates.cpp:2:
../../common/include/pcl/pcl_macros.h:64:10: fatal error: pcl/pcl_config.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~
compilation terminated.
Short answer
pcl_config.h is generated via pcl_config.h.in by the cmake tool. So it seems that compilation did not finish correctly.
Longer answer
Please make sure you have compiled the relevant modules of PCL (at least pcl-core) before proceeding
You might prefer a pre-built installation from releases or distributed by a package/source manager of your choice
PCL makes heavy use of other libraries and it is best to supply the dependencies (as mentioned below) via CMake or manually via the -I and -l options. If you provide the location of pcl_config.h, the compiler will complain about Eigen next.
The build instructions are available here. TL;DR: After satisfying the dependencies (cmake, c++ compiler, boost, eigen, flann, vtk and other depending on use-case), run the following commands
cd $PCL_SOURCE_DIR
mkdir -p build; cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j8
Feel free to use any build generator (like Ninja) or change build type to Debug or RelWithDebInfo as per your needs.

UNIX: ./configure is not generating Makefile

I'm trying to install the Apache web server from source code to a Fedora 14 VM. I've run ./configure multiple times already, and can see Makefile.in and .win but no 'Makefile'. When I run the 'make' command, I get the following error:
make: *** No targets specified and no makefile found. Stop.
Can someone please tell me what's keeping it from generating a Makefile?

compiling qt 4.7.3 on mingw32 with gcc 4.6.0

I am trying to compile Qt 4.7.3 on mignw32 using gcc 4.6.0.
I get the following error when running ./configure:
In file included from C:/work/qt-gcc-4.6.0/include/QtCore/private/qcore_unix_p.h:1:0,
from C:/work/qt-gcc-4.6.0/src/corelib/io/qfsfileengine_unix.cpp:45:
C:/work/qt-gcc-4.6.0/include/QtCore/private/../../../src/corelib/kernel/qcore_unix_p.h:59:3: error: #error "qcore_unix_p.h included on a non-Unix system"
The weird thing is that I am running Windows 7, and it is trying to include that.
Also in the Makefile it is using qfsfileengine_unix and qfsfileengine_iterator_unix instead of qfsfileengine_win and qfsfileengine_iterator_win.
If I change the Makefile to use the Windows' ones, I get the following error (the file does not exist):
In file included from C:/work/qt-gcc-4.6.0/include/QtCore/../../src/corelib/global/qglobal.h:62:0,
from C:/work/qt-gcc-4.6.0/include/QtCore/qglobal.h:1,
from C:/work/qt-gcc-4.6.0/mkspecs/win32-g++/qplatformdefs.h:53,
from C:/work/qt-gcc-4.6.0/src/corelib/io/qfsfileengine_win.cpp:43:
C:/work/qt-gcc-4.6.0/include/QtCore/qconfig.h:1:46: fatal error: ../../src/corelib/global/qconfig.h: No such file or directory
compilation terminated.
When compiling /qt/src/corelib/io/qfsfileengine_win.cpp
Suggestions?
Try ./configure --help
There is probably a flag for a ms-windows, x86 compilation.
It might be something like:
./configure --target-os=mingw32
Keep in mind -- the os parameter name might be different, and the selectable target values *might be different* -- with scripts from different authors -- some values you might encounter might be 'win32', 'win32-386', 'x86-windows32', etc.
See if
./configure --help
Won't give you a list...
You can also redirect its output to a file for easy reading in your favorite editor,
./configure --help > myconfighelp.txt
Good luck!

Resources