Skip to contentSkip to conversation

expect-native: fix build with gcc-14

PATCH In review [email protected] 5 participants 7 messages Jun 13, 2024 – Jun 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 expect-native: fix build with gcc-14

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [-Wimplicit-int] conftest.c:59:5: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]

* this recipe set "BBCLASSEXTEND = "native nativesdk", causes "CFLAGS +=" setting not take effect, use append instead.
snip of bitbake expect-native -e:

   set /layers/oe-core/meta/conf/documentation.conf:110
     [doc] "Flags passed to the C compiler for the target system. This variable evaluates to the same as TARGET_CFLAGS."
   append /layers/oe-core/meta/recipes-devtools/expect/expect_5.45.4.bb:87
     "-Wno-error=incompatible-pointer-types"
   set /layers/oe-core/meta/classes-recipe/native.bbclass:44
     "${BUILD_CFLAGS}"
   override[pn-gtk4]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:336
     " -Wno-error=int-conversion"
   override[pn-pidgin-sipe]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:340
     " -Wno-error=cast-function-type-strict"
 pre-expansion value:
   "${BUILD_CFLAGS}"

export CFLAGS="-isystem/build/tmp-glibc/work/x86_64-linux/expect-native/5.45.4/recipe-sysroot-native/usr/include -O2 -pipe"

---
 meta/recipes-devtools/expect/expect_5.45.4.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-devtools/expect/expect_5.45.4.bb +4 -1
index 18904ebc10..5e7b352196 100644
@@ -84,4 +84,7 @@ BBCLASSEXTEND = "native nativesdk"
 
 # http://errors.yoctoproject.org/Errors/Details/766950/
 # expect5.45.4/exp_chan.c:62:5: error: initialization of 'struct Tcl_ChannelTypeVersion_ *' from incompatible pointer type 'int (*)(void *, int)' [-Wincompatible-pointer-types]
-CFLAGS += "-Wno-error=incompatible-pointer-types"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types"
+
+# Fix expect-native configure tests are failing with gcc-14
+CFLAGS:append:class-native = " -Wno-error=implicit-int -Wno-error=implicit-function-declaration"
Signature · 1 line
2.25.1
#1 lore raw
Quoted 38 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [-Wimplicit-int] conftest.c:59:5: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]

* this recipe set "BBCLASSEXTEND = "native nativesdk", causes "CFLAGS +="
setting not take effect, use append instead.
snip of bitbake expect-native -e:
   set /layers/oe-core/meta/conf/documentation.conf:110
     [doc] "Flags passed to the C compiler for the target system. This variable evaluates to the same as TARGET_CFLAGS." append /layers/oe-core/meta/recipes-devtools/expect/expect_5.45.4.bb:87 "-Wno-error=incompatible-pointer-types"
   set /layers/oe-core/meta/classes-recipe/native.bbclass:44
     "${BUILD_CFLAGS}"
   override[pn-gtk4]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:336
     " -Wno-error=int-conversion"
   override[pn-pidgin-sipe]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:340
     " -Wno-error=cast-function-type-strict"
 pre-expansion value:
   "${BUILD_CFLAGS}"
export CFLAGS="-isystem/build/tmp-glibc/work/x86_64-linux/expect-native/5.45.4/recipe-sysroot-native/usr/include -O2 -pipe"

---
 meta/recipes-devtools/expect/expect_5.45.4.bb | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-devtools/expect/expect_5.45.4.bb +0 -0
index 18904ebc10..5e7b352196 100644
@@ -84,4 +84,7 @@ BBCLASSEXTEND = "native nativesdk"


 # http://errors.yoctoproject.org/Errors/Details/766950/
 # expect5.45.4/exp_chan.c:62:5: error: initialization of 'struct Tcl_ChannelTypeVersion_ *' from incompatible pointer type 'int (*)(void *, int)' [-Wincompatible-pointer-types]

meta/recipes-devtools/expect/expect_5.45.4.bb BBCLASSEXTEND = "native nativesdk" · line 90

Quoted 5 lines
meta/recipes-devtools/expect/expect_5.45.4.bb +4 -1
-CFLAGS += "-Wno-error=incompatible-pointer-types"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types"
+
+# Fix expect-native configure tests are failing with gcc-14
+CFLAGS:append:class-native = " -Wno-error=implicit-int -Wno-error=implicit-function-declaration"

