UnityStandaloneFileBrowser icon indicating copy to clipboard operation
UnityStandaloneFileBrowser copied to clipboard

not working on ubuntu

Open slimgabsi opened this issue 6 years ago • 26 comments

Failed to load module "canberra-gtk-module"

test_64:8755): GLib-GObject-WARNING **: 12:30:42.739: cannot register existing type 'GdkDisplayManager'

(test_64:8755): GLib-CRITICAL **: 12:30:42.739: g_once_init_leave: assertion 'result != 0' failed

(test_64.x86_64:8755): GLib-GObject-CRITICAL **: 12:30:42.739: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

slimgabsi avatar Oct 12 '18 17:10 slimgabsi

Unfortunately I can't help much about this because i don't know much about gtk. You probably find more healthy information on internet.

gkngkc avatar Oct 14 '18 21:10 gkngkc

What is your OS? What DE are you using? Graphics drivers?

Can you upload the Logs (terminal and Unity Player)?

RicardoEPRodrigues avatar Nov 05 '18 17:11 RicardoEPRodrigues

@RicardoEPRodrigues, I have this problem too. I'm checking it on virtual machine (vmware). The program got stuck and the following errors printed in terminal.

image

M6stafa avatar Jan 02 '19 13:01 M6stafa

Hello @M6stafa,

