I have built images for IMX6 using two different yocto versions. Following are the details.
Yocto Version1:
#curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
#repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.10.53-1.1.0_ga
#repo sync
#bitbake core-image-minimal
Yocto Version2:
#curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
#repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.52-1.1.0_ga
#repo sync
#bitbake core-image-minimal
Tool chain tree structure for both versions of yocto update # http://pastebin.com/Jx7HtANR
I have compiled following sample program using both tool chains built using two different yocto versions.
#include <stdio.h>
int main(void)
{
return 0;
}
But tool chain built using yocto version 2 is giving following error.
test.c:1:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
Tool chain built using yocto version 1 is searching for header files under
"build/tmp/sysroots/imx6qsabresd/usr/include", but tool chain built using yocto version 2 is not searching for header files under "build/tmp/sysroots/imx6qsabresd/usr/include", so it is giving error.
Can you help, why tool chain built using yocto version 2 is not searching for header files under "build/tmp/sysroots/imx6qsabresd/usr/include".
Where to change the tool chain configuration in yocto to include the above mentioned search path.
In newer versions, OpenEmbedded based build systems, poisons the built in sysroot definition in the generated cross-compiler. The reason is that we'd like to detect applications that aren't respecting the the cross-compiling environment.
The solution is to not use ${CROSS_COMPILE}-gcc directly, but instead use $CC. $CC, when set by the environment setup script from the generated SDK, will add the correct sysroot argument.
Related
I am trying to update our cross compiler toolchain from crosstool to crosstool-ng. We are using an old kernel and build machine. I could install and configure crosstool-ng-1.0.0 on the server and build the toolchain.
One difference that I have noticed between the output of crosstool and crosstool-ng is that the crosstool-ng is missing some of library under output folder. For example libcrypt.a, libdl.a, libnss_dns.so, libpthread.so and so on.
I have noticed that while building with crosstool we are setting KERNELCONFIG to a specific kernel configuration file. In that configuration file we have configurations like:
CONFIG_CRYPTO=y
CONFIG_CRYPTO_HMAC=ycryp
CONFIG_CRYPTO_NULL=m
CONFIG_CRYPTO_MD4=m
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=m
CONFIG_CRYPTO_SHA512=m
CONFIG_CRYPTO_DES=y
Is this the reason that libraries like libcrypt are missing. In that case is there a way to set KERNELCONFIG in crosstool-ng for example as a build parameter?
All the libraries you mention are part of glibc, and the glibc build does not depend on the kernel configuration at all. You should check if you have enabled building glibc at all.
I have a very shallow understanding of C/C++ build systems, so this might very well be an obvious question.
I'm attempting to build the AWS IoT SDK as a static libarary as described here:
https://docs.aws.amazon.com/iot/latest/developerguide/iot-embedded-c-sdk.html
In this case I want to build the SDK as a standalone library to be linked to by an executable implemented in Rust.
When I try to build the SDK with the included makefile:
$ make -f Makefile
I get the following error:
CMake Error: The source directory "path/to/aws-iot-device-sdk-embedded-C/external_libs/CppUTest" does not appear to contain CMakeLists.txt.
The makefile in question is this one:
https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/master/Makefile
And I am attempting to build this on macOS, with this make version:
$ make --version
GNU Make 3.81
This program built for i386-apple-darwin11.3.0
I'm a bit perplexed by this error, because my assumption was that CMake should call Make, and not the other way around. What exactly is going wrong here?
My goal is to cross-compile a code file with Yocto SDK on my host machine to make it executable on my target Board. I am using SUMO Yocto version and GCC 7.3 cross compiler.
First of all, to get with YOCTO cross compiling I created a file Hello.c :
#include <stdio.h>
int main(void)
{
printf ("Hello World!\n");
return 0;
}
I compiled the file executing :
make hello
Now I have a compiled file which is ready to be executed on my target board.
But now I have multiple .h files and multiple .cpp files and a main file.
When I execute main file like this :
make main
an error occurs:
main.cpp:10:10: fatal error: boost/asio.hpp: No such file or directory
include ^~~~~~~~~~~~~~~~ compilation terminated.
: recipe for target 'main' failed make: *** [main] Error 1
I think that I have a problem with Boost and asio.hpp.
Is the boost library included in my Yocto Linux image ?
What is the problem with asio.hpp ?
How can I fix this please ?
Thanks
I just noticed that, actually, you're not using the SDK but the toolchain which only includes glibc along with some basic tools and gdb; usually used to build test apps and debug. So that, you need to build the real SDK which contains, in addition to the toolchain, the dev version (libs/headers/other files) of the packages installed in the rootfs of your image. This can be accomplished by:
bitbake -c populate_sdk <your_image>
Once the SDK is built you need to install it through the generated installer script. Also, don't forget to source the environment setup script before you start to work!
For further information refer to https://www.yoctoproject.org/docs/latest/sdk-manual/sdk-manual.html#sdk-building-an-sdk-installer
I have a CortexM0 project using a custom Makefile that builds and debugs successfully on a 1st machine.
Now trying to move the project to a second Mac.
Same version of Eclipse.
On build I get a linker error:
EclipseApr2019/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: cannot find -lg
My make file looks like this (extract):
# echo "path="$(TOOLS)
$(TOOLS)arm-none-eabi-gcc -n -v -mcpu=cortex-m0 -mthumb -g -nostartfiles -T STM32F031C6_simple.ld main.c StartUp_simple.s -o $(NAME).elf
I have tried to append the ARM gcc tools directory to the PATH variable in the Project, but no luck.
I would add a -l option to the link stage in the makefile, but do not know why this library is being pulled in or where it is. My code only does a series of shifts and reads/writes to registers on an MCU. The build on the 1st machine worked fine without specifying a library location like this.
Given I have custom makefile and am not generating Makefile automatically, there are no tool settings (and Library search path) available under Properties/CC++Build/Settings.
What is library "g" that the linker is pulling in?
Where is it?
Under Eclipse, how can I point the linker to the library?
Why didn't I need to do that before?
What is some general advice for designing an Eclipse project with a custom makefile to make it most portable between machines?
Thank you.
Eclipse IDE for C/C++ Developers
Version: 2019-03 (4.11.0)
Question: How to add the standard library to arm-fslc-linux-gnueabi-gcc
Background:
I just had bitbake compile the meta-toolchain in the Yocto project.
I then installed the resulting SDK-toolchain
$
./build/tmp/deploy/sdk/fslc-framebuffer-glibc-x86_64-meta-toolchain-armv7at2hf-neon-toolchain-2.4.2.sh
which then installed the SDK-toolchain in /opt/fslc-framebuffer/2.4.2/
I can then easily run the executable to source the correct environment variables.
$
./opt/fslc-framebuffer/2.4.2/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi
I now have access to the cross-compiler arm-fslc-linux-gnueabi-gcc
So far so good...
I then downloaded the barebone SDK from NXP here.
It's a great piece of work, but it might be somewhat outdated. First unzip the file, and then follow steps within the SDK readme.pdf.
Following the readme.pdf i do the following: To build the SDK, use the ./tools/build_sdk command from the root folder. I get multiple error but they are all related to the standard library such as:
iMX6_Platform_SDK/sdk/drivers/accelerometer/src/mma8451.c:31:10: fatal error: string.h: No such file or directory #include <string.h>
iMX6_Platform_SDK/sdk/include/sdk.h:40:10: fatal error: stdio.h: No such file or directory #include <stdio.h>
So how do I solve this? Do I cross compile the standard library or do I get the binary some other place?
SDK build by yocto is little bit different than normal arm toolchain.
I believe you used
arm-fslc-linux-gnueabi-gcc hello.c
but actually you need to use Makefiles or Macros like below,
${CC} hello.c -o hello
Write this directly into your terminal or put it into a makefile.