You have a valid problem here however I really don't like the "arms race" of making everything an append as the base definitions are problematic. It would be this recipe today but a quick search shows many other recipes which will have similar problems.

I think I'd prefer to see if we can drop the assignments in native/nativesdk bbclass and improve things that way even if it is a bit more invasive.

I'm testing a patch on master-next to test this and see how bad the fallout is.

Cheers,

Richard

#2 lore raw
Quoted 57 lines · Richard Purdie via lists.openembedded.org
Quoted 6 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [-Wimplicit-int] conftest.c:59:5: error: implicit declaration of function 'exit'

[-Wimplicit-function-declaration]

Quoted 6 lines

* this recipe set "BBCLASSEXTEND = "native nativesdk", causes "CFLAGS +=" setting not take effect, use append instead.
snip of bitbake expect-native -e:

   set /layers/oe-core/meta/conf/documentation.conf:110
     [doc] "Flags passed to the C compiler for the target system. This

variable evaluates to the same as TARGET_CFLAGS."

Quoted 1 line

append /layers/oe-core/meta/recipes-devtools/expect/

expect_5.45.4.bb:87

Quoted 4 lines

"-Wno-error=incompatible-pointer-types"

   set /layers/oe-core/meta/classes-recipe/native.bbclass:44
     "${BUILD_CFLAGS}"
   override[pn-gtk4]::append[toolchain-clang]

/layers/meta-clang/conf/nonclangable.conf:336

Quoted 2 lines

" -Wno-error=int-conversion"
override[pn-pidgin-sipe]::append[toolchain-clang]

/layers/meta-clang/conf/nonclangable.conf:340

Quoted 4 lines

" -Wno-error=cast-function-type-strict"
pre-expansion value:

   "${BUILD_CFLAGS}"

export

CFLAGS="-isystem/build/tmp-glibc/work/x86_64-linux/expect-native/5.45.4/recipe-sysroot-native/usr/include -O2 -pipe"

Review

Quoted 7 lines
---
 meta/recipes-devtools/expect/expect_5.45.4.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/recipes-devtools/expect/expect_5.45.4.bb

meta/recipes-devtools/expect/expect_5.45.4.bb BBCLASSEXTEND = "native nativesdk" · line 86

Quoted 7 lines

index 18904ebc10..5e7b352196 100644

meta/recipes-devtools/expect/expect_5.45.4.bb +0 -0
@@ -84,4 +84,7 @@ BBCLASSEXTEND = "native nativesdk"
 
 # http://errors.yoctoproject.org/Errors/Details/766950/
 # expect5.45.4/exp_chan.c:62:5: error: initialization of 'struct

Tcl_ChannelTypeVersion_ *' from incompatible pointer type 'int (*)(void *, int)' [-Wincompatible-pointer-types]

meta/recipes-devtools/expect/expect_5.45.4.bb BBCLASSEXTEND = "native nativesdk"

Quoted 5 lines
meta/recipes-devtools/expect/expect_5.45.4.bb +4 -1
-CFLAGS += "-Wno-error=incompatible-pointer-types"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types"
+
+# Fix expect-native configure tests are failing with gcc-14
+CFLAGS:append:class-native = " -Wno-error=implicit-int

-Wno-error=implicit-function-declaration"

Quoted 1 line
Quoted 8 lines

You have a valid problem here however I really don't like the "arms race" of making everything an append as the base definitions are problematic. It would be this recipe today but a quick search shows many other recipes which will have similar problems.

I think I'd prefer to see if we can drop the assignments in native/nativesdk bbclass and improve things that way even if it is a bit more invasive.

I am wondering when we have gcc14 for target as well why there tests are not failing for target compile

Quoted 4 lines

I'm testing a patch on master-next to test this and see how bad the fallout is.

I have not looked at your patch but I think passing -Wno-error to configure tests might be something that can help unless some tests are relying on that behavior which may fail

Quoted 18 lines

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#200594):
https://lists.openembedded.org/g/openembedded-core/message/200594
Mute This Topic: https://lists.openembedded.org/mt/106647106/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to Richard Purdie
Quoted 60 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Richard Purdie
Sent: den 13 juni 2024 10:40
To: [email protected]; [email protected]
Subject: Re: [OE-core] [PATCH] expect-native: fix build with gcc-14