Can you try it on Ubuntu 18.04? (maybe is a problem with the version of GLib, the current libStandaloneFileBrowser.so is compiled on 18.04.

The program got stuck

Can you check that the window is not behind the program? It happened to me and is related to how GNOME sorts windows out.

RicardoEPRodrigues avatar Jan 02 '19 14:01 RicardoEPRodrigues

Can you try it on Ubuntu 18.04? (maybe is a problem with the version of GLib, the current libStandaloneFileBrowser.so is compiled on 18.04.

Do you have old builds? or can you say me how i must build it? I'm not the only user of this program, and ubuntu 14.04 is good if supported but 16.04 must be supported.

Can you check that the window is not behind the program? It happened to me and is related to how GNOME sorts windows out.

I check that, there is nothing. i also check the sync function.

M6stafa avatar Jan 02 '19 14:01 M6stafa

i also check the sync function.

Currently there is no async working, I only implemented the sync method where the async calls the sync function.

can you say me how i must build it?

You can use CMake to build the library. It is located in the Plugins folder of the project.

RicardoEPRodrigues avatar Jan 02 '19 15:01 RicardoEPRodrigues

I test in ubuntu 18.04 too, and it fails with same error, what was your test environment?

M6stafa avatar Jan 02 '19 15:01 M6stafa

What version of Unity are you using? Maybe this is the issue.

A little context, I'm using Unity 2017.2 (I think), on this version the engine initializes a Gtk Application, so when in the library I open a dialog window it just uses the application Unity created. My hypothesis is that newer version don't run a Gtk Application, meaning we don't really have a correct way to create a dialog window.

To test my hypothesis I would need to install a newer version of Unity... or you can try and modify the code I made. Were you able to compile it?

RicardoEPRodrigues avatar Jan 02 '19 16:01 RicardoEPRodrigues

I'm using 2018.3.0f2.

Were you able to compile it?

I'm trying, it's need a newer cmake that is not in default repos, i make the the newer version. What code must i change and test?

M6stafa avatar Jan 02 '19 16:01 M6stafa

First try compiling it and replacing the .so file in the Assets/Plugins folder and test it in your game (you need to close and open Unity to load the new .so file). Does it work? Same errors or different errors?

If it doesn't work then try running the example that comes with the library code (main.c). Does it run? Does it show the same errors?

RicardoEPRodrigues avatar Jan 02 '19 16:01 RicardoEPRodrigues

I build in Ubuntu 16.04, the main.c runs correctly without any error but the game has same errors with new .so

What is next step?

M6stafa avatar Jan 02 '19 18:01 M6stafa

Basically we now know that Unity no longer runs with a Gtk application. So we need to create one.

AKA

Create a Gtk application from the C code.

RicardoEPRodrigues avatar Jan 02 '19 19:01 RicardoEPRodrigues

Maybe this can help. https://developer.gnome.org/gtk3/stable/gtk-getting-started.html

RicardoEPRodrigues avatar Jan 02 '19 19:01 RicardoEPRodrigues

I try some methods like create a gtk application each time, but errors not change. at the end I find TinyFileDialogs and build it for linux and it's work correctly.

M6stafa avatar Jan 03 '19 00:01 M6stafa

Still no updates on this? I have the same problem.

marco-nutonomy avatar Feb 07 '19 03:02 marco-nutonomy

@marco-nutonomy I still haven't had the time.

Yet the problem is now clearer, it doesn't work on the 2018 version of Unity.

RicardoEPRodrigues avatar Feb 07 '19 15:02 RicardoEPRodrigues

I am facing the same issue, it works in the Editor, but crashes in build.


But after trying out for few hours, it seems to work, though I am not a Gtk expert so not sure what it would cause LOL ! I haven't tested all the functions, but this is how I managed to get it to work on my side, hope this will give you some hints...

OS: Ubuntu 14.04 Unity: 2018.3.0f2

  1. Installing gtk2.0 sudo apt-get install libgtk2.0-dev

  2. Downgrade to gtk2.0 and recompile the library seems to work (see attached file for modified CMakeList.txt) CMakeLists.txt

Hope there will be a proper solution soon.

Vuxt4 avatar Feb 12 '19 08:02 Vuxt4

@Vuxt4 Thank you for your insight, I'll need to test this out, yet I'm not a fan of using older versions where newer versions should (in theory) do the job.

If all else fails I'll have to compile it with GTK2.0. Thank you! 😄

RicardoEPRodrigues avatar Feb 12 '19 10:02 RicardoEPRodrigues

Hey everyone, so I've done some digging. It turns out it is not related with Unity 2018, it is instead related with older Ubuntu distros.

I've been developing and building on Ubuntu 18.04, where even with Unity 2018 it works, I think the problems are due to older GTK version in Ubuntu 14.04. I don't have the time or availability to solve this issue. I can only support newer distros.

RicardoEPRodrigues avatar Mar 04 '19 18:03 RicardoEPRodrigues

I can understand not supporting 14.04 which is almost at the end of the LTS, but i think 16.04 should definitely be supported, considering it still has more than 2 years of official support.

marco-nutonomy avatar Mar 05 '19 03:03 marco-nutonomy

Hey guys, I compiled the code in Ubuntu 14.04 and generated the .so.

Could you test it out and see if it works for you?

libStandaloneFileBrowser.zip

Replace the .so file in your Unity project with this one and give it a go.

RicardoEPRodrigues avatar Apr 14 '19 22:04 RicardoEPRodrigues

Sadly, nothing seems to change on 16.04.

marco-nutonomy avatar Apr 15 '19 05:04 marco-nutonomy

@RicardoEPRodrigues

Your new .so works fine while in Editor, it does not work in build application though...

Following error occurs when running with build application: (test.x86_64:4785): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplayManager'

(test.x86_64:4785): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(test.x86_64:4785): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

Environment: OS: Ubuntu 14.04 Unity: 2018.3.0f2

Vuxt4 avatar Apr 15 '19 07:04 Vuxt4

I rebuilt the .so file but it still doesn't working.

Both the bundled and the one built by myself stuck on gtk_init:

image

Menci avatar Jun 18 '21 12:06 Menci

I managed to get it running with a GTK+ running in a separated process. I'll post the source code (or send a pull request) later!

Menci avatar Jun 18 '21 14:06 Menci

I opened a PR #106. Before it's merged you can get the new native lib from my repo.

Menci avatar Jun 18 '21 19:06 Menci