Skip to content

toolchain: gcc: add support for GCC 14 #15414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

rsalvaterra
Copy link
Member

Deleted (upstreamed):

  • 020-Include-safe-ctype.h-after-C-standard-headers-to-avo.patch [1]
  • 021-libcc1-fix-vector-include.patch [2]

All other patches automatically rebased.

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=9970b576b7e4ae337af1268395ff221348c4b34a
[2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5213047b1d50af63dfabb5e5649821a6cb157e33

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>

@rsalvaterra rsalvaterra added the work in progress pull request the author is still working on label May 7, 2024
@rsalvaterra
Copy link
Member Author

rsalvaterra commented May 7, 2024

Marked as WIP, as I still have to build it. Building fine. Added an extra commit to fix the build of mtd, but there's also a fix required for attr, in the packages feed (will send separately).

Build and run-tested:

  • mediatek/filogic (Banana Pi R3)
  • ath79/generic (TL-WDR3600)

@github-actions github-actions bot added the toolchain pull request/issue with toolchain related changes label May 7, 2024
@github-actions github-actions bot added the core packages pull request/issue for core (in-tree) packages label May 7, 2024
@rsalvaterra rsalvaterra changed the title [WIP/RFC/RFT] toolchain: gcc: add support for GCC 14 toolchain: gcc: add support for GCC 14 May 7, 2024
@rsalvaterra rsalvaterra removed the work in progress pull request the author is still working on label May 7, 2024
@trippleflux
Copy link

linux-atm compilation is stop with gcc 14 :

io.c:621:54: error: passing argument 3 of 'getsockname' from incompatible pointer type [-Wincompatible-pointer-types]
  621 |     result = getsockname(fd,(struct sockaddr *) addr,&length);
      |                                                      ^~~~~~~
      |                                                      |
      |                                                      size_t * {aka long unsigned int *}

here is the patch :

diff -Naur a/src/arpd/io.c b/src/arpd/io.c
--- a/src/arpd/io.c
+++ b/src/arpd/io.c
@@ -615,7 +615,7 @@
 int get_local(int fd,struct sockaddr_atmsvc *addr)
 {
     int result;
-    size_t length;
+    socklen_t length;
 
     length = sizeof(struct sockaddr_atmsvc);
     result = getsockname(fd,(struct sockaddr *) addr,&length);
diff -Naur a/src/led/conn.c b/src/led/conn.c
--- a/src/led/conn.c
+++ b/src/led/conn.c
@@ -405,7 +405,7 @@
 {
         Conn_t *new;
         struct sockaddr_atmsvc addr;
-        size_t len;
+        socklen_t len;
         int fd;
         char buff[MAX_ATM_ADDR_LEN+1];

Deleted (upstreamed):
- 020-Include-safe-ctype.h-after-C-standard-headers-to-avo.patch [1]
- 021-libcc1-fix-vector-include.patch [2]

All other patches automatically rebased.

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=9970b576b7e4ae337af1268395ff221348c4b34a
[2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5213047b1d50af63dfabb5e5649821a6cb157e33

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
Also fix a couple of warnings while at it.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
@neheb
Copy link
Contributor

neheb commented May 8, 2024

> make package/mbedtls/compile V=s
make[2]: Entering directory '/home/mangix/devstuff/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/mangix/devstuff/openwrt/scripts/config'
make[1]: Entering directory '/home/mangix/devstuff/openwrt'
+ mkdir -p /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl
+ cd /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl
+ mkdir -p bin lib stamp usr/include usr/lib
mkdir -p /home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/stamp
touch /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/.prepared
make[2]: Entering directory '/home/mangix/devstuff/openwrt/package/libs/toolchain'
Makefile:748: WARNING: skipping libgomp -- package has no install section
echo "libc" >> /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/pkginfo/toolchain.default.install
echo "libatomic" >> /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/pkginfo/toolchain.default.install
echo "libstdcpp" >> /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/pkginfo/toolchain.default.install
echo "librt" >> /home/mangix/devstuff/openwrt/staging_dir/target-aarch64_generic_musl/pkginfo/toolchain.default.install
make[2]: Leaving directory '/home/mangix/devstuff/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.13#0.10#0.22
make[2]: Entering directory '/home/mangix/devstuff/openwrt/package/libs/mbedtls'
rm -f /home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/.built
touch /home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/.built_check
MAKEFLAGS="" /home/mangix/devstuff/openwrt/staging_dir/host/bin/ninja  -j1 -C /home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0 
ninja: Entering directory `/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0'
[1/277] Building C object library/CMakeFiles/mbedcrypto_static.dir/ctr_drbg.c.o
FAILED: library/CMakeFiles/mbedcrypto_static.dir/ctr_drbg.c.o 
/home/mangix/devstuff/openwrt/staging_dir/host/bin/ccache /home/mangix/devstuff/openwrt/staging_dir/toolchain-aarch64_generic_gcc-14.1.0_musl/bin/aarch64-openwrt-linux-musl-gcc  -I/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/include -I/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/library -I/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/3rdparty/everest/include -I/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/3rdparty/p256-m -I/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/3rdparty/p256-m/p256-m -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0=mbedtls-3.6.0 -ffunction-sections -fdata-sections -Wformat -Werror=format-security -DPIC -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -Wall -Wextra -Wwrite-strings -Wformat=2 -Wno-format-nonliteral -Wvla -Wlogical-op -Wshadow -Wformat-signedness -Wformat-overflow=2 -Wformat-truncation -Werror -Wmissing-declarations -Wmissing-prototypes -O2 -std=c99 -fPIC -MD -MT library/CMakeFiles/mbedcrypto_static.dir/ctr_drbg.c.o -MF library/CMakeFiles/mbedcrypto_static.dir/ctr_drbg.c.o.d -o library/CMakeFiles/mbedcrypto_static.dir/ctr_drbg.c.o -c /home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/library/ctr_drbg.c
In file included from library/ctr_drbg.c:13:
In function 'mbedtls_xor',
    inlined from 'ctr_drbg_update_internal' at library/ctr_drbg.c:372:5:
library/common.h:235:17: error: array subscript 48 is outside array bounds of 'unsigned char[48]' [-Werror=array-bounds=]
  235 |         r[i] = a[i] ^ b[i];
      |                ~^~~
library/ctr_drbg.c: In function 'ctr_drbg_update_internal':
library/ctr_drbg.c:335:19: note: at offset 48 into object 'tmp' of size 48
  335 |     unsigned char tmp[MBEDTLS_CTR_DRBG_SEEDLEN];
      |                   ^~~
In function 'mbedtls_xor',
    inlined from 'ctr_drbg_update_internal' at library/ctr_drbg.c:372:5:
library/common.h:235:24: error: array subscript 48 is outside array bounds of 'const unsigned char[48]' [-Werror=array-bounds=]
  235 |         r[i] = a[i] ^ b[i];
      |                       ~^~~
library/ctr_drbg.c: In function 'ctr_drbg_update_internal':
library/ctr_drbg.c:333:57: note: at offset 48 into object 'data' of size [0, 48]
  333 |                                     const unsigned char data[MBEDTLS_CTR_DRBG_SEEDLEN])
      |                                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'mbedtls_xor',
    inlined from 'ctr_drbg_update_internal' at library/ctr_drbg.c:372:5:
library/common.h:235:14: error: array subscript 48 is outside array bounds of 'unsigned char[48]' [-Werror=array-bounds=]
  235 |         r[i] = a[i] ^ b[i];
      |         ~~~~~^~~~~~~~~~~~~
library/ctr_drbg.c: In function 'ctr_drbg_update_internal':
library/ctr_drbg.c:335:19: note: at offset 48 into object 'tmp' of size 48
  335 |     unsigned char tmp[MBEDTLS_CTR_DRBG_SEEDLEN];
      |                   ^~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
make[2]: *** [Makefile:182: /home/mangix/devstuff/openwrt/build_dir/target-aarch64_generic_musl/mbedtls-3.6.0/.built] Error 1
make[2]: Leaving directory '/home/mangix/devstuff/openwrt/package/libs/mbedtls'
time: package/libs/mbedtls/compile#0.46#0.14#0.58
    ERROR: package/libs/mbedtls failed to build.

edit: Mbed-TLS/mbedtls#9003

@trippleflux
Copy link

trippleflux commented May 9, 2024

gcc 14 failed to compiling net/frr (x86_64 subtarget glibc) :

I am sorry after deleting and starting over my local openwrt branch, frr now compiled.

@neheb
Copy link
Contributor

neheb commented May 10, 2024

@trippleflux can you make a PR for linux-atm?

@trippleflux
Copy link

@neheb
I haven't got the experiences with git & github, i will try but i welcome for anybody to take first on my finding (patch).

@rsalvaterra
Copy link
Member Author

rsalvaterra commented May 11, 2024

Fallout from updating to a newer GCC major version is undesirable, but unavoidable. In an ideal world, all packages would have already been fixed to compile without issues. In reality, it's unreasonable to expect a developer to go all over the tree, fixing each and every package that fails to build, for one reason or another (I personally don't have the time nor the storage space to do so, I can only vouch for my personal configs).
Fixing broken packages is, and always will be, a best effort task. Whoever wants to play with GCC 14 knows the drill: if it breaks, you get to keep the pieces. That's why GCC 13.x is, and will keep being the default for the forseeable future. 😉

@trippleflux
Copy link

@rsalvaterra

Yup 3 days ago, I have finally finished my OpenWrt compilation (714 packages for x86_64) using gcc 14, experiencing some quirks on installed image but working fine so far for not heavy usage. Great job on this PR !.

@hauke
Copy link
Member

hauke commented May 11, 2024

I think this looks fine and you can merge it if you want. We can fix the broken packages afterwards.

@robimarko
Copy link
Contributor

LGTM, so feel free to merge

@rsalvaterra
Copy link
Member Author

Thanks for the feedback, everyone. I'll merge with a note stating that broken packages will be fixed as they're found.

@rsalvaterra
Copy link
Member Author

Merged, thanks once again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core packages pull request/issue for core (in-tree) packages toolchain pull request/issue with toolchain related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants