Skip to content
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

The great TC update (GCC 14.2 for everyone) #41

Merged
merged 8 commits into from
Oct 1, 2024
Merged

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Sep 28, 2024

Update all the TCs to GCC 14.2 (including the legacy kindle & pocketbook ones!), and introduce the kindlehf & kobov5 TCs.

(Rebase me, last year's GCC 9.5 experiment was somewhat enlightening ;p)


This change is Reviewable

@benoit-pierre
Copy link

\o/

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

Speaking of kindle & pocketbook, do we still have ugly old GCC hacks in place somewhere in the buildsystem?

(Specifically, stuff that would be hard-coded to the target instead of based on the GCC version).

@benoit-pierre
Copy link

Harfbuzz:

# We've apparently hit a weird corner-case w/ XText where GCC/STL atomics *sometimes* horribly blow up on an ARM1136JF-S CPU w/ GCC 7.5...
# c.f., https://github.com/koreader/koreader/issues/5780 & https://github.com/koreader/koreader/issues/6024
# NOTE: Our initial approach was to only disable atomics in a very dirty manner, which only helped with the first issue.
#       This, on the other hand, appears to help with both.
if(LEGACY OR POCKETBOOK)
    list(APPEND PATCH_CMD COMMAND ${ISED} "/^#define HB_CONFIG_HH\$/{p$<SEMICOLON>s//#define HB_NO_MT/}" src/hb-config.hh)
endif()

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

Thanks, I'll try a K3 build without that then ;).

@Frenzie
Copy link
Member

Frenzie commented Sep 28, 2024

Only HB? I thought there were a few more.

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

Hmm, glib/gnulib is upset about a missing frexpl on the softfp toolchains for some reason...

@benoit-pierre
Copy link

Hmm, glib/gnulib is upset about a missing frexpl on the softfp toolchains for some reason...

What's the configure log?

@benoit-pierre
Copy link

Also, the GLib project maintain 2 stable versions: the latest minor stable release, and the previous minor stable release. We're using the later (2.80.5), so you might want to test with 2.82.1:

 thirdparty/glib/CMakeLists.txt                      |  4 ++--
 thirdparty/glib/libglib-only.patch                  | 21 ++++++---------------
 thirdparty/glib/no_glibc_2.6_or_above_symbols.patch | 14 +++++++-------
 3 files changed, 15 insertions(+), 24 deletions(-)

diff --git i/thirdparty/glib/CMakeLists.txt w/thirdparty/glib/CMakeLists.txt
index 940010e3f..79ef9c840 100644
--- i/thirdparty/glib/CMakeLists.txt
+++ w/thirdparty/glib/CMakeLists.txt
@@ -27,8 +27,8 @@ list(APPEND BUILD_CMD COMMAND ninja glib/libglib-2.0.a)
 list(APPEND INSTALL_CMD COMMAND ${MESON_INSTALL} --tags devel)
 
 external_project(
-    DOWNLOAD URL 4334211338220a165350d1c4a1597b0e
-    https://download.gnome.org/sources/glib/2.80/glib-2.80.4.tar.xz
+    DOWNLOAD URL d101f1acab6805d4d6d3104e9634b8e3
+    https://download.gnome.org/sources/glib/2.82/glib-2.82.1.tar.xz
     PATCH_FILES ${PATCH_FILES}
     CONFIGURE_COMMAND ${CFG_CMD}
     BUILD_COMMAND ${BUILD_CMD}
diff --git i/thirdparty/glib/libglib-only.patch w/thirdparty/glib/libglib-only.patch
index 983dd9747..c9647dd5a 100644
--- i/thirdparty/glib/libglib-only.patch
+++ w/thirdparty/glib/libglib-only.patch
@@ -1,15 +1,15 @@
 --- i/glib/meson.build
 +++ w/glib/meson.build
-@@ -462,6 +462,8 @@ pkg.generate(libglib,
+@@ -462,6 +462,8 @@
  )
  meson.override_dependency('glib-2.0', libglib_dep)
  
 +if false
 +
- # On Windows, glib needs a spawn helper for g_spawn* API
- if host_system == 'windows'
-   if host_machine.cpu_family() == 'x86'
-@@ -499,6 +501,8 @@ else
+ # FIXME: This needs to be added to the `depends` of every invocation of
+ # glib_compile_resources in the build process. We can drop this when
+ # https://github.com/mesonbuild/meson/issues/13385 is fixed.
+@@ -503,6 +505,8 @@
    meson.override_find_program('gtester', gtester)
  endif
  
@@ -17,7 +17,7 @@
 +
  report_conf = configuration_data()
  report_conf.set('GLIB_VERSION', glib_version)
- report_conf.set('PYTHON', python_name)
+ report_conf.set('PYTHON', python.full_path())
 --- i/meson.build
 +++ w/meson.build
 @@ -2214,13 +2214,13 @@ else
@@ -38,15 +38,6 @@
  
  # First check in libc, fallback to libintl, and as last chance build
  # proxy-libintl subproject.
-@@ -2422,7 +2422,7 @@ endif
- 
- glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline)
- 
--python = import('python').find_installation(modules: ['packaging'])
-+python = import('python').find_installation()
- # used for '#!/usr/bin/env <name>'
- python_name = 'python3'
- 
 @@ -2570,25 +2570,19 @@ gnome = import('gnome')
  
  subdir('tools')
diff --git i/thirdparty/glib/no_glibc_2.6_or_above_symbols.patch w/thirdparty/glib/no_glibc_2.6_or_above_symbols.patch
index 0ba2fc4ed..27014fc1e 100644
--- i/thirdparty/glib/no_glibc_2.6_or_above_symbols.patch
+++ w/thirdparty/glib/no_glibc_2.6_or_above_symbols.patch
@@ -1,6 +1,6 @@
 --- i/meson.build
 +++ w/meson.build
-@@ -692,7 +692,6 @@
+@@ -709,7 +709,6 @@ functions = [
    'memalign',
    'mmap',
    'newlocale',
@@ -8,7 +8,7 @@
    'poll',
    'prlimit',
    'readlink',
-@@ -932,14 +931,6 @@
+@@ -945,14 +944,6 @@ else
  endif
  message('Checking whether to use statfs or statvfs .. ' + stat_func_to_use)
  
@@ -23,7 +23,7 @@
  osx_ldflags = []
  glib_have_os_x_9_or_later = false
  glib_have_carbon = false
-@@ -1001,16 +992,6 @@
+@@ -1014,16 +1005,6 @@ if cc.compiles('''#include <linux/futex.h>
    glib_conf.set('HAVE_FUTEX_TIME64', 1)
  endif
  
@@ -37,10 +37,10 @@
 -  glib_conf.set('HAVE_EVENTFD', 1)
 -endif
 -
- # Check for pidfd_open(2)
- if cc.links('''#include <sys/syscall.h>
-                #include <sys/wait.h>
-@@ -2065,9 +2065,6 @@
+ # Check for ppoll(2)
+ if cc.links('''#define _GNU_SOURCE
+                #include <poll.h>
+@@ -2113,9 +2094,6 @@ else
    if cc.has_header_symbol('pthread.h', 'pthread_getname_np', prefix : pthread_prefix)
      glib_conf.set('HAVE_PTHREAD_GETNAME_NP', 1)
    endif

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

What's the configure log?

../source/glib/gnulib/meson.build:316:2: ERROR: Problem encountered: frexpl() is missing or broken beyond repair, and we have nothing to replace it with

9536   │ Running compile:
9537   │ Working directory:  /var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/thirdparty/glib/build/meson-private/tmpxq771dyz
9538   │ Code:
9539   │ #include <math.h>
9540   │                             int main ()
9541   │                             {
9542   │                               (void) frexpl;
9543   │                               return 0;
9544   │                             }
9545   │                          
9546   │ -----------
9547   │ Command line: `env arm-kindle-linux-gnueabi-gcc -I/var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/staging/include /var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/thirdparty/glib/build/meson-private/tmpxq771dyz/testfile.c -o /var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/thirdparty/glib/build/meson-private/tmpxq
       │ 771dyz/output.obj -c -O2 -pipe -fomit-frame-pointer -DNDEBUG -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -marm -mfloat-abi=softfp -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -mno-unaligned-access -fPIC -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
9548   │ stderr:
9549   │ /var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/thirdparty/glib/build/meson-private/tmpxq771dyz/testfile.c: In function 'main':
9550   │ /var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/thirdparty/glib/build/meson-private/tmpxq771dyz/testfile.c:4:38: error: 'frexpl' undeclared (first use in this function); did you mean 'frexpf'?
9551   │     4 |                               (void) frexpl;
9552   │       |                                      ^~~~~~
9553   │       |                                      frexpf
9554   │ /var/tmp/niluje/koreader/base/build/arm-kindle-linux-gnueabi/thirdparty/glib/build/meson-private/tmpxq771dyz/testfile.c:4:38: note: each undeclared identifier is reported only once for each function it appears in

The definition is genuinely not exported, but I'm wholly confused about how it's supposed to be exported in the first place.

(AFAICT, only the definition is missing, I can see the symbols both in libm & the STL).

Will look into it tomorrow.

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

you might want to test with 2.82.1

Was worth a try in case a newer gnulib could do without, but no ;).

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

Will look into it tomorrow.

Specifically, I suspect all the long double stuff is borked for some reason...

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

Okay, might have found the culprit and backported the fix.

Mystified why we never hit that before, since it's a glibc issue and that's the one thing that didn't really change, lol.

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 28, 2024

That would be https://sourceware.org/git/?p=glibc.git;a=commit;f=math/math.h;h=998832a46688b9fb3a101eccae77bc45e7c1d7ab for the record (funnily enough, it landed in glibc 2.15, which is what we use for the kobo target, i.e., what I had been testing ;D).

@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 29, 2024

Harfbuzz:

# We've apparently hit a weird corner-case w/ XText where GCC/STL atomics *sometimes* horribly blow up on an ARM1136JF-S CPU w/ GCC 7.5...
# c.f., https://github.com/koreader/koreader/issues/5780 & https://github.com/koreader/koreader/issues/6024
# NOTE: Our initial approach was to only disable atomics in a very dirty manner, which only helped with the first issue.
#       This, on the other hand, appears to help with both.
if(LEGACY OR POCKETBOOK)
    list(APPEND PATCH_CMD COMMAND ${ISED} "/^#define HB_CONFIG_HH\$/{p$<SEMICOLON>s//#define HB_NO_MT/}" src/hb-config.hh)
endif()

Appears to still be necessary, as I get a nice segfault on startup otherwise ;p.

NiLuJe added 8 commits October 1, 2024 19:12
Basically just enforcing building w/ make 4.3 to make sure stuff
builds...
And moving to the wildly untested GCC 9.5 TCs on legacy (kindle &
pocketbook) TCs.
Update ref script for new TCs

kobov4 (previously kobomk7), kobov5, kindlehf
Introduce kobov5 & kindlehf

Better late that never ;).
long double math functions weren't being declared

Affects kindle, pocketbook, bookeen, cervantes, kindle5, kindlepw2
Refactored so that it only contains the env setup, making it slightly
less scary/ugly ;).

The full thing is on SVN, as mentioned in gen-tc.sh
Copy link
Member Author

@NiLuJe NiLuJe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 5 files at r1, 1 of 2 files at r2, 1 of 1 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)

@NiLuJe NiLuJe merged commit b3da400 into koreader:master Oct 1, 2024
13 checks passed
@NiLuJe
Copy link
Member Author

NiLuJe commented Oct 1, 2024

I tagged a release and uploaded the latest build artifacts.

Beware: unlike the previous release, I unwrapped the GH upload artifacts ZIPs: it's the inner tarball this time!

@mergen3107
Copy link

Are we getting kindlehf nightlies soon? ^^

@Frenzie
Copy link
Member

Frenzie commented Oct 2, 2024

Full nightlies with OTA may require a server migration. But nightlies on Gitlab, sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants