Compiling Catapult for MacOS

Страница 2/3
1 | | 3

By santiontanon

Paragon (1805)

Аватар пользователя santiontanon

26-04-2021, 00:20

Going back to the original title of this thread, I just downloaded the latest catapult (16.0) from the openMSX website, and tried to compile for mac. Just typing "make" failed since I didn't have "wxwidgets", so, after a simple

brew install wxwidgets

Catapult seemed to compile fine, and then sudo make install seemed to work and reported Installation complete... have fun! (there was just a "ld: warning: option -s is obsolete and being ignored" message during installation, but I'm assuming that was fine?)

After that, if I try to run catapult, it just launches and dies instantly (I never even get to see any window popping up). I looked at the "Console" app for output messages, and these are the last messages that catapult logs before exiting:

NSApp cache appearance:
-NSRequiresAquaSystemAppearance: 0
-appearance: (null)
-effectiveAppearance: ",
    ""
)>
No persisted cache on this platform.
Entering exit handler.
Exiting exit handler.

If anyone has any clue about what might be happening, I'm happy to do any edits in the code to try things out until it works Smile

By Manuel

Ascended (19466)

Аватар пользователя Manuel

26-04-2021, 01:00

First idea: add debug prints to see how far it got...

By santiontanon

Paragon (1805)

Аватар пользователя santiontanon

26-04-2021, 15:37

Good idea! I did that, and it crashes in this line:

wxXmlResource::Get()->LoadPanel(this, parent, wxT("MiscControlPage"));

Which happens in the constructor of "MiscControlPage", called from the constructor of "wxCatapultFrame", called from "wxCatapultApp::OnInit" (which I think is the main function).

I modified the exception handling code from this:

		} catch (...) {

to this:

		} catch (const std::exception& e) {
			std::cout << e.what();

To see if I could see what was the problem, but I just get a *** Caught unhandled unknown exception; terminating, which is not very useful. Looking around, it seems a common problem in wxwidgets, and forums recommend getting a debug version of wxwidgets to get proper exceptions.

That's all the time I had before work, and I can look at it again tonight. But again, any clue or potential thing to try is welcome Smile

By Manuel

Ascended (19466)

Аватар пользователя Manuel

26-04-2021, 17:20

Looks like it's a problem loading the XRC file? That's the file that defines the layout of the form. The program must be able to find it at least.

By santiontanon

Paragon (1805)

Аватар пользователя santiontanon

26-04-2021, 17:55

I think the files are found fine, since those are loaded in these lines in the main file, which all return success (there's a typo there, btw, which I'll fix if I get to the bottom of this to send a pull request hehe):

	succes &= LoadXRC(wxT("about.xrc"));
	succes &= LoadXRC(wxT("config.xrc"));
	succes &= LoadXRC(wxT("fullscreen.xrc"));
	succes &= LoadXRC(wxT("screenshot.xrc"));
	succes &= LoadXRC(wxT("catapult.xrc"));
	succes &= LoadXRC(wxT("session.xrc"));
	succes &= LoadXRC(wxT("status.xrc"));
	succes &= LoadXRC(wxT("misccontrols.xrc"));
	succes &= LoadXRC(wxT("videocontrols.xrc"));
	succes &= LoadXRC(wxT("audiocontrols.xrc"));
	succes &= LoadXRC(wxT("input.xrc"));
	succes &= LoadXRC(wxT("romtype.xrc"));
	succes &= LoadXRC(wxT("ipsselect.xrc"));
	succes &= LoadXRC(wxT("checkconfigs.xrc"));

And also, there is a previous call to "LoadPanel" ( wxXmlResource::Get()->LoadFrame(this, parent, wxT("CatapultFrame")); ) that succeeds.

But your mention to "xrc" files gave me additional info! I have never used wxwidgets before, so, I didn't realize there were those "wxg" files. My current hypothesis is that there seems to be something on that "MiscControlPage" widget definition that the Mac version does not like. At work now, but I'll try tonight commenting out sections of the misccontrols.wxg file until I find the culprit Smile

By Manuel

Ascended (19466)

Аватар пользователя Manuel

26-04-2021, 18:02

Or try to put it at the end first, see if the others do load. Perhaps it's a bitmap that is referred to in the file that isn't found?

By santiontanon

Paragon (1805)

Аватар пользователя santiontanon

27-04-2021, 05:04

Alright, I got it to work!! Smile

The problem for me is that some of the widget definitions (the .wxg files) had errors. I am surprised by this, since catapult works for lots of people, so, my only explanation is that something has changed in the latest version of wxwidgets. I see those files were auto generated in 2005, so, maybe they are outdated now?

Anyway, in particular there are two things that if fixed in the wxg files, things work:

The first is that "wxComboBox" elements are currently defined like this (spaces added, so it'd render properly in the forum):

< choices >
  < choice >choice 1< /choice >
< /choices >

But according to the documentation ( https://wiki.wxwidgets.org/Using_XML_Resources_with_XRC ), they should be defined like this:

< content >
  < item >choice 1< /item >
< /content >

And the second is that when no items are defined in the content of a wxComboBox, this line should be removed from the definition of the widget:

< selection >0< /selection >

I am happy to send a pull request if this can help, but only if someone confirms that this is a wanted change.

Anyway, it works now! The color in the text in the interface is not playing well at all with my dark theme in Mac, but I am sure that is an easier fix :)

By sdsnatcher73

Prophet (3954)

Аватар пользователя sdsnatcher73

27-04-2021, 08:25

About that auto generation, I assume they are somehow generated from another (source) file. If those source files are also part of the repository I would say it makes sense to include the generation of the resource files in the make process. I think that way the version specific stuff inside wxWidgets can be handled during the generation and make the whole process more resilient.

By Manuel

Ascended (19466)

Аватар пользователя Manuel

27-04-2021, 10:12

The wxg files are source files which are edited by design tools like wxGlade or more modern variants.

At compile time they are converted to XRC.

By Manuel

Ascended (19466)

Аватар пользователя Manuel

27-04-2021, 12:59

santiontanon: check the conversion script in build/wxg2xrc.sed... amongst others, it converts the choices/choice into content/item. The result is in derived/<platform-dependent-folder>/resources/dialogs/

Perhaps that sed script needs some updates?

Страница 2/3
1 | | 3