Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] undef symbol: gdk_wayland_display_get_wl_compositor
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
mahdi1234
Guru
Guru


Joined: 19 Feb 2005
Posts: 559
Location: Being There

PostPosted: Wed Nov 10, 2021 3:04 pm    Post subject: [SOLVED] undef symbol: gdk_wayland_display_get_wl_compositor Reply with quote

Hi,

I'm using binary Tor browser form the site here https://www.torproject.org/download/ after update to latest version it won't start with

Code:
XPCOMGlueLoad error for file /somepath/tor/libxul.so:
/somepath/tor/libxul.so: undefined symbol: gdk_wayland_display_get_wl_compositor
Couldn't load XPCOM.


I'm running X with LXQT/Openbox (no wayland). Any advice appreciated what to enable to get this running.

cheers

EDIT:

Seems to be related to https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/40693 trying now x11-libs/gtk+:3 with wayland useflag, just to see.

EDIT2:

Temporarily fixed by setting
Code:
x11-libs/gtk+:3 +wayland
useflag
_________________
http://gentoo.mahdi.cz <-- gentoo package search engine


Last edited by mahdi1234 on Wed Nov 10, 2021 4:03 pm; edited 2 times in total
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30906
Location: here

PostPosted: Wed Nov 10, 2021 3:38 pm    Post subject: Reply with quote

You are not the only, but I've no idea how to fix
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed Nov 10, 2021 3:47 pm    Post subject: Reply with quote

Is it
Code:

Tor Browser 10.5.10

It works just fine with me.
Try this
Code:

ldd ~/tor-browser_en-US/Browser/libxul.so | egrep "gdk|gtk|wayland"

How do you start it?
Try
Code:

cd ~/tor-browser_en-US
./start-tor-browser.desktop

_________________
:)
Back to top
View user's profile Send private message
mahdi1234
Guru
Guru


Joined: 19 Feb 2005
Posts: 559
Location: Being There

PostPosted: Wed Nov 10, 2021 3:57 pm    Post subject: Reply with quote

alamahant wrote:
Is it
Code:

Tor Browser 10.5.10


Brand new 11 release

Temporarily fixed by setting
Code:
x11-libs/gtk+:3 +wayland
useflag
_________________
http://gentoo.mahdi.cz <-- gentoo package search engine
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed Nov 10, 2021 4:11 pm    Post subject: Reply with quote

Quote:

Temporarily fixed by setting
Code:
x11-libs/gtk+:3 +wayland
useflag

Thankss!!
When i updated I also had an issue with tor not starting
Thanks for the way around it
Actually gtk+ with USE="wayland" is not enough.
Mesa also want to be rebuild with "wayland"
For the time being I block auto installation of updates in tor-browser settings and use an older version I had handy.
:)
_________________
:)
Back to top
View user's profile Send private message
mahdi1234
Guru
Guru


Joined: 19 Feb 2005
Posts: 559
Location: Being There

PostPosted: Wed Nov 10, 2021 4:41 pm    Post subject: Reply with quote

Yes there was Mesa and one more package in dep tree ... unfortunately I did not have older build anymore.
_________________
http://gentoo.mahdi.cz <-- gentoo package search engine
Back to top
View user's profile Send private message
qsmodo
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2021
Posts: 82

PostPosted: Wed Nov 10, 2021 10:23 pm    Post subject: Reply with quote

Thanks, I was also stuck on this since yesterday.

However, it's a painful workaround. I'm already suffering in advance for the hours of compilation this entails. I wish Tor Browser maintainers would instead withdraw that awkward dependency...
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Wed Dec 08, 2021 9:37 am    Post subject: Reply with quote

As was noted on the torbrowser project's issue tracker, main Firefox seems to compile fine without wayland installed, so there's something torbrowser itself is doing weird that's breaking this.

For now, I guess compile mesa and gtk+ with wayland?

Cheers,

EE
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 1678

PostPosted: Wed Dec 08, 2021 10:32 am    Post subject: Reply with quote

Related: see bug 624960 - gtk's ABI changes based on whether it was built with Wayland support and it leaks into consumers. Difficult to solve properly (see bug 680496 for the solution we likely need).
Back to top
View user's profile Send private message
qsmodo
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2021
Posts: 82

PostPosted: Thu Dec 23, 2021 12:27 am    Post subject: Reply with quote

This is just to echo the workaround provided by a user in the Gitlab's issue and adapt it to Gentoo's context.

shim.c:

Code:
#include <stdlib.h>
void gdk_wayland_display_get_wl_compositor() { abort(); }
void gdk_wayland_device_get_wl_pointer() { abort(); }
void gdk_wayland_window_get_wl_surface() { abort(); }
void gdk_wayland_display_get_wl_display() { abort(); }


Compile:

Code:
cc -shared -o shim.so shim.c


The script to launch Tor:

Code:
cd /path/to/tor-dir &&
sed '/LD_PRELOAD/!s,Exec[^=]*=,&env LD_PRELOAD=/path/to/shim.so ,' start-tor-browser.desktop >tmp &&
mv tmp start-tor-browser.desktop &&
./start-tor-browser.desktop


The sed and mv exist exist because, at least in my system, the .desktop file needs to be rewritten at each launch, because another script reverts it back every time. If you find this rewrite does not happen in your system, then you can do away with it.


Last edited by qsmodo on Fri Dec 24, 2021 8:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21624

PostPosted: Thu Dec 23, 2021 2:37 am    Post subject: Reply with quote

That seems like a bad approach. How is your user able to rewrite the desktop file at all, and what is overwriting it afterward? Why are you using mv instead of sed -i?
Back to top
View user's profile Send private message
qsmodo
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2021
Posts: 82

PostPosted: Thu Dec 23, 2021 7:13 pm    Post subject: Reply with quote

I have enough permissions. What overwrites it afterward is Tor Browser itself, probably /opt/tor-browser_en-US/Browser/start-tor-browser.

I use mv instead of sed -i because the latter is not portable, and worse, some Sed implementations want an "argument" to -i and thus fail.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21624

PostPosted: Thu Dec 23, 2021 7:21 pm    Post subject: Reply with quote

You shouldn't have enough permissions though. As a file in /opt, rewriting that ought to be restricted to root. What sed implementation requires an argument to -i? Are any of those implementations even used on Gentoo?
Back to top
View user's profile Send private message
qsmodo
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2021
Posts: 82

PostPosted: Thu Dec 23, 2021 10:20 pm    Post subject: Reply with quote

Not trying to be snarky here, but can you explain why I shouldn't have enough permissions?

I know Mac OS' sed requires an argument to -i. I can't tell whether any implementation with same behavior is used on Gentoo, so I reckon using -i for the sake of saving a simple extra mv line is a risk not worth taking when I'm posting this for anyone to read.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21624

PostPosted: Fri Dec 24, 2021 2:13 am    Post subject: Reply with quote

I explained it above. Files in /opt ought not be writable to non-root users. You are presumably using a non-root user. Therefore, you are presumably using a user who should not be able to rewrite that file. Are you using the root user to run your browser, or are the permissions on this file wrong?

Mac OS is well known for shipping BSD-derived tools, rather than GNU tools; in my experience, BSD tools frequently have weird misfeatures like the one you describe. From trying to read up on this, it looks like it is the case that even the BSD sed can be made to behave by explicitly providing an empty suffix. Unfortunately, that causes GNU sed to do the wrong thing:
Code:
$ sed -i '' -e s/b/d/ c
sed: can't read : No such file or directory
For GNU sed, spelling it out works:
Code:
$ sed -e s/b/d/ c --in-place=
However, from what fragments of Mac OS documentation I've been able to find, BSD sed does not even recognize --in-place as a valid option.

Thus, I must thank you for pointing this out. I was generally aware that Mac OS tools had problems, but I wasn't aware of this specific problem. Now I know not to trust sed on a Mac to do anything more than the bare minimum required by the standard.
Back to top
View user's profile Send private message
qsmodo
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2021
Posts: 82

PostPosted: Fri Dec 24, 2021 11:20 am    Post subject: Reply with quote

I'm glad we are having a constructive conversation, Hu.

Quote:
Files in /opt ought not be writable to non-root users. You are presumably using a non-root user. Therefore, you are presumably using a user who should not be able to rewrite that file.


I understand the syllogism; I would appreciate if you could instead explain the premise "Files in /opt ought not be writable to non-root users".

I'm not running it as root, the owner is my user. When one downloads the Tor Browser from the Tor Project, all he gets to do is to extract it (no compilation, no make install, etc.), so that leaving the files in the "downloads" directory and running Tor Browser from there works. However, that is not very elegant, I reckon, so I simply moved them to /opt.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21624

PostPosted: Fri Dec 24, 2021 4:28 pm    Post subject: Reply with quote

That premise is a specific case of the more general premise: directories not specifically allocated to users are directories for system-wide use, and unprivileged users should not be able to add, modify, or delete files in system-wide directories. This is why we don't allow unprivileged users to create files in /usr/bin, or under /usr/local. With limited exceptions, standard practice is that there are no directories which are writable by multiple users, and which allow users to modify each others' files. /tmp is world-writable, but the sticky bit protects against users replacing each others' files. Often, /tmp will also be mounted noexec, which further reduces a user's ability to disrupt other users. Every other exception I am aware of is reserved to specific applications that have their own locking rules, and generally store only files that can be lost without serious consequence (such as a High Scores table for a game).