Quoted 35 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [-Wimplicit-int] conftest.c:59:5: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]

* this recipe set "BBCLASSEXTEND = "native nativesdk", causes "CFLAGS +="
setting not take effect, use append instead.
snip of bitbake expect-native -e:
   set /layers/oe-core/meta/conf/documentation.conf:110
     [doc] "Flags passed to the C compiler for the target system. This variable evaluates to the same as TARGET_CFLAGS." append /layers/oe-core/meta/recipes-devtools/expect/expect_5.45.4.bb:87 "-Wno-error=incompatible-pointer-types"
   set /layers/oe-core/meta/classes-recipe/native.bbclass:44
     "${BUILD_CFLAGS}"
   override[pn-gtk4]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:336
     " -Wno-error=int-conversion"
   override[pn-pidgin-sipe]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:340
     " -Wno-error=cast-function-type-strict"
 pre-expansion value:
   "${BUILD_CFLAGS}"
export CFLAGS="-isystem/build/tmp-glibc/work/x86_64-linux/expect-native/5.45.4/recipe-sysroot-native/usr/include -O2 -pipe"

---
 meta/recipes-devtools/expect/expect_5.45.4.bb | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-devtools/expect/expect_5.45.4.bb +0 -0
index 18904ebc10..5e7b352196 100644

meta/recipes-devtools/expect/expect_5.45.4.bb BBCLASSEXTEND = "native nativesdk" · line 90

Quoted 8 lines
meta/recipes-devtools/expect/expect_5.45.4.bb +4 -1
@@ -84,4 +84,7 @@ BBCLASSEXTEND = "native nativesdk"
 
  # http://errors.yoctoproject.org/Errors/Details/766950/
  # expect5.45.4/exp_chan.c:62:5: error: initialization of 'struct Tcl_ChannelTypeVersion_ *' from incompatible pointer type 'int (*)(void *, int)' [-Wincompatible-pointer-types]
-CFLAGS += "-Wno-error=incompatible-pointer-types"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types"
+
+# Fix expect-native configure tests are failing with gcc-14
+CFLAGS:append:class-native = " -Wno-error=implicit-int -Wno-error=implicit-function-declaration"

You have a valid problem here however I really don't like the "arms race" of making everything an append as the base definitions are problematic. It would be this recipe today but a quick search shows many other recipes which will have similar problems.

I think I'd prefer to see if we can drop the assignments in native/nativesdk bbclass and improve things that way even if it is a bit more invasive.

Quoted 6 lines

I'm testing a patch on master-next to test this and see how bad the fallout is.

Cheers,

Richard

Isn't the correct thing to add to CFLAGS (really TARGET_CFLAGS) and/or BUILD_CFLAGS as appropriate? If the same options are needed for both target and native, then you can use an intermediary variable. E.g., for the above case you would get something like:

COMMON_CFLAGS = "-Wno-error=incompatible-pointer-types" CFLAGS += "${COMMON_CFLAGS}"

BUILD_CFLAGS += " \
    ${COMMON_CFLAGS} \
    -Wno-error=implicit-int \
    -Wno-error=implicit-function-declaration \

"

//Peter

#4 lore raw
Quoted 89 lines · Peter Kjellerstedt
Quoted 77 lines

-----Original Message-----
From:
[email protected] <[email protected]

Quoted 1 line

On Behalf Of Richard Purdie

Sent: den 13 juni 2024 10:40
To: [email protected]; [email protected]
Subject: Re: [OE-core] [PATCH] expect-native: fix build with gcc-14

Quoted 53 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [- Wimplicit-int]
conftest.c:59:5: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]

* this recipe set "BBCLASSEXTEND = "native nativesdk", causes "CFLAGS +="
setting not take effect, use append instead.
snip of bitbake expect-native -e:
   set /layers/oe-core/meta/conf/documentation.conf:110 [doc] "Flags passed to the C compiler for the target system. This variable evaluates to the same as TARGET_CFLAGS." append /layers/oe-core/meta/recipes- devtools/expect/expect_5.45.4.bb:87 "-Wno-error=incompatible-pointer-types"
   set /layers/oe-core/meta/classes-recipe/native.bbclass:44 "${BUILD_CFLAGS}" override[pn-gtk4]::append[toolchain-clang] /layers/meta- clang/conf/nonclangable.conf:336
     " -Wno-error=int-conversion" override[pn-pidgin-sipe]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:340
     " -Wno-error=cast-function-type-strict" pre-expansion value:
   "${BUILD_CFLAGS}"
