Skip to contentSkip to conversation

common-tasks.rst: Fix GNU_HASH in hello.bb

PATCH Superseded Leon Anavi 3 participants 6 messages Jan 11, 2021 – Jan 12, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Leon Anavi

author
#0 lore raw

PATCH 1/1 common-tasks.rst: Fix GNU_HASH in hello.bb

Add TARGET_CC_ARCH += "${LDFLAGS}" to the "Single .c File Package (Hello World!)" example to fix the following GNU_HASH issue, following the recommendations from section "Default Linker Hash Style Changed":

ERROR: hello-1.0-r0 do_package_qa: QA Issue: File /usr/bin/helloworld in package hello doesn't have GNU_HASH (didn't pass LDFLAGS?) [ldflags]

---
 documentation/dev-manual/common-tasks.rst               | 2 ++
 documentation/ref-manual/examples/hello-single/hello.bb | 2 ++
 2 files changed, 4 insertions(+)
documentation/dev-manual/common-tasks.rst +2 -0
index e1dee8ecd..b816536d9 100644
@@ -2297,6 +2297,8 @@ directory BitBake uses for the build.
 
    S = "${WORKDIR}"
 
+   TARGET_CC_ARCH += "${LDFLAGS}"
+
    do_compile() {
        ${CC} helloworld.c -o helloworld
    }
documentation/ref-manual/examples/hello-single/hello.bb +2 -0
index 0812743e3..1a2896769 100644
@@ -7,6 +7,8 @@ SRC_URI = "file://helloworld.c"
 
 S = "${WORKDIR}"
 
+TARGET_CC_ARCH += "${LDFLAGS}"
+
 do_compile() {
 	${CC} helloworld.c -o helloworld
 }
Signature · 1 line
2.17.1
#1 lore raw

Hi Leon,

Quoted 19 lines · Leon Anavi

Add TARGET_CC_ARCH += "${LDFLAGS}" to the "Single .c File Package (Hello World!)" example to fix the following GNU_HASH issue, following the recommendations from section "Default Linker Hash Style Changed":

ERROR: hello-1.0-r0 do_package_qa: QA Issue: File /usr/bin/helloworld in package hello doesn't have GNU_HASH (didn't pass LDFLAGS?) [ldflags]

---
 documentation/dev-manual/common-tasks.rst               | 2 ++
 documentation/ref-manual/examples/hello-single/hello.bb | 2 ++
 2 files changed, 4 insertions(+)
documentation/dev-manual/common-tasks.rst +0 -0
index e1dee8ecd..b816536d9 100644

documentation/dev-manual/common-tasks.rst directory BitBake uses for the build. · line 2304

Quoted 8 lines
documentation/dev-manual/common-tasks.rst +2 -0
@@ -2297,6 +2297,8 @@ directory BitBake uses for the build.
 
    S = "${WORKDIR}"
 
+   TARGET_CC_ARCH += "${LDFLAGS}"
+
    do_compile() {
        ${CC} helloworld.c -o helloworld
    }

Shouldn't it just be:

do_compile() {
- ${CC} helloworld.c -o helloworld
+ ${CC} ${LDFLAGS} helloworld.c -o helloworld
}

instead?

Might even want to pass CFLAGS to the line too.

Cheers,
Quentin

author
#2 lore raw

Hi Quentin,

Quoted 3 lines · Quentin Schulz

instead?

Might even want to pass CFLAGS to the line too.

I've just followed the exact recommendation for resolving this particular issue in Yocto Project Manual as it is described in "24.10.8. Default Linker Hash Style Changed".

At the end of the day it is just a simple hello world example and there are different ways to fix it. According to me it will be a nice bonus to apply in it the knowledge from chapter 24.10.8.

Best regards,
Leon

Signature · 3 lines
Leon Anavi
Software Engineer
konsulko.com
#3 lore raw
Quoted 5 lines · Leon Anavi

Hi Quentin,

Quoted 2 lines · Quentin Schulz

instead?

Quoted 8 lines
Quoted 1 line

Might even want to pass CFLAGS to the line too.

I've just followed the exact recommendation for resolving this particular issue in Yocto Project Manual as it is described in "24.10.8. Default Linker Hash Style Changed".

At the end of the day it is just a simple hello world example and there are different ways to fix it. According to me it will be a nice bonus to apply in it the knowledge from chapter 24.10.8.

Adding LDFLAGS is definltey the better way to fix this, we should be encouraging people to use LDFLAGS in makefiles and scripts.

I suspect 24.10.8 might be better saying that LDFLAGS is the preferred fix, failing that the CC tweak is a second option.

Cheers,

Richard

author
#4 lore raw

Hi Richard,

Quoted 2 lines · Richard Purdie

Adding LDFLAGS is definltey the better way to fix this, we should be encouraging people to use LDFLAGS in makefiles and scripts.

OK, regarding these circumstances I will update accordingly my patch and submit it again.

Quoted 3 lines

I suspect 24.10.8 might be better saying that LDFLAGS is the preferred fix, failing that the CC tweak is a second option.

OK, sounds good. Should I try editing the text and submit a patch for this too?

Best regards,
Leon

Signature · 3 lines
Leon Anavi
Software Engineer
konsulko.com
#5 lore raw
Quoted 7 lines · Leon Anavi

Hi Richard,

Quoted 2 lines · Richard Purdie

Adding LDFLAGS is definltey the better way to fix this, we should be encouraging people to use LDFLAGS in makefiles and scripts.

OK, regarding these circumstances I will update accordingly my patch and submit it again.

Sounds good thanks.

Quoted 4 lines
Quoted 2 lines

I suspect 24.10.8 might be better saying that LDFLAGS is the preferred fix, failing that the CC tweak is a second option.

OK, sounds good. Should I try editing the text and submit a patch for this too?

Yes please!

Cheers,

Richard