tjohnman / Obsession

A modern Hotline client written in Qt featuring Shift-JIS support and other stuff.
GNU General Public License v3.0
10 stars 1 forks source link

Any chance of building this with Qt4 or GTK3? Qt5 is broken on PPC :( #41

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

I would like to bring Hotline client to Macports. I have tried a bit with GtkHx and mhxd today, but the first appears totally broken and the second uses ancient C and perhaps will not work even on 10.6 and will not build on any newer system. Your client appears very promising, but we want PPC support :)

tjohnman commented 1 year ago

You raise an interesting point, because there's no reason this software should be using Qt5 over Qt4 if this limits usability on legacy platforms. I will look into this.

barracuda156 commented 1 year ago

@tjohnman Thank you!

P. S. We got this Qt4 in Macports, which is supported across the board: https://github.com/macports/macports-ports/blob/master/aqua/qt4-mac/Portfile

tjohnman commented 1 year ago

This was easier than I thought, but I suppose I might have broken some things.

I have created a qt4 branch. I tested it on Linux and it successfully built against Qt 4.8.7, but I'm afraid I can't test with Mac anymore, not even a modern one. This will be the default branch moving forward.

But please, have at it and let's see how far we can get with this. Please keep in mind this software was a rough alpha to begin with. I've tested trackers, connecting to a server, reading the agreement and downloading files, and it all worked reasonably well.

Also, if you haven't, check out this clients page in case there's something you can use.

barracuda156 commented 1 year ago

@tjohnman Many thanks! Gonna try it.

P. S. On a side note, KDX cannot be implemented, right?

tjohnman commented 1 year ago

@tjohnman Many thanks! Gonna try it.

P. S. On a side note, KDX cannot be implemented, right?

We could consider KDX in the future, but I don’t know much about the protocol. In any case, getting Hotline to work well should be the priority before moving on to other protocols.

Please let me know what is your experience building and using it on Mac.

barracuda156 commented 1 year ago

@tjohnman Sorry for a silly question, how do I build it on Mac? Makefiles appear to be Windows-targeted: https://github.com/tjohnman/Obsession/blob/qt4/Makefile They also mention Qt5 – that is okay, the same works with Qt4?

tjohnman commented 1 year ago

@tjohnman Sorry for a silly question, how do I build it on Mac? Makefiles appear to be Windows-targeted: https://github.com/tjohnman/Obsession/blob/qt4/Makefile They also mention Qt5 – that is okay, the same works with Qt4?

It's not a silly question. What is silly is me leaving that file there. Please ignore it. That Makefile is generated by qmake. If you have the Qt4 build tools installed, you should be able to use qmake (or qmake-qt4 depending on your system) to generate a new Makefile and then make to compile it. qmake uses the .pro project file.

Unfortunately I don't have my Mac here. But next week I might be able to built it myself. I'll write up the steps I followed then.

barracuda156 commented 1 year ago

@tjohnman Thank you! I will try that today.

barracuda156 commented 1 year ago

@tjohnman So, an update. Old gcc-4.2 fails quickly with this:

In file included from connectioncontroller.cpp:1:
connectioncontroller.h:83: error: ISO C++ forbids initialization of member ‘pitbull’
connectioncontroller.h:83: error: making ‘pitbull’ static
connectioncontroller.h:83: error: ISO C++ forbids in-class initialization of non-const static member ‘pitbull’
connectioncontroller.h:84: error: ISO C++ forbids initialization of member ‘encryption’
connectioncontroller.h:84: error: making ‘encryption’ static
connectioncontroller.h:84: error: ISO C++ forbids in-class initialization of non-const static member ‘encryption’
connectioncontroller.cpp: In member function ‘void ConnectionController::sendTransaction(CTransaction*, bool)’:
connectioncontroller.cpp:113: warning: unused variable ‘written’
connectioncontroller.cpp: In member function ‘void ConnectionController::onSocketConnected()’:
connectioncontroller.cpp:253: warning: unused variable ‘bytes’
In file included from dialogopenconnection.h:5,
                 from dialogopenconnection.cpp:1:
