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

Submitted by Leon Anavi on Jan. 11, 2021, 7:16 p.m. | Patch ID: 179127

Details

Message ID 20210111191655.23792-1-leon.anavi@konsulko.com
State Superseded
Headers show

Commit Message

Leon Anavi Jan. 11, 2021, 7:16 p.m.
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]

Reported-by: Matthew Tsenkov <matthew.tsenkov@konsulko.com>
Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
---
 documentation/dev-manual/common-tasks.rst               | 2 ++
 documentation/ref-manual/examples/hello-single/hello.bb | 2 ++
 2 files changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index e1dee8ecd..b816536d9 100644
--- a/documentation/dev-manual/common-tasks.rst
+++ b/documentation/dev-manual/common-tasks.rst
@@ -2297,6 +2297,8 @@  directory BitBake uses for the build.
 
    S = "${WORKDIR}"
 
+   TARGET_CC_ARCH += "${LDFLAGS}"
+
    do_compile() {
        ${CC} helloworld.c -o helloworld
    }
diff --git a/documentation/ref-manual/examples/hello-single/hello.bb b/documentation/ref-manual/examples/hello-single/hello.bb
index 0812743e3..1a2896769 100644
--- a/documentation/ref-manual/examples/hello-single/hello.bb
+++ b/documentation/ref-manual/examples/hello-single/hello.bb
@@ -7,6 +7,8 @@  SRC_URI = "file://helloworld.c"
 
 S = "${WORKDIR}"
 
+TARGET_CC_ARCH += "${LDFLAGS}"
+
 do_compile() {
 	${CC} helloworld.c -o helloworld
 }

Comments

Quentin Schulz Jan. 12, 2021, 9:16 a.m.
Hi Leon,

On Mon, Jan 11, 2021 at 09:16:55PM +0200, Leon Anavi wrote:
> 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]
> 
> Reported-by: Matthew Tsenkov <matthew.tsenkov@konsulko.com>
> Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
> ---
>  documentation/dev-manual/common-tasks.rst               | 2 ++
>  documentation/ref-manual/examples/hello-single/hello.bb | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
> index e1dee8ecd..b816536d9 100644
> --- a/documentation/dev-manual/common-tasks.rst
> +++ b/documentation/dev-manual/common-tasks.rst
> @@ -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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#821): https://lists.yoctoproject.org/g/docs/message/821
Mute This Topic: https://lists.yoctoproject.org/mt/79604814/3617530
Group Owner: docs+owner@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
Leon Anavi Jan. 12, 2021, 11:50 a.m.
Hi Quentin,

On 12.01.21 г. 11:16 ч., Quentin Schulz wrote:
> 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
Richard Purdie Jan. 12, 2021, 11:56 a.m.
On Tue, 2021-01-12 at 13:50 +0200, Leon Anavi wrote:
> Hi Quentin,
> 
> On 12.01.21 г. 11:16 ч., Quentin Schulz wrote:
> > 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.

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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#824): https://lists.yoctoproject.org/g/docs/message/824
Mute This Topic: https://lists.yoctoproject.org/mt/79604814/3617530
Group Owner: docs+owner@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
Leon Anavi Jan. 12, 2021, 12:51 p.m.
Hi Richard,

On 12.01.21 г. 13:56 ч., Richard Purdie wrote:
> 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.
>
> 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
Richard Purdie Jan. 12, 2021, 4:51 p.m.
On Tue, 2021-01-12 at 14:51 +0200, Leon Anavi wrote:
> Hi Richard,
> 
> On 12.01.21 г. 13:56 ч., Richard Purdie wrote:
> > 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.

> > 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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#826): https://lists.yoctoproject.org/g/docs/message/826
Mute This Topic: https://lists.yoctoproject.org/mt/79604814/3617530
Group Owner: docs+owner@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
Leon Anavi Jan. 13, 2021, 4:46 a.m.
This is a system generated Comment: Patch 179127 was automatically marked as superseded by patch 179137.