Error while attempting to run UXP app with mach run

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-04, 21:47

This thread is sort-of a continuation of viewtopic.php?f=62&t=25708
In the end I managed to build what I was trying to build at the time, though naturally it's different than what I was using at the time, given that almost a year has passed.
Indeed, it builds just fine, but when I try to execute mach run, I get the following error:

Code: Select all

[24394] ###!!! ABORT: u_init() failed: file {path to the project}/platform/xpcom/build/XPCOMInit.cpp, line 703
(I removed references to the filesystem paths.)
I'm aware that u_init comes from ICU and thanks to some hackery (which I reverted after accomplishing the task) I managed to find out the actual ICU error message (that UXP hides), which is something about being unable to read some file in particular.
Unfortunately, I couldn't find out what file it's not reading and scanning the in-tree ICU source code lead nowhere.
The error most definitely comes from something missing from my configuration, but I have no idea what that something is.
I'd like to ask some pointers on how to solve this problem. Doesn't have to be the solution, especially since given the complexity of both the platform and the build system it can't be something straightforward, but I'm still hoping someone might have something specific in mind.
Thanks.

New Tobin Paradigm

Re: Error while attempting to run UXP app with mach run

Unread post by New Tobin Paradigm » 2021-05-04, 21:50

You're not building with debug symbols are you?

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-04, 22:34

Uhh I think I don't.
Admittedly, I should've also posted the mozconfig just in case, but I forgot.
And now I don't have it at hand...
Anyway, aside from specifically using GTK3 and not exporting some variables (which you said in other posts that are used by your distribution service and thus can be omitted), it's the same as Pale Moon.
I'm not really sure how debug symbols are included on Linux, but if it's the --enable-strip flag then I suppose it's without debug symbols.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35402
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Error while attempting to run UXP app with mach run

Unread post by Moonchild » 2021-05-04, 23:27

Wow, you're incredibly vague in your report, you know that right?
vannilla wrote:
2021-05-04, 21:47
which is something
What exactly?
vannilla wrote:
2021-05-04, 21:47
about being unable to read some file in particular.
Which file, exactly?
vannilla wrote:
2021-05-04, 22:34
I should've also posted the mozconfig
That, and on what environment you're building, at the very least.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-05, 11:08

Moonchild wrote:
2021-05-04, 23:27
Wow, you're incredibly vague in your report, you know that right?
The whole situation is vague.
Do you think I would intentionally omit informations if error messages were clear?
Moonchild wrote:
2021-05-04, 23:27
What exactly?
Unable to read file. That's all, no file names.
Moonchild wrote:
2021-05-04, 23:27
Which file, exactly?
No names were provided in the error message, or I would've said so.
Moonchild wrote:
2021-05-04, 23:27
That, and on what environment you're building, at the very least.

Code: Select all

ac_add_options --enable-application=myapp
ac_add_options --enable-optimize="-O2 -w"
ac_add_options --enable-default-toolkit=cairo-gtk3
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --disable-eme
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --with-pthreads
GCC 10 on Gentoo Linux, GTK 3 as provided by the packagers, but I want to make clear that literally every other complete UXP application builds and runs just fine with no issues.
Not sure what other environment informations you might want to know.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35402
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Error while attempting to run UXP app with mach run

Unread post by Moonchild » 2021-05-05, 12:00

I do know that ICU relies on having an arbitrary data file present with internationalization data (icudt58l.dat, or ...58b for big-endian machines). Perhaps that wasn't copied across?
unless your "myapp" needs internationalisation support, you could try building without it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

New Tobin Paradigm

Re: Error while attempting to run UXP app with mach run

Unread post by New Tobin Paradigm » 2021-05-05, 16:42

What is "myapp"? Is there some source code out there?

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-05, 16:53

Moonchild wrote:
2021-05-05, 12:00
I do know that ICU relies on having an arbitrary data file present with internationalization data (icudt58l.dat, or ...58b for big-endian machines). Perhaps that wasn't copied across?
Scanning the build directory, I can see that there is this:

Code: Select all

obj-x86_64-pc-linux-gnu/dist/bin/icudt58l.dat
Not sure what is not working here.
Maybe I didn't specify a path somewhere? But of course I don't know where.
Moonchild wrote:
2021-05-05, 12:00
you could try building without it.
I don't know which flag disables it.
Is it --disable-icu? I see a --without-intl-api, maybe it's that one?
New Tobin Paradigm wrote:
2021-05-05, 16:42
What is "myapp"? Is there some source code out there?
No, sorry, there's no code published anywhere.
"myapp" is an experiment in building a working UXP application (for some definition of working) not based on an existing application codebase, nothing more.
I'm not planning on building anything revolutionary with this specific project nor am I going to distribute it.
Currently the goal is to open a XUL window.

