dbsoft / White-Star

White Star web browser
https://dbsoft.org/whitestar.php
Other
9 stars 2 forks source link

Building for macOS PowerPC #2

Open barracuda156 opened 5 months ago

barracuda156 commented 5 months ago

@dbsoft Hi, Brian! @wicknix referred me to your discussion on PaleMoon board, and I am interested to join into the project :)

What is the current status of the build?

P. S. There is also a relevant discussion here, which may be worth taking a look: https://github.com/rmottola/Arctic-Fox/issues/140

dbsoft commented 5 months ago

It builds with GCC 11/12 PowerPC, but it crashes due to missing AutoRelease pool during startup. I plan to work on it when I have some time, but been busy with other stuff. I imported a bunch of stuff from TenFourFox, but not JIT (yet).

Had a bit of trouble tracking down the crash though since the debugger does not give me useful information.

barracuda156 commented 5 months ago

@dbsoft Awesome, let me try that.

Two quick questions:

  1. It builds just from the master branch?
  2. Could you please refer to exact command and mozconfig (if anything local used)? So that I know what to start from.
dbsoft commented 5 months ago

Well I haven't built it in about a month, but the patches that allowed it to compile a month ago were merged into master... so unless something in the past month broke it ... it should still build... The PowerMac is offline right now, I'll boot it up later today (have a busy day today) and I'll post the mozconfig I used.

Edit: Yesterday turned out to be a mess... didn't get around to it... will get it done today instead.

barracuda156 commented 5 months ago

Greatly appreciated, thanks.

UPD. Just ping me here, and I will try running the build.

(Do you use TFF way of building or Arctic Fox way of building? I mean, the initial build command.)

dbsoft commented 5 months ago

This is the mozconfig I am using for testing purposes, I had disabled optiizations and stripping to try and debug it, but that did not really help. It takes like 16 hours to do a full build on my Powermac G5:

# Standard build options for White Star
export CC="/usr/local/bin/gcc -D__powerpc__ -flax-vector-conversions -mcpu=G5 -m32 -falign-loops=32 -falign-functions=32 -falign-labels=32 -falign-jumps=32 -mmfcrf -mpowerpc-gpopt -read_only_relocs suppress -force_cpusubtype_ALL -mdynamic-no-pic"
export CXX="/usr/local/bin/g++ -D__powerpc__ -flax-vector-conversions -fpermissive -mcpu=G5 -m32 -falign-loops=32 -falign-functions=32 -falign-labels=32 -falign-jumps=32 -mmfcrf -mpowerpc-gpopt -read_only_relocs suppress -force_cpusubtype_ALL -mdynamic-no-pic"
export STRIP=/usr/local/bin/strip7
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/
ac_add_options --enable-application=whitestar
ac_add_options --enable-optimize=-O0
#ac_add_options --enable-jemalloc
#ac_add_options --enable-strip
ac_add_options --enable-devtools
#ac_add_options --enable-av1
#ac_add_options --enable-jxl
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-tests
#ac_add_options --enable-debug
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --disable-apple-media
ac_add_options --enable-macos-target=10.5
ac_add_options --with-branding=whitestar/branding/whitestar
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
# Use the following lines for Apple Silicon builds
# ac_add_options --with-macos-sdk=/Path/to/SDKs/MacOSX11.3.sdk
ac_add_options --host=powerpc-apple-darwin
ac_add_options --target=powerpc-apple-darwin

# Uncomment if using clang++ from Xcode 10 or higher
# export CXX="/usr/bin/clang++ -stdlib=libc++"

Using the strip7 that was used for TenFourFox.

Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/powerpc-apple-darwin9.8.0/12.3.0/lto-wrapper
Target: powerpc-apple-darwin9.8.0
Configured with: ./configure --enable-languages=c,c++,objc,obj-c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.3.0 (GCC) 
Python 2.7.18 (default, Nov 10 2022, 03:41:19) 
[GCC Apple LLVM 12.0.0 (clang-1200.0.31.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
./mach clobber
./mach build

I'll need to package up some MacOS 10.5 compatible branding since what I typically use does not work properly on 10.5. (In the meantime you can use the unofficial branding).

Generally speaking the instructions here apply: https://dbsoft.org/whitestar-build-mac.php

With some minor changes... use 10.5 SDK, jemalloc is not supported on 10.5 so disable that... JPEG-XL should theoretically work, but I have it disabled to reduce the build time. Not sure why I have AV1 disabled, might also be to reduce build times. Apple media is not supported on 10.5 so I added an option to disable that.

barracuda156 commented 5 months ago

Thank you very much!

It takes like 16 hours to do a full build on my Powermac G5

Oh wow, that sounds like a lot longer than TenFourFox. Which G5 is that?

use 10.5 SDK, jemalloc is not supported on 10.5 so disable that

I will give it a try against 10.6 first (10A190, not Rosetta). My 10.5 setup is dead at the moment, since I nuked libgcc when trying to fix building of ppc+ppc64 :) jemalloc is principle should be fixable, since on 10.6 ppc it requires a minimal fix (I think merged into upstream already). On 10.5.8 it does not build as is, but if it makes sense, that can be done, I guess.

P. S. It’s great that the modern gcc can be used with it. Resorting to archaic versions was painful with TFF.

dbsoft commented 5 months ago

1.6ghz PowerMac7,2 Since I haven't tested with the 10.6 SDK might be some additional issues with that.

This was the pull where I added the support: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2392

I tried to make sure I put everything in an #ifdef for the appropriate SDK versions, but some I was not absolutely certain about so... it only for sure works on the 10.5 SDK.

barracuda156 commented 5 months ago

@dbsoft I have just moved your unofficial folder to the location the build complained about, hopefully that gonna work. Build has commenced.

barracuda156 commented 5 months ago

Ah yeah, there will be issues with 10.6 SDK:

:info:build 28:35.33 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1507:59: warning: (messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments)
:info:build 28:35.42 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: In member function 'mozilla::LayoutDeviceIntRect nsChildView::RectContainingTitlebarControls()':
:info:build 28:35.42 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:15: error: expected ';' before 'in'
:info:build 28:35.42  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:35.42       |               ^~~
:info:build 28:35.42       |               ;
:info:build 28:35.93 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:16: error: 'in' was not declared in this scope; did you mean 'yn'?
:info:build 28:35.93  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:35.93       |                ^~
:info:build 28:35.93       |                yn
:info:build 28:35.93 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:26: error: expected ']' before 'titlebarControls'
:info:build 28:35.93  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:35.93       |                          ^~~~~~~~~~~~~~~~~
:info:build 28:35.93       |                          ]
:info:build 28:35.94 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:26: error: expected ';' before 'titlebarControls'
:info:build 28:35.94  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:35.94       |                          ^~~~~~~~~~~~~~~~~
:info:build 28:35.94       |                          ;
:info:build 28:36.96 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:27: error: 'titlebarControls' was not declared in this scope; did you mean 'IdleControls'?
:info:build 28:36.96  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:36.96       |                           ^~~~~~~~~~~~~~~~
:info:build 28:36.96       |                           IdleControls
:info:build 28:36.96 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:43: error: expected ')' before ']' token
:info:build 28:36.96  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:36.96       |       ~                                   ^
:info:build 28:36.96       |                                           )
:info:build 28:36.96 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:43: error: expected primary-expression before ']' token
:info:build 28:36.96 Warning: -Wunused-variable in /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: unused variable 'view'
:info:build 28:36.96 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:1932:11: warning: unused variable 'view' [-Wunused-variable]
:info:build 28:36.96  1932 |   for (id view in [window titlebarControls]) {
:info:build 28:36.96       |           ^~~~
:info:build 28:38.34 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: In member function 'void nsChildView::UpdateTitlebarCGContext()':
:info:build 28:38.34 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:2274:46: error: 'NSWindowFullScreenButton' was not declared in this scope; did you mean 'SetShowsFullScreenButton'?
:info:build 28:38.34  2274 |         view == [window standardWindowButton:NSWindowFullScreenButton]) {
:info:build 28:38.34       |                                              ^~~~~~~~~~~~~~~~~~~~~~~~
:info:build 28:38.34       |                                              SetShowsFullScreenButton
:info:build 28:38.41 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: In member function 'virtual void nsChildView::UpdateWindowDraggingRegion(const nsIWidget::LayoutDeviceIntRegion&)':
:info:build 28:38.42 Warning: -Wunused-value in /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: left operand of comma operator has no effect
:info:build 28:38.42 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:2781:47: warning: left operand of comma operator has no effect [-Wunused-value]
:info:build 28:38.43  2781 |   ManipulateViewWithoutNeedingDisplay(mView, [this, nonDraggable, &changed]() {
:info:build 28:38.43       |                                               ^~~~
:info:build 28:38.43 Warning: -Wunused-value in /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: right operand of comma operator has no effect
:info:build 28:38.43 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:2781:68: warning: right operand of comma operator has no effect [-Wunused-value]
:info:build 28:38.44  2781 |   ManipulateViewWithoutNeedingDisplay(mView, [this, nonDraggable, &changed]() {
:info:build 28:38.44       |                                                                    ^~~~~~~
:info:build 28:38.52 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: In function '-[ChildView viewDidChangeBackingProperties]':
:info:build 28:38.52 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:3543:40: warning: 'NSView' may not respond to '-viewDidChangeBackingProperties'
:info:build 28:38.52  3543 |   [super viewDidChangeBackingProperties];
:info:build 28:38.53       |                                        ^
:info:build 28:38.58 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm: In function '-[ChildView shouldConsiderStartingSwipeFromEvent:]':
:info:build 28:38.58 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:4237:55: warning: 'NSEvent' may not respond to '+isSwipeTrackingFromScrollEventsEnabled'
:info:build 28:38.58  4237 |   if (![NSEvent isSwipeTrackingFromScrollEventsEnabled]) {
:info:build 28:38.58       |                                                       ^
:info:build 28:38.58 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:4247:42: warning: 'NSEvent' may not respond to '-hasPreciseScrollingDeltas'
:info:build 28:38.58  4247 |       ![anEvent hasPreciseScrollingDeltas]) {
:info:build 28:38.59       |                                          ^
:info:build 28:38.59 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:4257:44: warning: 'NSEvent' may not respond to '-scrollingDeltaX'
:info:build 28:38.59  4257 |   CGFloat deltaX = [anEvent scrollingDeltaX];
:info:build 28:38.59       |                                            ^
:info:build 28:38.60 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:4257:20: error: cannot convert 'objc_object*' to 'CGFloat' {aka 'float'} in initialization
:info:build 28:38.60  4257 |   CGFloat deltaX = [anEvent scrollingDeltaX];
:info:build 28:38.60       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 28:38.60       |                    |
:info:build 28:38.60       |                    objc_object*
:info:build 28:38.60 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:4258:44: warning: 'NSEvent' may not respond to '-scrollingDeltaY'
:info:build 28:38.60  4258 |   CGFloat deltaY = [anEvent scrollingDeltaY];
:info:build 28:38.60       |                                            ^
:info:build 28:38.61 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/widget/cocoa/nsChildView.mm:4258:20: error: cannot convert 'objc_object*' to 'CGFloat' {aka 'float'} in initialization
:info:build 28:38.61  4258 |   CGFloat deltaY = [anEvent scrollingDeltaY];
:info:build 28:38.61       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 28:38.61       |                    |
:info:build 28:38.61       |                    objc_object*

I think it will be pretty much the same sequence of errors which I began fixing for Arctic Fox, more or less.

Perhaps I can build against 10.5.8 SDK, which should bypass a need for per-case fixups, but as we know, that should produce a dead binary :)

barracuda156 commented 5 months ago

I tried to make sure I put everything in an #ifdef for the appropriate SDK versions, but some I was not absolutely certain about so... it only for sure works on the 10.5 SDK.

To be honest, I think literally nobody is certain here, since no 10.6 SDK is “standard” for PowerPC, including the released 10.6.8 with Rosetta, and of course those early developer ones which still supported PPC natively.

To get a “standard” 10.6 on PowerPC, we will have to rebuild the system from sources, or at least those components which lack ppc slices in 10.6.8. I am not sure all needed sources are even available and whether something meaningful can be achieved with what we got. To make things worse, there is no documentation, AFAIK, which would describe the procedure, and existing info here-and-there is inaccurate or incomplete. And Darwinbuild is broken.

At the same time potentially even a handicapped 10.6 is better (on 32-bit) than any 10.5, and some stuff works there which does not on the latter.

barracuda156 commented 5 months ago
:info:build 100:52.87 In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/vm/Caches.h:14,
:info:build 100:52.87                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jscntxt.h:18,
:info:build 100:52.87                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/vm/RegExpObject.h:12,
:info:build 100:52.87                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/builtin/RegExp.h:9,
:info:build 100:52.87                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jscompartment.h:16,
:info:build 100:52.87                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jsweakmap.h:12,
:info:build 100:52.87                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/builtin/TypedObject.h:10,
:info:build 100:52.88                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/builtin/BigInt.cpp:10:
:info:build 100:52.88 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jsscript.h:2415:53: error: static assertion failed: Size of LazyScript must be an integral multiple of js::gc::CellSize
:info:build 100:52.88  2415 | static_assert(sizeof(LazyScript) % js::gc::CellSize == 0,
:info:build 100:52.88       |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
:info:build 100:52.88 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jsscript.h:2415:53: note: the comparison reduces to '(4 == 0)'
:info:build 100:52.99 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:53.15 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/security/nss/lib/freebl/gcm.c: In function 'gcmHash_Reset':
:info:build 100:53.15 Warning: -Wtype-limits in /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/security/nss/lib/freebl/gcm.c: comparison is always false due to limited range of data type
:info:build 100:53.15 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/security/nss/lib/freebl/gcm.c:494:39: warning: comparison is always false due to limited range of data type [-Wtype-limits]
:info:build 100:53.15   494 |     if (sizeof(AADLen) >= 8 && AADLen > (1ULL << 61) - 1) {
:info:build 100:53.15       |                                       ^
:info:build 100:53.91 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:54.38 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:55.02 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:55.44 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:56.09 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:56.70 cc1: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
:info:build 100:56.84 In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/vm/Caches.h:14,
:info:build 100:56.84                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jscntxt.h:18,
:info:build 100:56.85                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/vm/RegExpObject.h:12,
:info:build 100:56.85                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/builtin/RegExp.h:9,
:info:build 100:56.86                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/builtin/RegExp.cpp:6:
:info:build 100:56.86 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jsscript.h:2415:53: error: static assertion failed: Size of LazyScript must be an integral multiple of js::gc::CellSize
:info:build 100:56.86  2415 | static_assert(sizeof(LazyScript) % js::gc::CellSize == 0,
:info:build 100:56.86       |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
:info:build 100:56.86 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/js/src/jsscript.h:2415:53: note: the comparison reduces to '(4 == 0)'

The comment to the code:

/* If this fails, add/remove padding within LazyScript. */
static_assert(sizeof(LazyScript) % js::gc::CellSize == 0,
              "Size of LazyScript must be an integral multiple of js::gc::CellSize");

Sure enough, padding is wrong.

barracuda156 commented 5 months ago

What is interesting is that the referred chunk specifically excludes Darwin ppc here:

    // Add padding so LazyScript is gc::Cell aligned. Make padding protected
    // instead of private to suppress -Wunused-private-field compiler warnings.
  protected:
#if JS_BITS_PER_WORD == 32 && !(defined(XP_DARWIN) && defined(__ppc__))
    uint32_t padding;
#endif

Possibly, it was added as a hack around a bug in GCC related to structure packing. The bug has been fixed in gcc13, as I recall. Which would explain why it did not fail for you with gcc12.

Resumed the build after removing ppc clause, let's see how far it proceeds.

barracuda156 commented 5 months ago

So apparently indeed, that assumption is wrong for gcc13, the build went a bit further, but then failed on this:

:info:build 15:05.12 Undefined symbols:
:info:build 15:05.12   "_load_aligned_float", referenced from:
:info:build 15:05.12       _qcms_transform_data_rgb_out_lut_altivec in transform-altivec.o
:info:build 15:05.12       _qcms_transform_data_rgb_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgb_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgb_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgb_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgb_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgba_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgba_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgba_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgba_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgba_out_lut_altivec in transform-altivec.o
:info:build 15:05.13       _qcms_transform_data_rgba_out_lut_altivec in transform-altivec.o
:info:build 15:05.13 ld: symbol(s) not found
:info:build 15:05.13 collect2: error: ld returned 1 exit status

I guess, this is the fix:

--- firefox-60.0/gfx/qcms/transform-altivec.c.debug 2018-05-15 09:26:43.603043100 +0200
+++ firefox-60.0/gfx/qcms/transform-altivec.c   2018-05-15 09:28:57.302385632 +0200
@@ -30,7 +30,7 @@
 static const ALIGN float floatScaleX4 = FLOATSCALE;
 static const ALIGN float clampMaxValueX4 = CLAMPMAXVAL;

-inline vector float load_aligned_float(float *dataPtr)
+static vector float load_aligned_float(float *dataPtr)
 {
    vector float data = vec_lde(0, dataPtr);
    vector unsigned char moveToStart = vec_lvsl(0, dataPtr);
barracuda156 commented 5 months ago

And it claims to have succeeded:

 2:20.00 ld(26867) malloc: *** mmap(size=252325888) failed (error code=12)
 2:20.00 *** error: can't allocate region
 2:20.00 *** set a breakpoint in malloc_error_break to debug
 2:20.47 cc1plus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
 2:20.54 cc1plus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
 2:20.54 cc1plus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
 2:20.56 cc1objplus: warning: command-line option '-Wignored-qualifiers' is valid for C/C++ but not for ObjC++
 2:20.56 cc1objplus: warning: '-mdynamic-no-pic' overrides '-fpic', '-fPIC', '-fpie' or '-fPIE'
 2:24.58 plugin-container
 2:24.95 libbrowsercomps.dylib
 2:24.98 xpcshell
 2:31.29 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/forgetaboutsite/ForgetAboutSite.jsm: WARNING: no preprocessor directives found
 2:33.13 dependentlibs.list
 2:33.58 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/whitestar/branding/whitestar/pref/palemoon-branding.js: WARNING: no preprocessor directives found
 3:18.90 Packaging quitter@mozilla.org.xpi...
 3:22.28 782 compiler warnings present.
 3:23.04 Your build was successful!

Checking for un-preprocessed files... Done!
To view resource usage of the build, run |mach resource-usage|.
To take your build for a test drive, run: |mach run|
barracuda156 commented 5 months ago

It did produce something which looks like an app, but:

  1. Directly it does not want to start, complaining about macOS version. Perhaps just wrong settings somewhere, for example Info.plist has obvious nonsense:
    <key>LSMinimumSystemVersion</key>
    <string>10.7</string>
    <key>LSMinimumSystemVersionByArchitecture</key>
    <dict>
        <key>i386</key>
        <string>10.7.0</string>
        <key>x86_64</key>
        <string>10.7.0</string>
    </dict>
  2. Binary whitestar, if launched from the terminal, does not crash but does not do anything either at the moment, it just loads the CPU indefinitely.
barracuda156 commented 5 months ago

There is some issue with stripping, and it is something I expected on 10.6:

20:30.39 strip: bad n_sect for symbol table entry 2799802 in: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/dist/whitestar/Browser.app/Contents/MacOS/XUL
20:30.45 Traceback (most recent call last):
20:30.45   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.py", line 423, in <module>
20:30.45     main()
20:30.45   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.py", line 419, in main
20:30.45     copier.copy(args.destination)
20:30.45   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/copier.py", line 399, in copy
20:30.45     copy_results.append((destfile, f.copy(destfile, skip_if_older)))
20:30.45   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/files.py", line 274, in copy
20:30.46     strip(dest)
20:30.46   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/executables.py", line 99, in strip
20:30.46     errors.fatal('Error executing ' + ' '.join(cmd))
20:30.46   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/errors.py", line 103, in fatal
20:30.46     self._handle(self.FATAL, msg)
20:30.46   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/errors.py", line 98, in _handle
20:30.46     raise ErrorMessage(msg)
20:30.46 mozpack.errors.ErrorMessage: Error: Error executing strip -x -S ../../dist/whitestar/Browser.app/Contents/MacOS/XUL
20:30.60 gmake[3]: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.mk:41: stage-package] Error 1
20:30.60 gmake[3]: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/whitestar/installer'
20:30.60 gmake[2]: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.mk:82: make-package] Error 2
20:30.60 gmake[2]: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/whitestar/installer'
20:30.60 gmake[1]: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager-uxp.mk:14: make-archive] Error 2
20:30.60 gmake[1]: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/whitestar/installer'
20:30.60 gmake: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/../whitestar/build.mk:9: package] Error 2

This is with a regular strip, but as I recall, strip7 also failed for me. With TFF I just use nostrip configs.

dbsoft commented 5 months ago

Possibly, it was added as a hack around a bug in GCC related to structure packing. The bug has been fixed in gcc13, as I recall. Which would explain why it did not fail for you with gcc12.

I was confused why I needed it... to get it to build with GCC 12.3 if it is in fact a packing bug that would explain it... just remove that one.

I thought I changed the Info.plist to be 10.5 in my White Star repository... but I guess it is something I didn't actually commit:

diff --git a/whitestar/app/macbuild/Contents/Info.plist.in b/whitestar/app/macbuild/Contents/Info.plist.in
index 34aefd4..829f4e8 100644
--- a/whitestar/app/macbuild/Contents/Info.plist.in
+++ b/whitestar/app/macbuild/Contents/Info.plist.in
@@ -213,13 +213,15 @@
                <string>0</string>
        </dict>
        <key>LSMinimumSystemVersion</key>
-       <string>10.7</string>
+       <string>10.5</string>
        <key>LSMinimumSystemVersionByArchitecture</key>
        <dict>
                <key>i386</key>
                <string>10.7.0</string>
                <key>x86_64</key>
                <string>10.7.0</string>
+               <key>ppc</key>
+               <string>10.5.0</string>
        </dict>
        <key>NSSupportsAutomaticGraphicsSwitching</key>
        <true/>
barracuda156 commented 5 months ago

@dbsoft For the reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110044 (I am not sure it is related, but it looks it may be).

barracuda156 commented 5 months ago

Rebuilt again, no errors during the build (two patches applies), strip fails with strip7:

20:28.90 /opt/local/bin/strip7: ignoring n_sect == 0 for symbol table entry 2799802 in: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/dist/whitestar/Browser.app/Contents/MacOS/XUL
20:36.63 Traceback (most recent call last):
20:36.64   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.py", line 423, in <module>
20:36.64     main()
20:36.64   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.py", line 419, in main
20:36.64     copier.copy(args.destination)
20:36.64   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/copier.py", line 399, in copy
20:36.64     copy_results.append((destfile, f.copy(destfile, skip_if_older)))
20:36.64   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/files.py", line 274, in copy
20:36.64     strip(dest)
20:36.64   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/executables.py", line 99, in strip
20:36.64     errors.fatal('Error executing ' + ' '.join(cmd))
20:36.64   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/errors.py", line 103, in fatal
20:36.64     self._handle(self.FATAL, msg)
20:36.65   File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/python/mozbuild/mozpack/errors.py", line 98, in _handle
20:36.65     raise ErrorMessage(msg)
20:36.65 mozpack.errors.ErrorMessage: Error: Error executing /opt/local/bin/strip7 -x -S ../../dist/whitestar/Browser.app/Contents/MacOS/XUL
20:36.79 gmake[3]: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.mk:41: stage-package] Error 1
20:36.79 gmake[3]: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/whitestar/installer'
20:36.79 gmake[2]: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager.mk:82: make-package] Error 2
20:36.80 gmake[2]: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/whitestar/installer'
20:36.80 gmake[1]: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/toolkit/mozapps/installer/packager-uxp.mk:14: make-archive] Error 2
20:36.80 gmake[1]: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/whitestar/installer'
20:36.80 gmake: *** [/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/platform/../whitestar/build.mk:9: package] Error 2
20:36.80 gmake: Leaving directory '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin'
Command failed: ./mach package
Exit code: 2
barracuda156 commented 5 months ago

Okay, I got your result, I guess. It starts now after fixing plists, but freezes really badly: browser

dbsoft commented 5 months ago

Well yours might actually dong slightly better than mine, since mine aborts due to a missing AutoRelease pool....but we are clearly at a similar place... building but something isn't quite right.... going to need some debugging, but I have just been busy with other things. So this experiment has been on the back burner.... I'll try to build a GCC with the packing patch and see if I can get it to where yours is.... but this is going to be slow going on my end.

barracuda156 commented 5 months ago

Well yours might actually dong slightly better than mine, since mine aborts due to a missing AutoRelease pool....but we are clearly at a similar place... building but something isn't quite right.... going to need some debugging, but I have just been busy with other things. So this experiment has been on the back burner.... I'll try to build a GCC with the packing patch and see if I can get it to where yours is.... but this is going to be slow going on my end.

I can share portfiles if it makes life a bit easier.

A sensible thing to try would be building the browser for ppc64 (I briefly looked into the source, and ppc64 is not even accounted for, but after fixing some macros, it may help to avoid at least some failures. Or if It fails identically, then we know it is not 32-bitness breaking our browser.) Unfortunately build FAT is defunct in Macports, and I need to rebuild everything for ppc64 on Leopard, and everything is quite a lot, LOL.

dbsoft commented 5 months ago

Well I'd accept the port file, but I might just apply the patch to my tree so I don't have to wait for a full rebuild of GCC.

barracuda156 commented 5 months ago

@dbsoft Ah yeah, if it is set up this way, it certainly makes sense.

P. S. By the way, if you do not already, use Iain’s branches for PowerPC.

barracuda156 commented 5 months ago
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
warning: Bad symbol - type is N_SECT but section is 0
........................ done
Reading symbols for shared libraries . done
2024-01-21 10:22:06.816 whitestar[8288:c13] *** __NSAutoreleaseNoPool(): Object 0x60303f0 of class NSCFDictionary autoreleased with no pool in place - just leaking
2024-01-21 10:22:06.818 whitestar[8288:c13] *** __NSAutoreleaseNoPool(): Object 0x602fac0 of class NSCFArray autoreleased with no pool in place - just leaking
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
2024-01-21 10:22:08.580 whitestar[8288:c13] *** __NSAutoreleaseNoPool(): Object 0x176b55e0 of class NSCFString autoreleased with no pool in place - just leaking
2024-01-21 10:22:08.581 whitestar[8288:c13] *** __NSAutoreleaseNoPool(): Object 0x176f1720 of class NSURL autoreleased with no pool in place - just leaking
2024-01-21 10:22:08.584 whitestar[8288:c13] *** __NSAutoreleaseNoPool(): Object 0x6019a00 of class NSCFLocale autoreleased with no pool in place - just leaking
2024-01-21 10:22:08.585 whitestar[8288:c13] *** __NSAutoreleaseNoPool(): Object 0x176f8330 of class NSCFData autoreleased with no pool in place - just leaking
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Die: DW_TAG_unspecified_type (abbrev = 219, offset = 1661)
    has children: FALSE
    attributes:
        DW_AT_name (DW_FORM_string) string: "decltype(nullptr)"
warning: Got an error handling event: "Dwarf Error: Cannot find type of die [in module /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_white-star/white-star/work/White-Star-c293f6082e0b39a55cd66784a4aa4aea7de0bcac/obj-powerpc-apple-darwin/toolkit/library/XUL]".

Looks like autorelease has just a wrong syntax.

Dwarf error is something which feels vaguely familiar, but I can't recall immediately where I saw it.

barracuda156 commented 5 months ago

strip7 crash (AFAIK did not work with TFF either):

Process:         strip7 [62683]
Path:            /opt/local/bin/strip7
Identifier:      strip7
Version:         ??? (???)
Code Type:       PPC (Native)
Parent Process:  python [58258]

Date/Time:       2024-01-21 09:21:19.092 +0800
OS Version:      Mac OS X 10.6 (10A190)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000038
Crashed Thread:  0

Thread 0 Crashed:
0   strip7                          0x000042bc strip_object + 3088
1   strip7                          0x00008958 strip_file + 1476
2   strip7                          0x00009748 main + 2504
3   strip7                          0x00002488 start + 64
4   ???                             0xbffff1c8 0 + 3221221832

Thread 0 crashed with PPC Thread State 32:
  srr0: 0x000042bc  srr1: 0x0000d030   dar: 0x00000038 dsisr: 0x40000000
    r0: 0x000042b0    r1: 0xbfffe8b0    r2: 0x005006a0    r3: 0x0000000a
    r4: 0x00000000    r5: 0x00000001    r6: 0x80808080    r7: 0x00000001
    r8: 0x0000000a    r9: 0x00000000   r10: 0x00425823   r11: 0x0041e6c4
   r12: 0x0029bcc8   r13: 0x000336b8   r14: 0x005006a0   r15: 0x00000a1b
   r16: 0x101512e4   r17: 0x00000000   r18: 0x02ab8ba0   r19: 0x00500580
   r20: 0x002ab8ba   r21: 0x00aae2e8   r22: 0x0200a8b8   r23: 0x00000000
   r24: 0x0000001e   r25: 0x02f7aa9d   r26: 0x00118085   r27: 0x0000000e
   r28: 0x00000000   r29: 0x00000000   r30: 0x0000000f   r31: 0x000036b8
    cr: 0x42244002   xer: 0x00000000    lr: 0x000042b0   ctr: 0x0029bcc8
vrsave: 0x00000000

Binary Images:
    0x1000 -    0x37fff +strip7 ??? (???) <d777618356ae6ecf24737b70842a09d8> /opt/local/bin/strip7
   0x42000 -    0x4dfff  libgcc_s.1.dylib ??? (???) <1eb48ae6b07dcb096bda0433409722c1> /usr/lib/libgcc_s.1.dylib
   0x52000 -    0x57ff6  libmathCommon.A.dylib ??? (???) <e166c8e59a80a82b4504b1dd43d1f50a> /usr/lib/system/libmathCommon.A.dylib
   0xb4000 -   0x11effb  libstdc++.6.dylib ??? (???) <5824de0c43054a01c556e9ef288f33c7> /usr/lib/libstdc++.6.dylib
  0x252000 -   0x41cfe7  libSystem.B.dylib ??? (???) <420b38fe0fa0944f6f5bc4840bf29a4e> /usr/lib/libSystem.B.dylib
0x8fe00000 - 0x8fe31143  dyld 113.0 (???) <ee555e655e1cf66cac80728801add419> /usr/lib/dyld
0xffff8000 - 0xffff9703  libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib
dbsoft commented 5 months ago

Very strange, never seen that before...

If you are having issues with stripping... you can add these options: --disable-install-strip and --disable-strip

Probably will trigger a rebuild though. :(

barracuda156 commented 5 months ago

Yeah, I remembered about install-strip, after the second rebuild was complete, and quite pointlessly it indeed triggers the rebuild even if mozconfig is edited directly (and portfile untouched), so I left it at that until tomorrow. Anyway it is worth looking through the code to see what is going wrong and hopefully fix it for 10.6 SDK.

Could you confirm if AltiVec fix is at least harmless on your setup?

barracuda156 commented 5 months ago

I do not recall any issues with strip aside of Mozilla-based browsers, no idea what is so special about them which a) justifies having a dedicated hacked version of strip incompatible with anything else and b) causes stripping to fail on 10.6. In any case, this is the least of our problems here :)

