[bootlin/training-materials updates] master: yocto: lab3: add explanation to solve "multiple definition of" with GCC 10 (58ae1c78)

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


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

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

commit 58ae1c78c1f590dc1454c79e307d95f36d9ae3d1
Author: Luca Ceresoli <luca.ceresoli at bootlin.com>
Date:   Tue Jul 12 09:47:57 2022 +0200

    yocto: lab3: add explanation to solve "multiple definition of" with GCC 10
    
    This started appearing after upgrading to yocto kirkstone.
    
    Suggested-by: Théo Lebrun <theo.lebrun at bootlin.com>
    Suggested-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
    Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>


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

58ae1c78c1f590dc1454c79e307d95f36d9ae3d1
 labs/yocto-add-application/yocto-add-application.tex | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/labs/yocto-add-application/yocto-add-application.tex b/labs/yocto-add-application/yocto-add-application.tex
index 038fa16c..ee35e72b 100644
--- a/labs/yocto-add-application/yocto-add-application.tex
+++ b/labs/yocto-add-application/yocto-add-application.tex
@@ -69,6 +69,23 @@ If you hang on a problem, check the following points:
      \code{bitbake -c cleanall ninvaders}
 \end{itemize}
 
+One of the build failures you will face will generate many messages such as
+\code{multiple definition of `skill_level'; aliens.o:(.bss+0x674):
+  first defined here}.
+
+The \code{multiple definition} issue is due to the code base of {\em
+nInvaders} being quite old, and having multiple compilation units
+redefine the same symbols. While this was accepted by older {\em gcc}
+versions, since {\em gcc 10} this is no longer accepted by default.
+
+While we could fix the {\em nInvaders} code base, we will take a
+different route: ask {\em gcc} to behave as it did before {\em gcc 10}
+and accept such redefinitions. This can be done by passing the
+\code{-fcommon} {\em gcc} flag.
+
+To achieve this, make sure to add \code{-fcommon} to the \code{CFLAGS}
+variable.
+
 Tip: BitBake has command line flags to increase its verbosity and activate debug
 outputs. Also, remember that you need to cross-compile nInvaders for ARM! Maybe,
 you will have to configure your recipe to resolve some mistakes done in the




More information about the training-materials-updates mailing list