connectioncontroller.h:83: error: ISO C++ forbids initialization of member ‘pitbull’
connectioncontroller.h:83: error: making ‘pitbull’ static
connectioncontroller.h:83: error: ISO C++ forbids in-class initialization of non-const static member ‘pitbull’
connectioncontroller.h:84: error: ISO C++ forbids initialization of member ‘encryption’
connectioncontroller.h:84: error: making ‘encryption’ static
connectioncontroller.h:84: error: ISO C++ forbids in-class initialization of non-const static member ‘encryption’
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_Obsession/Obsession/work/compwrap/cxx/usr/bin/g++-4.2 -c -I/opt/local/include -Os -arch ppc -O2 -arch ppc -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/local/libexec/qt4/share/mkspecs/macx-g++ -I. -I. -I/opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/opt/local/libexec/qt4/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/opt/local/libexec/qt4/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/opt/local/libexec/qt4/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/opt/local/libexec/qt4/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/opt/local/libexec/qt4/include -I. -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib -o dialogagreement.o dialogagreement.cpp
make: *** [connectioncontroller.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from mainwindow.h:5,
                 from main.cpp:5:
connectioncontroller.h:83: error: ISO C++ forbids initialization of member ‘pitbull’
connectioncontroller.h:83: error: making ‘pitbull’ static
connectioncontroller.h:83: error: ISO C++ forbids in-class initialization of non-const static member ‘pitbull’
connectioncontroller.h:84: error: ISO C++ forbids initialization of member ‘encryption’
connectioncontroller.h:84: error: making ‘encryption’ static
connectioncontroller.h:84: error: ISO C++ forbids in-class initialization of non-const static member ‘encryption’
In file included from mainwindow.h:5,
                 from mainwindow.cpp:1:
connectioncontroller.h:83: error: ISO C++ forbids initialization of member ‘pitbull’
connectioncontroller.h:83: error: making ‘pitbull’ static
connectioncontroller.h:83: error: ISO C++ forbids in-class initialization of non-const static member ‘pitbull’
connectioncontroller.h:84: error: ISO C++ forbids initialization of member ‘encryption’
connectioncontroller.h:84: error: making ‘encryption’ static
connectioncontroller.h:84: error: ISO C++ forbids in-class initialization of non-const static member ‘encryption’
mainwindow.cpp:17: warning: unused parameter ‘checkForUpdates’
make: *** [main.o] Error 1
make: *** [dialogopenconnection.o] Error 1

Setting compiler.cxx_standard to 2011, Macports picks gcc12, and the build succeeds. Destroot fails though:

Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_Obsession/Obsession/work/Obsession-6cc3951ccc69a772f5944ac16ab1e3e92e7efb7c" && /usr/bin/make -w install DESTDIR=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_Obsession/Obsession/work/destroot 
make: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_Obsession/Obsession/work/tjohnman-Obsession-6cc3951'
make: Nothing to be done for `install'.
make: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_www_Obsession/Obsession/work/tjohnman-Obsession-6cc3951'
Error: No files have been installed in the destroot directory!
Error: Please make sure that this software supports 'make install DESTDIR=${destroot}' or implement an alternative destroot mechanism in the Portfile.

But this I can fix myself in the portfile code.

UPD. Preliminary portfile: https://github.com/barracuda156/macports-ports/blob/obsession/www/Obsession/Portfile

barracuda156 commented 1 year ago

@tjohnman Running the app from build dir, it seems to work fine:

hotline

P. S. The app has no icon though, for w/e reason. Should it be like that?

Also, once I opened the window About Obsession, there is no close button, and the main window is stuck in the background. The app has to be force-quitted.

barracuda156 commented 1 year ago

So to sum up, as of now:

  1. Build with newer GCC is fine on PPC. (No need to bother fixing it for old Apple GCC, unless it is completely trivial.)
  2. Qt4 seems to work fine, though I did get quite a number of warnings during the build.
  3. Something should be done re About window so that it can be closed normally :) Some other windows lack close button too – Trackers, for example, though in Trackers case it is possible to add a tracker, and that returns app to normal operation (it is still impossible to switch to chat window as long as Trackers window is opened).
  4. Destroot is trivially fixed in portfile, no worries about that (see above).
  5. It seems that overall the app is working, which is awesome.

P. S. I will test it on Intel somewhat later.

tjohnman commented 1 year ago

So to sum up, as of now:

1. Build with newer GCC is fine on PPC. (No need to bother fixing it for old Apple GCC, unless it is completely trivial.)

2. Qt4 seems to work fine, though I did get quite a number of warnings during the build.

3. Something should be done re About window so that it can be closed normally :) Some other windows lack close button too – Trackers, for example, though in Trackers case it is possible to add a tracker, and that returns app to normal operation (it is still impossible to switch to chat window as long as Trackers window is opened).

4. Destroot is trivially fixed in portfile, no worries about that (see above).

5. It seems that overall the app is working, which is awesome.

P. S. I will test it on Intel somewhat later.

It's nice to see you got it working. The application was never intended to be used on Mac. In fact, back in the day when I started it, I used to hang out in the Obsession server where some of the regulars were developing their own clients, and I decided to make one specifically targeted at Windows, since I didn't like the alternatives. That explains the weirdness with the UI.

In order to fix these quirks I will need to set up a build environment on my Mac once I get it back. It's an Intel, but I suppose it will be good enough.

barracuda156 commented 1 year ago

@tjohnman Thank you, that will be great.

As long as we stay with Qt4 and GCC, I think there are no arch-specific issues involved.

tjohnman commented 1 year ago

@barracuda156 I finally built the application on macOS 13 (Ventura) on an Intel and I didn't find any missing close buttons. I suspect this has to do with changes that happened to Mac OS X over the years. But unfortunately I don't know nearly enough about this to even imagine where the problem could be.

Screenshot 2022-11-20 at 19 10 50

barracuda156 commented 1 year ago

@tjohnman Thank you! Well, I guess we can live with this, not a stopper to use the app. I can add a note to the port.

tjohnman commented 1 year ago

@tjohnman Thank you! Well, I guess we can live with this, not a stopper to use the app. I can add a note to the port.

I'm thinking it might be related to how older versions of Mac OS X treat certain widgets and window classes. The about box is an "application modal" window, for example. Maybe the OS expects such a dialog to have its own OK/Cancel buttons.

I might at some point try to set up a PPC VM and try to fix this, but in the meantime I'll be more than glad to receive pull requests regarding this or any other issue.

barracuda156 commented 1 year ago

@tjohnman Regarding VM, the easiest way to test PPC (ppc32) code is installing macOS 10.6.8 Server in Parallels (or other VM manager of choice), making sure to select Rosetta in installation options, and then ppc32 binaries can run natively. GCC upstream supports Rosetta, Macports supports Rosetta reasonably well. I will just leave this for reference: https://forums.macrumors.com/threads/building-with-macports-for-10-6-powerpc-10a190-and-10-6-8-rosetta.2332711/ I can dig my notes for configuring GCC on Rosetta outside of Macports, that also works.

barracuda156 commented 1 year ago

@tjohnman By the way, would you like to be a co-maintainer in Macports? (This is not necessary, just asking.)

tjohnman commented 1 year ago

@tjohnman By the way, would you like to be a co-maintainer in Macports? (This is not necessary, just asking.)

Thanks for the offer, but I'm swamped enough as it is and I don't think I could be of much help anyway.

barracuda156 commented 1 year ago

@tjohnman Good new, Obsession port merged into master: https://ports.macports.org/port/Obsession/details/ As you can see from port health, on most of MacOS versions it builds fine on buildbots. Few fail. (I will see why it fails on 10.8.5 later on.)

tjohnman commented 1 year ago

Closing this as we're building with Qt 4 now. Please feel free to open separate issues for building problems.