dbsoft commented 5 months ago

Could you confirm if AltiVec fix is at least harmless on your setup?

Not sure what you mean by this?

barracuda156 commented 5 months ago

Could you confirm if AltiVec fix is at least harmless on your setup?

Not sure what you mean by this?

See https://github.com/dbsoft/White-Star/issues/2#issuecomment-1902256322 above.

Existing code fails to link without this patch, and apparently not just for me.

dbsoft commented 5 months ago

Existing code fails to link without this patch, and apparently not just for me.

I didn't need that patch with GCC 12.3, but I'll apply it and try a build here.

Edit: I checked my compiler source and it indeed was missing that packing patch. I applied it and let it do an updated build with the fix.

I committed the Info.plist.in change to the White-Star repository... I removed the workaround I did for the packing and applied the altivec patch .... although I still have not found where you located that patch yet.

Starting a clean build, will see what happens in 8-16 hours when it finishes.

dbsoft commented 5 months ago

Also just wanted to comment on your PowerPC64 suggestion... that is a way bigger thing than you are probably thinking. Since Mozilla never supported PowerPC64 on Mac... you'd need to create the 64-bit versions of these from scratch:

https://xref.palemoon.org/goanna-central/source/platform/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_rhapsody.s https://xref.palemoon.org/goanna-central/source/platform/xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_rhapsody.cpp https://xref.palemoon.org/goanna-central/source/platform/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_darwin.s.m4