export CFLAGS="-isystem/build/tmp-glibc/work/x86_64-linux/expect- native/5.45.4/recipe-sysroot-native/usr/include -O2 -pipe"

---
 meta/recipes-devtools/expect/expect_5.45.4.bb | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-devtools/expect/expect_5.45.4.bb +0 -0
index 18904ebc10..5e7b352196 100644
@@ -84,4 +84,7 @@ BBCLASSEXTEND = "native nativesdk"
 
  # http://errors.yoctoproject.org/Errors/Details/766950/
  # expect5.45.4/exp_chan.c:62:5: error: initialization of 'struct

Tcl_ChannelTypeVersion_ *' from incompatible pointer type 'int (*)(void *, int)' [-Wincompatible-pointer-types]

meta/recipes-devtools/expect/expect_5.45.4.bb +4 -1
-CFLAGS += "-Wno-error=incompatible-pointer-types"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types"
+
+# Fix expect-native configure tests are failing with gcc-14
+CFLAGS:append:class-native = " -Wno-error=implicit-int -Wno-
Quoted 2 lines

error=implicit-function-declaration"

You have a valid problem here however I really don't like the "arms race" of making everything an append as the base definitions are problematic. It would be this recipe today but a quick search shows many other recipes which will have similar problems.

I think I'd prefer to see if we can drop the assignments in native/nativesdk bbclass and improve things that way even if it is a
bit more invasive.

Quoted 6 lines

I'm testing a patch on master-next to test this and see how bad the fallout is.

Cheers,

Richard

Isn't the correct thing to add to CFLAGS (really TARGET_CFLAGS) and/or BUILD_CFLAGS as appropriate? If the same options are needed for both target and native, then you can use an intermediary variable. E.g., for the above case you would get something like:

Quoted 7 lines

COMMON_CFLAGS = "-Wno-error=incompatible-pointer-types" CFLAGS += "${COMMON_CFLAGS}"
BUILD_CFLAGS += " \
    ${COMMON_CFLAGS} \
    -Wno-error=implicit-int \
    -Wno-error=implicit-function-declaration \
"

We could require that but I don't think it is what people expect, or how things were meant to work. I've sent the patch I was thinking off now as it seems to work ok in testing so far. In most cases recipe writers don't need/want separate flags for native/nativesdk/target.

Cheers,

Richard

#5 lore raw
Quoted 107 lines

-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: den 13 juni 2024 23:59
To: Peter Kjellerstedt <[email protected]>; [email protected]; [email protected]
Subject: Re: [OE-core] [PATCH] expect-native: fix build with gcc-14

Quoted 3 lines · Peter Kjellerstedt
Quoted 3 lines

-----Original Message-----
From:
[email protected] <openembedded-

[email protected]

Quoted 86 lines
Quoted 74 lines
Quoted 1 line

On Behalf Of Richard Purdie

Sent: den 13 juni 2024 10:40
To: [email protected]; [email protected]
Subject: Re: [OE-core] [PATCH] expect-native: fix build with gcc-14

Quoted 53 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [- Wimplicit-int]
conftest.c:59:5: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]

* this recipe set "BBCLASSEXTEND = "native nativesdk", causes "CFLAGS +="
setting not take effect, use append instead.
snip of bitbake expect-native -e:
   set /layers/oe-core/meta/conf/documentation.conf:110 [doc] "Flags passed to the C compiler for the target system. This variable evaluates to the same as TARGET_CFLAGS." append /layers/oe-core/meta/recipes- devtools/expect/expect_5.45.4.bb:87 "-Wno-error=incompatible-pointer-types"
   set /layers/oe-core/meta/classes-recipe/native.bbclass:44 "${BUILD_CFLAGS}" override[pn-gtk4]::append[toolchain-clang] /layers/meta- clang/conf/nonclangable.conf:336
     " -Wno-error=int-conversion" override[pn-pidgin-sipe]::append[toolchain-clang] /layers/meta-clang/conf/nonclangable.conf:340
     " -Wno-error=cast-function-type-strict" pre-expansion value:
   "${BUILD_CFLAGS}"
export CFLAGS="-isystem/build/tmp-glibc/work/x86_64-linux/expect- native/5.45.4/recipe-sysroot-native/usr/include -O2 -pipe"

