The default rules provided by make do include $(LDFLAGS). This is the default rule provided by make to link a binary from a .c file:

 

%: %.c

#  recipe to execute (built-in):

        $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@

 

where LINK.c is defined as:

 

LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)

 

(you can see the default rules by running make -p anywhere where there isn’t a Makefile).

 

I have now also applied the patch for the rtc-tools recipe. I then removed the TARGET_CC_ARCH line from it and built it without problems.

 

@Fabio: Are you sure you built with the correct version of the recipe and Makefile when you got the error about GNU_HASH? Because it should work (and I’ve verified that the files I built have the GNU_HASH and I never built with the TARGET_CC_ARCH line in the recipe).

 

//Peter

 

From: Khem Raj <raj.khem@gmail.com>
Sent: den 28 januari 2022 16:33
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>; Peter Kjellerstedt <peter.kjellerstedt@axis.com>; alexandre.belloni@bootlin.com; hs@denx.de; openembedded-devel@lists.openembedded.org; otavio.salvador@ossystems.com.br
Subject: Re: [oe] [PATCH v3 meta-oe] rtc-tools: Add a recipe

 

 

 

On Fri, Jan 28, 2022 at 2:28 AM Fabio Estevam <festevam@gmail.com> wrote:

Hi Peter,

On Fri, Jan 28, 2022 at 1:48 AM Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:

> > +TARGET_CC_ARCH += "${LDFLAGS}"
>
> You forgot to remove the TAGET_CC_ARCH line.

If I remove this line, the following error happens:

ERROR: rtc-tools-1.0.0-r0 do_package_qa: QA Issue: File
/usr/bin/rtc-sync in package rtc-tools doesn't have GNU_HASH (didn't pass LDFLAGS?)
File /usr/bin/rtc in package rtc-tools doesn't have GNU_HASH (didn't pass LDFLAGS?)
File /usr/bin/rtc-range in package rtc-tools doesn't have GNU_HASH (didn't pass LDFLAGS?)
[ldflags]
ERROR: rtc-tools-1.0.0-r0 do_package_qa: QA run found fatal errors.
Please consider fixing them.

Any suggestions as to how this should be fixed?

 

I already suggested in earlier email to add LDFLAGS in makefile rules 



Thanks