You might be able to use the Linux version as a guide, but it is not going to be straight-forward.

barracuda156 commented 5 months ago

@dbsoft If it is just these assembler files, should be fairly trivial from the looks of things. I can fix instructions and offsets, and then it is just a matter of “try and see“. Thankfully, this is no esoteric software: if it does not work, we gonna know it.

I recall TFF developer said that he did not make it for ppc64 due to would be required JIT rewrite, but we got no JIT here for ppc anyway, do we?

barracuda156 commented 5 months ago

@dbsoft For the AltiVec: I get the linking error, googled for the line of code failing, found some Linux patching exactly that. Assumed this is not just my issue but a credible bug. I can find the page, when I am back on the machine.

dbsoft commented 5 months ago

@dbsoft If it is just these assembler files, should be fairly trivial from the looks of things. I can fix instructions and offsets, and then it is just a matter of “try and see“. Thankfully, this is no esoteric software: if it does not work, we gonna know it.

I mean, if you want to try go ahead, I just think it is just going to be a lot more work than you are thinking. It isn't just fixing some macros as you stated.

I recall TFF developer said that he did not make it for ppc64 due to would be required JIT rewrite, but we got no JIT here for ppc anyway, do we?

There is no JIT, there is also no JIT for ARM64... which is the next big thing on my TODO list. I was planning on trying to port over the PPC32 JIT from TenFourFox while doing ARM64 if I can get it working before hand.