On a typical install, /opt/bin is part of the $PATH for all users, including root. It would be a security problem if an unprivileged user could add executable programs that other users would find via $PATH, because then users other than the creator might unintentionally run such a file. It is the responsibility of the root user to prevent this problem by not creating any directories that are both writable to users and treated as "system-wide" by common conventions. (Arguably, a system where root has specifically arranged that /opt is not in the standard $PATH would then be safe to allow users to write to /opt. Personally, I would push users somewhere else, because even if /opt is not in $PATH, it is still a well-known name that, by convention, is only writable to root, so some users or programs might still assume the latter and do something unsafe, even if it isn't in $PATH.)

On my system, the LLVM bin directory is lower in $PATH than /opt/bin, so someone with write access to /opt/bin could create a file, such as /opt/bin/llvm-cxxfilt, that would be run in preference to the real LLVM's llvm-cxxfilt. Then, when next I run a bare llvm-cxxfilt < something, I run their version in /opt/bin instead of the version I expected to be found at /usr/lib/llvm/version/bin/llvm-cxxfilt. This will at the very least be surprising, if they exec the real one with different options. It could be a security problem if their program also uses its authority as me to compromise my account, by uploading gpg or ssh keys, by modifying my dotfiles to run something malicious later, etc.

Gentoo packages of prebuilt binaries, such as firefox-bin or rust-bin, typically install under /opt, so when I saw that you had Tor Browser there, my expectation was that you had used an overlay that installed the files there. Such an overlay should not have made them writable to your user. Based on your latest post, you didn't use an overlay; you used a root shell to mv those files there. If you had put them somewhere else, I would have more readily recognized that this was not a package manager controlled install. If you had changed their ownership to root when you moved them, then the browser wouldn't be rewriting its desktop file, your post would not have needed to warn about the rewrite, and I would've assumed the files were safe. Referring to /opt as "default installation path" also sounds to me like a scripted install picked that directory for you. :)
Back to top
View user's profile Send private message
qsmodo
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2021
Posts: 82

PostPosted: Fri Dec 24, 2021 8:52 pm    Post subject: Reply with quote

Oh, sorry for "default installation path", that was totally incorrect since I put the files there myself. I edited the post to remove that incorrect statement.

Thank you for expanding on the /opt part, that's much appreciated.
Back to top
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Sun Jan 02, 2022 12:22 am    Post subject: Reply with quote

Qsmodo, thank you for this great little workaround (the custom shim.so).
Back to top
View user's profile Send private message
lyghters
n00b
n00b


Joined: 04 Jan 2024
Posts: 1
Location: Russia

PostPosted: Thu Jan 04, 2024 10:46 am    Post subject: Reply with quote

qsmodo wrote:
This is just to echo the workaround provided by a user in the Gitlab's issue and adapt it to Gentoo's context.

shim.c:

Code:
#include <stdlib.h>
void gdk_wayland_display_get_wl_compositor() { abort(); }
void gdk_wayland_device_get_wl_pointer() { abort(); }
void gdk_wayland_window_get_wl_surface() { abort(); }
void gdk_wayland_display_get_wl_display() { abort(); }


Compile:

Code:
cc -shared -o shim.so shim.c


The script to launch Tor:

Code:
cd /path/to/tor-dir &&
sed '/LD_PRELOAD/!s,Exec[^=]*=,&env LD_PRELOAD=/path/to/shim.so ,' start-tor-browser.desktop >tmp &&
mv tmp start-tor-browser.desktop &&
./start-tor-browser.desktop


The sed and mv exist exist because, at least in my system, the .desktop file needs to be rewritten at each launch, because another script reverts it back every time. If you find this rewrite does not happen in your system, then you can do away with it.


I just registered specifically to thank you for this "hack", the only thing that still keeps me from installing wayland, which I will never use, on Gentoo. Imagine installing Gentoo to fully control your dependencies and software features and be beaten by Tor Browser. Damn Mozilla for this hardcoded by default bullshit.
Thanks again.
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 324
Location: Naarm/Melbourne, Australia

PostPosted: Thu Jan 04, 2024 11:36 am    Post subject: Reply with quote

@Hu:

As a data point, i just tested sed(1) on one of my OpenBSD (7.4) servers; the '-i' option can be used without having to supply an argument.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum