[bootlin/training-materials updates] master: yocto: lab8: add fixes required to build ctris with kirkstone (b3cb0410)

Luca Ceresoli luca.ceresoli at bootlin.com
Thu Jul 14 11:48:20 CEST 2022


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/b3cb04108f44a5484616d32eb68af4620ce3442c

>---------------------------------------------------------------

commit b3cb04108f44a5484616d32eb68af4620ce3442c
Author: Luca Ceresoli <luca.ceresoli at bootlin.com>
Date:   Tue Jul 12 23:10:43 2022 +0200

    yocto: lab8: add fixes required to build ctris with kirkstone
    
    With GCC 11 it has 2 new errors.
    
    Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>


>---------------------------------------------------------------

b3cb04108f44a5484616d32eb68af4620ce3442c
 labs/yocto-sdk/yocto-sdk.tex | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/labs/yocto-sdk/yocto-sdk.tex b/labs/yocto-sdk/yocto-sdk.tex
index 4d461633..5d08f889 100644
--- a/labs/yocto-sdk/yocto-sdk.tex
+++ b/labs/yocto-sdk/yocto-sdk.tex
@@ -63,10 +63,31 @@ cd ctris-0.42
 Then modify the Makefile, to make sure that the environment variables exported
 by the SDK script are not overridden.
 
-Compile the application. You can check the application was
-successfully compiled for the right target by using the \code{file} command.
-The \code{ctris} binary should be an ELF 32-bit LSB executable
-compiled for ARM.
+Try to compile the application. Just like nInvaders, ctris is also an old
+program and won't build with a recent toolchain. You will face these
+errors:
+
+\begin{itemize}
+  \item The ctris makefile uses the native compiler, not the cross compiler
+  provided by the SDK; while you could fix it using \code{make -e} as done
+  for nInvaders, try fixing it by editing the \code{Makefile} this time;
+  hint: you don't need to write any code, just to delete two lines
+
+  \item Building with a recent GCC will give the following error, not
+  reported by older versions:
+\begin{verbatim}
+error: format not a string literal and no format arguments [-Werror=format-security]
+\end{verbatim}
+  Fix this by adding \code{-Wno-error=format-security} to \code{CFLAGS}
+
+  \item As for nInvaders, you will see the \code{multiple definition of...}
+  error; add the \code{-fcommon} flag to \code{CFLAGS} also for ctris
+
+\end{itemize}
+
+You can check the application was successfully compiled for the right
+target by using the \code{file} command.  The \code{ctris} binary should be
+an ELF 32-bit LSB executable compiled for ARM.
 
 Finally, you can copy the binary to the board, by using the \code{scp}
 command. Then run it and play a bit to ensure it is working fine!




More information about the training-materials-updates mailing list