barracuda156 commented 5 months ago

@dbsoft Having JIT ported would be amazing. (Have you seen a fork of Arctic Fox which apparently did that? Not sure how usable it is though.)

For ppc64, I did not mean that fixing macros will be sufficient, and we do not have this working on ppc32 yet anyway. It was just odd to see that even basic macros are wrong, and those are pulled in from sqlite, rapidjson etc. (and sure enough, still wrong with current upstreams of those).

barracuda156 commented 5 months ago

By the way, if you gonna rebuild the browser, I would drop -mpcu in favor of -mtune. The former may produce incorrect code (or may not, but it is not a safe flag).

dbsoft commented 5 months ago

By the way, if you gonna rebuild the browser, I would drop -mpcu in favor of -mtune. The former may produce incorrect code (or may not, but it is not a safe flag).

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html

They do different things... you would know better if it is buggy or not but -mcpu is what I want in this case... bugs not withstanding.

barracuda156 commented 5 months ago

They do, but -mcpu may produce the code which will not work.

Just remembered about GCC bug, though unlikely helpful in this particular case, but Iain just fixed this a few days ago: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105522

dbsoft commented 5 months ago

They do, but -mcpu may produce the code which will not work.

In what cases though? Any non-baseline target CPU?

Just remembered about GCC bug, though unlikely helpful in this particular case, but Iain just fixed this a few days ago: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105522

