flypig.co.uk

List items

Items from the current list are shown below.

Gecko

21 Sep 2023 : Day 36 #
Yesterday I was about to apply existing patch 0048 in order to bring back the DestroyBrowserWindow() method. I'm going to skip to something else now before I move on to that, but for reference for when I come back to this, here are the commands I'm using for my partial build. I'll need to use these to bring back all the error messages (there are too many to sensibly record here!) once I'm done.
$ sfdk engine exec
$ sb2 -t SailfishOS-devel-aarch64.default
$ source ./obj-build-mer-qt-xr/rpm-shared.env
$ make -j1 -C ./obj-build-mer-qt-xr/mobile/sailfishos
Now I'm going to check direc85's gcc patch. Here's the series of commands I'm using to check it (the long one at the end has been copied from the output of the build process; there's no way I could have come up with that myself!). Sorry for the long command but, well, that's not my fault, it's just what I have to work with!
$ sfdk engine exec
$ sb2 -R -m sdk-install -t SailfishOS-devel-aarch64.default
$ cd ./gecko-dev/gfx/wr/swgl/
$ /usr/bin/g++ -O2 -ffunction-sections -fdata-sections -fPIC -std=gnu++17 \
  -I../../../../obj-build-mer-qt-xr/dist/stl_wrappers \
  -I../../../../obj-build-mer-qt-xr/dist/system_wrappers \
  -include ../../../../gecko-dev/config/gcc_hidden.h -U_FORTIFY_SOURCE \
  -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 \
  -I../../../../gecko-dev/toolkit/library/rust \
  -I../../../../obj-build-mer-qt-xr/toolkit/library/rust \
  -I../../../../obj-build-mer-qt-xr/dist/include -I/usr/include/nspr4 \
  -I/usr/include/nss3 -I/usr/include/nspr4 \
  -I../../../../obj-build-mer-qt-xr/dist/include/nss -I/usr/include/pixman-1 \
  -DMOZILLA_CLIENT -include ../../../../obj-build-mer-qt-xr/mozilla-config.h \
  -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare \
  -Wtype-limits -Wunreachable-code -Wno-invalid-offsetof -Wduplicated-cond \
  -Wimplicit-fallthrough -Wno-error=maybe-uninitialized \
  -Wno-error=deprecated-declarations -Wno-error=array-bounds \
  -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object \
  -Wno-multistatement-macros -Wno-error=class-memaccess \
  -Wno-error=unused-but-set-variable -Wformat -Wformat-overflow=2 -Wno-psabi \
  -fno-sized-deallocation -fno-aligned-new -O3 -I/usr/include/freetype2 \
  -DUSE_ANDROID_OMTC_HACKS=1 -DUSE_OZONE=1 -DMOZ_UA_OS_AGNOSTIC=1 -Wno-psabi \
  -Wno-attributes -Wno-psabi -Wno-attributes -Wno-psabi -Wno-attributes \
  -Wno-psabi -Wno-attributes -Wno-psabi -Wno-attributes -Wno-psabi \
  -Wno-attributes -fno-exceptions -fno-strict-aliasing -fPIC \
  -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread \
  -pipe -gdwarf-4 -freorder-blocks -O2 -fno-omit-frame-pointer -funwind-tables \
  -DMOZILLA_CONFIG_H -I ../../../../gecko-dev/gfx/wr/webrender/res -I src \
  -I ../../../../obj-build-mer-qt-xr/aarch64-unknown-linux-gnu/release/build/swgl-c7fddee6f1578b80/out \
  -std=c++17 -fno-exceptions -fno-rtti -fno-math-errno -UMOZILLA_CONFIG_H \
  -D_GLIBCXX_USE_CXX11_ABI=0 \
  -o ../../../../obj-build-mer-qt-xr/aarch64-unknown-linux-gnu/release/build/swgl-c7fddee6f1578b80/out/src/gl.o \
  -c src/gl.cc
Notice that we have a couple of -O2 flags and also an -O3 in there. I'm not sure which one will take precedence, but it'll definitely be picking one or the other and performing optimisation during the compilation as a result.

It takes a couple of minutes to run because even though it's a single source file it's still quite a big compilation job. The output from running this is the following.
during RTL pass: expand
src/glsl.h: In function ‘glsl::vec2_scalar glsl::sign(glsl::vec2_scalar)’:
src/glsl.h:662:39: internal compiler error: Segmentation fault
 float sign(float a) { return copysignf(1.0f, a); }
                              ~~~~~~~~~^~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://git.sailfishos.org/> for instructions.
This is good: it's an error, but it's also the error we're expecting. Nothing has changed since we last looked at this on Day 12. Recall that the way we 'fixed' this in our build process was to change the optimisation level. Since then direc85 has built a copy of gcc that cherry-picks an upstream patch to try to fix the cause of the error in the version of gcc we're using. So the question is: does it fix it?

To do the test I'm going to create a new snapshot of my build target so that I don't mess up the one I'm using. I'll then install direc85's patched version of gcc, run the compile command again and see whether the error is still generated.

Deep breath. Here goes!
$ # First set up the new target snapshot
$
$ sfdk config --session --push snapshot test
$ sfdk config
# ---- command scope ---------
# 

# ---- session scope ---------
snapshot = test

# ---- global scope ---------
output-prefix = /home/flypig/RPMS
target = SailfishOS-devel-aarch64
device = kolbe
$
$ # Now Perform a build to ensure the snapshot is set up correctly
$
$ sfdk build -d --with git_workaround
That sets up the target. Now do our first test run.
$ sfdk engine exec
$ sb2 -R -m sdk-install -t SailfishOS-devel-aarch64.test
$ cd ./gecko-dev/gfx/wr/swgl/
$ /usr/bin/g++ -O2 -ffunction-sections -fdata-sections -fPIC -std=gnu++17 \
  -I../../../../obj-build-mer-qt-xr/dist/stl_wrappers \
  -I../../../../obj-build-mer-qt-xr/dist/system_wrappers \
  -include ../../../../gecko-dev/config/gcc_hidden.h -U_FORTIFY_SOURCE \
  -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 \
  -I../../../../gecko-dev/toolkit/library/rust \
  -I../../../../obj-build-mer-qt-xr/toolkit/library/rust \
  -I../../../../obj-build-mer-qt-xr/dist/include -I/usr/include/nspr4 \
  -I/usr/include/nss3 -I/usr/include/nspr4 \
  -I../../../../obj-build-mer-qt-xr/dist/include/nss -I/usr/include/pixman-1 \
  -DMOZILLA_CLIENT -include ../../../../obj-build-mer-qt-xr/mozilla-config.h \
  -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare \
  -Wtype-limits -Wunreachable-code -Wno-invalid-offsetof -Wduplicated-cond \
  -Wimplicit-fallthrough -Wno-error=maybe-uninitialized \
  -Wno-error=deprecated-declarations -Wno-error=array-bounds \
  -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object \
  -Wno-multistatement-macros -Wno-error=class-memaccess \
  -Wno-error=unused-but-set-variable -Wformat -Wformat-overflow=2 -Wno-psabi \
  -fno-sized-deallocation -fno-aligned-new -O3 -I/usr/include/freetype2 \
  -DUSE_ANDROID_OMTC_HACKS=1 -DUSE_OZONE=1 -DMOZ_UA_OS_AGNOSTIC=1 -Wno-psabi \
  -Wno-attributes -Wno-psabi -Wno-attributes -Wno-psabi -Wno-attributes \
  -Wno-psabi -Wno-attributes -Wno-psabi -Wno-attributes -Wno-psabi \
  -Wno-attributes -fno-exceptions -fno-strict-aliasing -fPIC \
  -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread \
  -pipe -gdwarf-4 -freorder-blocks -O2 -fno-omit-frame-pointer -funwind-tables \
  -DMOZILLA_CONFIG_H -I ../../../../gecko-dev/gfx/wr/webrender/res -I src \
  -I ../../../../obj-build-mer-qt-xr/aarch64-unknown-linux-gnu/release/build/swgl-c7fddee6f1578b80/out \
  -std=c++17 -fno-exceptions -fno-rtti -fno-math-errno -UMOZILLA_CONFIG_H \
  -D_GLIBCXX_USE_CXX11_ABI=0 \
  -o ../../../../obj-build-mer-qt-xr/aarch64-unknown-linux-gnu/release/build/swgl-c7fddee6f1578b80/out/src/gl.o \
  -c src/gl.cc
In file included from src/glsl.h:7,
                 from src/gl.cc:92:
src/vector_type.h: In instantiation of ‘static T glsl::Unaligned::load(const P*) [with P = glsl::VectorType; T = glsl::vec4]’:
src/vector_type.h:532:28:   required from ‘T glsl::unaligned_load(const P*) [with T = glsl::vec4; P = glsl::VectorType]’
src/vector_type.h:543:27:   required from ‘D glsl::bit_cast(const S&) [with D = glsl::vec4; S = glsl::VectorType]’
src/blend.h:53:41:   required from here
src/vector_type.h:503:11: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct glsl::vec4’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(&v, p, sizeof(v));
     ~~~~~~^~~~~~~~~~~~~~~~~~
In file included from src/gl.cc:92:
src/glsl.h:1796:8: note: ‘struct glsl::vec4’ declared here
 struct vec4 {
        ^~~~
during RTL pass: expand
src/glsl.h: In function ‘glsl::vec2_scalar glsl::sign(glsl::vec2_scalar)’:
src/glsl.h:662:39: internal compiler error: Segmentation fault
 float sign(float a) { return copysignf(1.0f, a); }
                              ~~~~~~~~~^~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
The error still appears. Now install the patched gcc.
$ pushd /home/flypig/gcc-packages/
$ zypper install --oldpackage cpp-8.3.0-1.3.1.jolla.aarch64.rpm \
                              gcc-8.3.0-1.3.1.jolla.aarch64.rpm \
                              gcc-c++-8.3.0-1.3.1.jolla.aarch64.rpm \
                              libstdc++-8.3.0-1.3.1.jolla.aarch64.rpm \
                              libgomp-8.3.0-1.3.1.jolla.aarch64.rpm \
                              libstdc++-devel-8.3.0-1.3.1.jolla.aarch64.rpm
[...]
(7/7) Installing: gcc-c++-8.3.0-1.3.1.jolla.aarch64 ......................[done]
$ popd
And now finally run the compile step again to see if we get the same error.
$ /usr/bin/g++ -O2 -ffunction-sections -fdata-sections -fPIC -std=gnu++17 \
  -I../../../../obj-build-mer-qt-xr/dist/stl_wrappers \
  -I../../../../obj-build-mer-qt-xr/dist/system_wrappers \
  -include ../../../../gecko-dev/config/gcc_hidden.h -U_FORTIFY_SOURCE \
  -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 \
  -I../../../../gecko-dev/toolkit/library/rust \
  -I../../../../obj-build-mer-qt-xr/toolkit/library/rust \
  -I../../../../obj-build-mer-qt-xr/dist/include -I/usr/include/nspr4 \
  -I/usr/include/nss3 -I/usr/include/nspr4 \
  -I../../../../obj-build-mer-qt-xr/dist/include/nss -I/usr/include/pixman-1 \
  -DMOZILLA_CLIENT -include ../../../../obj-build-mer-qt-xr/mozilla-config.h \
  -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare \
  -Wtype-limits -Wunreachable-code -Wno-invalid-offsetof -Wduplicated-cond \
  -Wimplicit-fallthrough -Wno-error=maybe-uninitialized \
  -Wno-error=deprecated-declarations -Wno-error=array-bounds \
  -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object \
  -Wno-multistatement-macros -Wno-error=class-memaccess \
  -Wno-error=unused-but-set-variable -Wformat -Wformat-overflow=2 -Wno-psabi \
  -fno-sized-deallocation -fno-aligned-new -O3 -I/usr/include/freetype2 \
  -DUSE_ANDROID_OMTC_HACKS=1 -DUSE_OZONE=1 -DMOZ_UA_OS_AGNOSTIC=1 -Wno-psabi \
  -Wno-attributes -Wno-psabi -Wno-attributes -Wno-psabi -Wno-attributes \
  -Wno-psabi -Wno-attributes -Wno-psabi -Wno-attributes -Wno-psabi \
  -Wno-attributes -fno-exceptions -fno-strict-aliasing -fPIC \
  -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread \
  -pipe -gdwarf-4 -freorder-blocks -O2 -fno-omit-frame-pointer -funwind-tables \
  -DMOZILLA_CONFIG_H -I ../../../../gecko-dev/gfx/wr/webrender/res -I src \
  -I ../../../../obj-build-mer-qt-xr/aarch64-unknown-linux-gnu/release/build/swgl-c7fddee6f1578b80/out \
  -std=c++17 -fno-exceptions -fno-rtti -fno-math-errno -UMOZILLA_CONFIG_H \
  -D_GLIBCXX_USE_CXX11_ABI=0 \
  -o ../../../../obj-build-mer-qt-xr/aarch64-unknown-linux-gnu/release/build/swgl-c7fddee6f1578b80/out/src/gl.o \
  -c src/gl.cc
In file included from src/glsl.h:7,
                 from src/gl.cc:92:
src/vector_type.h: In instantiation of ‘static T glsl::Unaligned::load(const P*) [with P = glsl::VectorType; T = glsl::vec4]’:
src/vector_type.h:532:28:   required from ‘T glsl::unaligned_load(const P*) [with T = glsl::vec4; P = glsl::VectorType]’
src/vector_type.h:543:27:   required from ‘D glsl::bit_cast(const S&) [with D = glsl::vec4; S = glsl::VectorType]’
src/blend.h:53:41:   required from here
src/vector_type.h:503:11: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct glsl::vec4’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(&v, p, sizeof(v));
     ~~~~~~^~~~~~~~~~~~~~~~~~
In file included from src/gl.cc:92:
src/glsl.h:1796:8: note: ‘struct glsl::vec4’ declared here
 struct vec4 {
        ^~~~
No error! This is great news: it means that direc85's patched gcc has fixed the issue!

Now I just need to revert to my previous configuration so that I'm using my original build target snapshot.
$ sfdk config --session --drop snapshot
$ sfdk config
# ---- command scope ---------
# 

# ---- session scope ---------
# 

# ---- global scope ---------
output-prefix = /home/flypig/RPMS
target = SailfishOS-devel-aarch64
device = kolbe
I'll also need to revert the commit that removed the optimisation from the build, although I may wait for the gcc changes to be merged first.

Check out the thread on the forum to see how this all resolved.

With that all wrapped up in a very positive way, I can now go back to the errors I was working through last night. You may recall that this error was on hold until after I'd committed all of the other fixes I've been working on over the last few days. I find it convenient to bunch up my changes. I then have to unravel them to actually create the individual commits.

The thing is, if I'm applying a patch I really need to have a clean repository: no uncommitted changes. Otherwise, disentangling the patch changes from the other changes is likely to be difficult.

So after several hours of writing commit messages, I'm now ready to fix this error:
In file included from Unified_cpp_mobile_sailfishos2.cpp:29:
${PROJECT}/mobile/sailfishos/utils/WebBrowserChrome.cpp:174:15: error:
no declaration matches ‘nsresult WebBrowserChrome::DestroyBrowserWindow()’
 NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow()
               ^~~~~~~~~~~~~~~~
The solution I determined yesterday was to apply patch 0048: "Revert Bug 1494175 - Remove unimplemented nsIWebBrowserChrome methods". The patch applies without incident:
$ git am ../rpm/0048-Revert-Bug-1494175-Remove-unimplemented-nsIWebBrowse.patch
Applying: Revert "Bug 1494175 - Remove unimplemented nsIWebBrowserChrome methods. r=qdot"
$ git log --oneline -1
cea66a6b7aa0 (HEAD -> FIREFOX_ESR_91_9_X_RELBRANCH_patches) Revert "Bug 1494175 
             - Remove unimplemented nsIWebBrowserChrome methods. r=qdot"
With this change the error isn't showing in the build output. It's quite late now though, and it's been a successful dev session, so time to leave it for another day.

As always, if you want to read my other posts they're available in my full Gecko Dev Diary.

Comments

Uncover Disqus comments