New Tobin Paradigm

Re: Error while attempting to run UXP app with mach run

Unread post by New Tobin Paradigm » 2021-05-05, 18:02

I understand the personal nature to this but I can't really suggest anything without seeing what you are doing. Maybe give a few of us private access so we can see. I promise we won't steal your code.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-05, 22:52

It's reasonable. As I said in the OP, I had hoped for pointers, but if there's not much to do without the code, I can't force anything.
I don't really mind sharing it, especially as currently it's 90% build system and thus basically "copy and paste" code, with only a small part being original or modified code. I attached it to this post (assuming no errors.)
Well, I do actually mind it a bit, but only because it's not well organized: since it's an experiment and I'm learning as I go, it's (very likely) incomplete in various parts, there are probably some printing statements outputting some garbage I forgot to remove, etc. etc.
Basically, it's a bit embarassing :P
The attached archive has to be unpacked in a directory, because to make it easier to exclude some unrelated files I packed the files themselves instead of a directory (this is mostly for Linux users running tar from the command line, as people on Windows using 7zip can simply look at the contents of the window.)
There is also the mozconfig inside.
Attachments
micro.tar.gz
(40.26 KiB) Downloaded 6 times

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-08, 15:21

After a bit more fiddling around, I discovered what the issue was.
In the end, it was caused by me misunderstanding some parts of the code (including code from other applications), leading to incorrect path handling.
Basically, I thought that the mozilla::BinaryPath::Get method gave a different result than what it actually gives, so I didn't modify the returned value as I shold've done.
For future reference, the problem is solved by doing these steps:

Code: Select all

mozilla::BinaryPath::Get(binaryname, buffer);
char *p = strrchr(buffer, XPCOM_FILE_PATH_SEPARATOR[0]);
*(p+1) = '\0'; // Or buffer[p-buffer+1] = '\0';
binaryname usually is just argv[0].

User avatar
micwoj92
Fanatic
Fanatic
Posts: 174
Joined: 2020-12-22, 20:57

Re: Error while attempting to run UXP app with mach run

Unread post by micwoj92 » 2021-05-09, 01:12

What will this application be? I know that there is micro text editor, is this planned to be some kind of text editor/IDE too?

New Tobin Paradigm

Re: Error while attempting to run UXP app with mach run

Unread post by New Tobin Paradigm » 2021-05-09, 01:17

It is his personal project.

User avatar
micwoj92
Fanatic
Fanatic
Posts: 174
Joined: 2020-12-22, 20:57

Re: Error while attempting to run UXP app with mach run

Unread post by micwoj92 » 2021-05-09, 01:26

Yes, I did read that, I am wondering what purpose (other than learning) it could have.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Error while attempting to run UXP app with mach run

Unread post by moonbat » 2021-05-09, 05:44

Building a standalone UXP application eventually. Will be great if it can happen and become an alternative to the travesty called Electron.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-05-10, 22:18

I've found another issue which I'm having trouble understanding and since I had opened this thread already, might as well use it even if I end up finding a solution in the meantime.

This one isn't an error like the previous one, but it is still not the expected behaviour.
Now that I added the changes listed in the previous post, the application builds and run fine, but no window is shown.
Basically, after I execute ./mach run, the process "hangs" for a while (since it has to initialize itself and all that), but then terminates immediately without displaying anything.
I tried using GDB to step through the code to see if there was something obviously wrong, but everything seems in order: in fact, the peculiar thing is that from the point of view of the program, nothing is wrong.
Checking the relevant methods, I can see that what is supposed to happen is something like "initialize part of the platform -> initialize the main loop -> run the main loop -> terminate the main loop -> clean up", but what is happening is that the "run the main loop" part is skipped entirely, moving to the next step instead.

I can't figure out why the main loop is not ran, even when comparing my setup with Pale Moon's and Ambassador's.
Any help is appreciated, thanks.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Error while attempting to run UXP app with mach run

Unread post by vannilla » 2021-06-03, 16:51

This post just to say that after some more fiddling I managed to make it work. See screenshot. It was caused by a missing preference.
The menu bar and File menu are there only for show since I was taking a picture; it doesn't actually have any code backing them thus it's non-functional.
(Ignore the bar at the bottom, that's the window manager.)
:angel:
Attachments
s.png
s.png (3.82 KiB) Viewed 1374 times

Locked