That is definitely an interesting bug, and very good to have fixed... I have run into an ICE at higher optimization levels: create_component_ref_by_pieces_1 at tree_ssa_pre.cc:2609

Any idea if that one has been fixed in newer compilers?

barracuda156 commented 5 months ago

They do, but -mcpu may produce the code which will not work.

In what cases though? Any non-baseline target CPU?

See: https://github.com/OpenMathLib/OpenBLAS/issues/4376

I have run into an ICE at higher optimization levels: create_component_ref_by_pieces_1 at tree_ssa_pre.cc:2609

Perhaps file a bug to https://gcc.gnu.org/bugzilla – see this: https://github.com/iains/darwin-toolchains-start-here/discussions/10#discussioncomment-1969305 And perhaps tag Iain in the ticket.

dbsoft commented 5 months ago

Build completed with the packing patched GCC... and removal of the workaround. The altivec patch seemingly had no adverse effects.

727:56.47 libicudata.a.desc
728:26.17 /Users/nuke/work/palemoon/White-Star/platform/toolkit/forgetaboutsite/ForgetAboutSite.jsm: WARNING: no preprocessor directives found
728:37.83 dependentlibs.list
729:49.79 Packaging quitter@mozilla.org.xpi...
729:56.55 1535 compiler warnings present.
837:26.69 Overall system resources - Wall time: 43803s; CPU: 100%; Read bytes: 975827968; Write bytes: 5898099712; Read time: 15685; Write time: 278656
837:26.96 Swap in/out (MB): 317/0
838:06.35 Notification center failed: Install terminal-notifier to get a notification when the build finishes.
838:06.35 We know it took a while, but your build finally finished successfully!
To view resource usage of the build, run |mach resource-usage|.