---
 meta/recipes-devtools/expect/expect_5.45.4.bb | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-devtools/expect/expect_5.45.4.bb +0 -0
index 18904ebc10..5e7b352196 100644
@@ -84,4 +84,7 @@ BBCLASSEXTEND = "native nativesdk"
 
  # http://errors.yoctoproject.org/Errors/Details/766950/
  # expect5.45.4/exp_chan.c:62:5: error: initialization of 'struct

Tcl_ChannelTypeVersion_ *' from incompatible pointer type 'int (*)(void *, int)' [-Wincompatible-pointer-types]

meta/recipes-devtools/expect/expect_5.45.4.bb +4 -1
-CFLAGS += "-Wno-error=incompatible-pointer-types"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types"
+
+# Fix expect-native configure tests are failing with gcc-14
+CFLAGS:append:class-native = " -Wno-error=implicit-int -Wno-
Quoted 2 lines

error=implicit-function-declaration"

You have a valid problem here however I really don't like the "arms race" of making everything an append as the base definitions are problematic. It would be this recipe today but a quick search shows many other recipes which will have similar problems.

I think I'd prefer to see if we can drop the assignments in native/nativesdk bbclass and improve things that way even if it is a
bit more invasive.

Quoted 6 lines

I'm testing a patch on master-next to test this and see how bad the fallout is.

Cheers,

Richard

Isn't the correct thing to add to CFLAGS (really TARGET_CFLAGS) and/or BUILD_CFLAGS as appropriate? If the same options are needed for both target and native, then you can use an intermediary variable. E.g., for the above case you would get something like:

Quoted 7 lines

COMMON_CFLAGS = "-Wno-error=incompatible-pointer-types" CFLAGS += "${COMMON_CFLAGS}"
BUILD_CFLAGS += " \
    ${COMMON_CFLAGS} \
    -Wno-error=implicit-int \
    -Wno-error=implicit-function-declaration \
"

Quoted 8 lines

We could require that but I don't think it is what people expect, or how things were meant to work. I've sent the patch I was thinking off now as it seems to work ok in testing so far. In most cases recipe writers don't need/want separate flags for native/nativesdk/target.

Cheers,

Richard

Interesting. Being able to add to CFLAGS and have the options apply for all cases seems a lot more intuitive than how it was.

There is (at least) one corner case though. If you do TARGET_CFLAGS:append = " ...", then that will actually apply to the native and nativesdk builds too now.

To verify the above, I added the following to the dos2unix recipe:

CFLAGS += "-DADD_BOTH"
TARGET_CFLAGS += "-DADD_TARGET"
BUILD_CFLAGS += " -DADD_NATIVE"

CFLAGS:append = " -DAPPEND_BOTH"
TARGET_CFLAGS:append = " -DAPPEND_TARGET"
BUILD_CFLAGS:append = " -DAPPEND_NATIVE"

and then ran the following two commands:

$ bitbake-getvar -q --value -r dos2unix CFLAGS
 -O2 -pipe -g ... -DADD_TARGET -DAPPEND_TARGET -DADD_BOTH -DAPPEND_BOTH
$ bitbake-getvar -q --value -r dos2unix-native CFLAGS
 ... -O2 -pipe  -DADD_NATIVE -DAPPEND_NATIVE -DAPPEND_TARGET -DADD_BOTH -DAPPEND_BOTH

As you can see, the -DAPPEND_TARGET is present in both cases. :(

Now, appending to TARGET_CFLAGS like that is probably not very common, but there are two examples in OE-Core (TARGET_CFLAGS:append:qemuriscv64 = " ...") and two more in meta-openembedded. Neither of those four recipes use BBCLASSEXTEND though so this change wouldn't be a problem for either of them in practice. And a simple workaround, if you know about this, would be to use CFLAGS:append:class-target instead.

//Peter

#6 lore raw
In reply to [email protected]
Quoted 7 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

* do_configure failed with gcc-14:
error in build/config.log:
conftest.c:56:3: error: return type defaults to 'int' [-Wimplicit-int] conftest.c:59:5: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]

A better solution to this would be to actually fix the configure test, which for example Fedora are already doing and have also submitted upstream. Surprisingly, the expect maintainer appears to be back so there’s a chance this will actually be resolved.

Ross