See: https://github.com/OpenMathLib/OpenBLAS/issues/4376

Looks like there is a bug when picking a 64bit CPU as the target but building 32bit. Definitely shouldn't be using 64bit instructions when in 32bit mode. I guess I can pick -mcpu=G4 and -mtune=G5 to workaround that until the bug is fixed.

barracuda156 commented 5 months ago

Build completed with the packing patched GCC... and removal of the workaround. The altivec patch seemingly had no adverse effects.

Great to hear! What do you think, should we just drop the hack for packing?

I thought to submit this (among other fix-ups), but maybe we rather remove it completely and expect a user to have up-to-date GCC: https://repo.palemoon.org/barracuda156/UXP/commit/4abdfcd90daa681dc48d672e7ea4f1e874d4bf72

See: OpenMathLib/OpenBLAS#4376

Looks like there is a bug when picking a 64bit CPU as the target but building 32bit. Definitely shouldn't be using 64bit instructions when in 32bit mode. I guess I can pick -mcpu=G4 and -mtune=G5 to workaround that until the bug is fixed.

ppc970 is not a 64-bit target, if you mean that. (Or if you refer to OpenBLAS’s own PPC970 target, then it is transparent what it does and what it did when it produced wrong code.) For OpenBLAS we just dropped -mcpu for PowerPC, -mtune works fine. (I know they are not the same, but having just -mtune is credible.)

dbsoft commented 5 months ago

Great to hear! What do you think, should we just drop the hack for packing?

I thought to submit this (among other fix-ups), but maybe we rather remove it completely and expect a user to have up-to-date GCC: https://repo.palemoon.org/barracuda156/UXP/commit/4abdfcd90daa681dc48d672e7ea4f1e874d4bf72

Yes, whenever I make a new pull I'll remove the packing hack since that was there because of the packing bug.

ppc970 is not a 64-bit target, if you mean that.

https://en.wikipedia.org/wiki/PowerPC_970

The 970 is a 64bit CPU. From Iain:

A quick test on my G5 box confirms: that the behaviour is as I commented above (the -mcpu=970/g5/native causes 64b instructions to be available on 32b binaries)

That is obviously incorrect compiler behavior.

barracuda156 commented 5 months ago

The 970 is a 64bit CPU. From Iain:

Yes, of course. What I meant is that ppc970 is not a 64-bit arch: it is still 32-bit arch, but using insns specific to G5.

That is obviously incorrect compiler behavior.

I also think so. We probably should open a ticket on GCC Bugzilla for that, but I do not have an easy case to illustrate the problem to them.

Yes, whenever I make a new pull I'll remove the packing hack since that was there because of the packing bug.

Okay, then I won’t touch that spot in my PR (if I submit one).

dbsoft commented 5 months ago

What I meant is that ppc970 is not a 64-bit arch: it is still 32-bit arch, but using insns specific to G5.

I still don't know what you mean by this... :) but I guess it doesn't really matter. It is a 64bit target CPU that can run in either 32bit or 64bit mode. When in 32bit mode it should not be using 64bit instructions. What I got out of that discussion is that when targeting 970/G5 it may include 64bit instructions when compiling for 32bit mode... which is errant behavior... some 64bit instructions might work and others might not.

I was suggesting to avoid that, pick the highest 32bit only compatible CPU, in this case the G4.... but tune for the G5.

wicknix commented 5 months ago

Wow! Looks like you guys are making good progress.

I’m just tossing this out there…. but why not just use -mcpu=G3 -m32 to start with? It might help get rid of that potentially mixed 32/64bit stuff, and it should ignore any leftover altivec code entirely. There really isn’t much of a performance difference between the G3/G4/G5 builds of TenFourFox or InterWebPPC, and the G3 builds are “generic” and will run on anything.

Cheers

dbsoft commented 5 months ago

I’m just tossing this out there…. but why not just use -mcpu=G3 -m32 to start with? It might help get rid of that potentially mixed 32/64bit stuff, and it should ignore any leftover altivec code entirely. There really isn’t much of a performance difference between the G3/G4/G5 builds of TenFourFox or InterWebPPC, and the G3 builds are “generic” and will run on anything.

Well, my initial rationale was that this hardware is old and slow, and while developing it I want to waste as little time as possible. I figured since these newer GCCs are mature and this is old hardware their support for the newer CPUs would be more stable. Judging by all the issues @barracuda156 has found I am starting to think that is not really the case though.

barracuda156 commented 5 months ago

I still don't know what you mean by this... :)

https://github.com/iains/darwin-toolchains-start-here/discussions/29#discussioncomment-3543928 https://github.com/iains/LLVM-7-branch/commit/b9c5258d8dabe270391ca5dcfedc0b166cfe74db#commitcomment-87572985

What I got out of that discussion is that when targeting 970/G5 it may include 64bit instructions when compiling for 32bit mode... which is errant behavior.

I do not know the cpu arch that well to say, to be honest. But judging by the fact that usage of -mcpu=G5 with OpenBLAS produced a defunct library, something is certainly wrong with that.