Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
firefox-bin -- now with added apulse?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Mon Sep 16, 2024 2:22 pm    Post subject: firefox-bin -- now with added apulse? Reply with quote

Hi folks

I recently updated firefox-bin, and found it had a dependency on apulse. I don't remember that being the case in the past (but I've been wrong before).

So far as I can tell, firefox-bin still supports ALSA without the need for apulse, although I'm aware that some Linux distributions don't provide an ALSA-capable Firefox.

Has something changed in Gentoo, in this regard? Everything still seems to work -- I'm just curious.

BR, Lars.
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 420

PostPosted: Mon Sep 16, 2024 3:52 pm    Post subject: Re: firefox-bin -- now with added apulse? Reply with quote

lars_the_bear wrote:


So far as I can tell, firefox-bin still supports ALSA without the need for apulse.

How did you determine this? Based on what information?
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3687
Location: Rasi, Finland

PostPosted: Mon Sep 16, 2024 4:48 pm    Post subject: Re: firefox-bin -- now with added apulse? Reply with quote

rab0171610 wrote:
How did you determine this? Based on what information?
From
Code:
equery u firefox-bin
Pay attention to alsa USE-flag.
And from wiki:
'USE-flags' section wrote:
Note that USE="-pulseaudio" will select the ALSA audio back-end.


So I'd guess by having alsa support Firefox needs to use apulse, to transform pulse protocol (or what not) to "pure" alsa.

So yeah. Firefox doesn't have alsa backend. But apulse can be used to avoid pulseaudio.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3416
Location: Canada

PostPosted: Mon Sep 16, 2024 4:58 pm    Post subject: Re: firefox-bin -- now with added apulse? Reply with quote

rab0171610 wrote:
lars_the_bear wrote:


So far as I can tell, firefox-bin still supports ALSA without the need for apulse.

How did you determine this? Based on what information?



As far as I see, apulse is optional. I have firefox-bin running and no apulse installed on the computer.


For the rebuild

Code:

       pulseaudio? (
                || (
                        media-libs/libpulse
                        >=media-sound/apulse-0.1.12-r4[sdk]
                )
        )


so either libpulse or apulse will satisfy it ?


If USE='pulseaudio' is not set, there is alsa flag (which has strange description "+ + alsa : When pulseaudio isn't set, this prefers apulse" which I do not believe), but I cannot find explicit reference to this flag in the rebuild. But I would guess it should use alsa directly.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Mon Sep 16, 2024 5:54 pm    Post subject: Re: firefox-bin -- now with added apulse? Reply with quote

Zucca wrote:

So yeah. Firefox doesn't have alsa backend. But apulse can be used to avoid pulseaudio.


That's the odd thing -- Firefox supported native ALSA, at least until recently. I've always had "USE=alsa -pulseaudio" and I've never installed apulse, and Firefox always worked fine. It works fine still, without using Pulse or apulse. The Ubuntu and Fedora builds of Firefox don't support ALSA, and need apulse, but the Gentoo builds have been fine without so far.

I'm aware that the Firefox maintainers are not keen on supporting native ALSA, and have not been for a long time. But AFAIK the code is still there, and still works.

So I'm baffled about why I now have apulse on my system, when I didn't need it before, and don't seem to need it now.

So far as I know, the presence of libapulse alone is not sufficient to make apulse work -- there needs to be a way to interpose libapulse between the Pulse API calls and ALSA. That's what the apulse program does.

So I remain totally confused.

BR, Lars.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3416
Location: Canada

PostPosted: Mon Sep 16, 2024 6:09 pm    Post subject: Reply with quote

Yep, if I reinstall firefox-bin with -pulseaudio

USE='-pulseaudio' emerge -pv firefox-bin:esr

it pulls in apulse. (it also requires alsa-plugins to be reinstalled without pulseaudio support). So indeed, not direct ALSA.
Saying that, I start to recall some conversation about it 2-3 years ago, are you sure it is not when ALSA support disappeared ?
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Mon Sep 16, 2024 6:13 pm    Post subject: Reply with quote

dmpogo wrote:

Saying that, I start to recall some conversation about it 2-3 years ago, are you sure it is not when ALSA support disappeared ?


I have a feeling that the Firefox maintainers started down the crazy path of deprecating ALSA support nearly ten years ago. But, so far as I know, it hasn't disappeared. It's working fine for me right now without Pulse or apulse. That's why I'm confused about the presence of the dependency.

BR, Lars.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2728
Location: Here and Away Again

PostPosted: Mon Sep 16, 2024 7:12 pm    Post subject: Reply with quote

lars_the_bear wrote:
dmpogo wrote:

Saying that, I start to recall some conversation about it 2-3 years ago, are you sure it is not when ALSA support disappeared ?


I have a feeling that the Firefox maintainers started down the crazy path of deprecating ALSA support nearly ten years ago. But, so far as I know, it hasn't disappeared. It's working fine for me right now without Pulse or apulse. That's why I'm confused about the presence of the dependency.

BR, Lars.

If you do

Code:
$ file $(which firefox-bin)

you may find that it is a Bash script, and if you look into said script, you should find that it will indeed use 'apulse' if available without you explicitly running it via apulse.

With USE="alsa -pulseaudio" you should have had 'media-sound/apulse' around since at least 2 years ago already.

The 'firefox-bin' package is what comes from upstream directly, and does not normally provide any ALSA support, but the ebuild does a kind of magic to make it happen.

When building from source, the ALSA backend can still be enabled, but I believe it is up to the community to maintain said backend.

As for when it all started, I think this might be the upstream bug with most "conversation" about the issue:

https://bugzilla.mozilla.org/show_bug.cgi?id=1345661
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Tue Sep 17, 2024 8:55 am    Post subject: Reply with quote

Chiitoo wrote:

If you do

Code:
$ file $(which firefox-bin)

you may find that it is a Bash script, and if you look into said script, you should find that it will indeed use 'apulse' if available without you explicitly running it via apulse.


Thanks, but nope -- it doesn't. And if I remove the apulse binary completely, firefox-bin still produces audio.

The script does have a reference to libapulse, however. It's just set into an environment variable. I don't know whether libapulse can produce sound without the apulse process, or whether Firefox would know how to use it if it could?

Is there a way to uninstall apulse completely, without disturbing firefox-bin? Maybe that's the only way to say for sure whether it's being used or not.

If I build Firefox from source, with "USE=-pulseaudio alsa", should I expect to get a native ALSA version, without no Pulse/apulse dependencies?

Pragmatically, if Firefox works, I don't really care how. I'm just curious to understand what's going on.

BR, Lars.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2728
Location: Here and Away Again

PostPosted: Tue Sep 17, 2024 12:44 pm    Post subject: Reply with quote

lars_the_bear wrote:
Chiitoo wrote:

If you do

Code:
$ file $(which firefox-bin)

you may find that it is a Bash script, and if you look into said script, you should find that it will indeed use 'apulse' if available without you explicitly running it via apulse.


Thanks, but nope -- it doesn't. And if I remove the apulse binary completely, firefox-bin still produces audio.

The script does have a reference to libapulse, however. It's just set into an environment variable. I don't know whether libapulse can produce sound without the apulse process, or whether Firefox would know how to use it if it could?

If by 'apulse binary' you mean '/usr/bin/apulse', that's a script as well, which basically does the same thing 'firefox-bin' does, loading the PulseAudio replacement libraries 'media-sound/apulse' comes with (there is no "apulse process" involved).

lars_the_bear wrote:
Is there a way to uninstall apulse completely, without disturbing firefox-bin? Maybe that's the only way to say for sure whether it's being used or not.

You can forcefully remove anything using the '--unmerge' option for 'emerge', which in this case would remove the libraries provided by 'media-sound/apulse' and with that, Firefox should become quite quiet indeed.

Mandatory "you get to keep the pieces when it breaks" disclaimer here. :]

lars_the_bear wrote:
If I build Firefox from source, with "USE=-pulseaudio alsa", should I expect to get a native ALSA version, without no Pulse/apulse dependencies?

Yes, with the source build, if USE="-pulseaudio" you get the ALSA backend enabled automatically (there is no USE="alsa" there), and 'media-sound/apulse' is a dependency only if USE="pulseaudio" (it needs to be installed first, or 'media-libs/libpulse' will be pulled in instead):

Code:
        pulseaudio? (
                || (
                        media-libs/libpulse
                        >=media-sound/apulse-0.1.12-r4[sdk]
                )
        )

[...]

        local myaudiobackends=""
        use jack && myaudiobackends+="jack,"
        use sndio && myaudiobackends+="sndio,"
        use pulseaudio && myaudiobackends+="pulseaudio,"
        ! use pulseaudio && myaudiobackends+="alsa,"

        mozconfig_add_options_ac '--enable-audio-backends' --enable-audio-backends="${myaudiobackends::-1}"

_________________
Kindest of regardses.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Tue Sep 17, 2024 1:04 pm    Post subject: Reply with quote

Chiitoo wrote:

If by 'apulse binary' you mean '/usr/bin/apulse', that's a script as well, which basically does the same thing 'firefox-bin' does, loading the PulseAudio replacement libraries 'media-sound/apulse' comes with (there is no "apulse process" involved).


Yeah, my bad. I was actually looking for a specific invocation of 'apulse firefox'. But, as you say, `firefox-bin` just sets LD_LIBRARY_PATH to the apulse versions of libpulse.so, etc.

I don't remember seeing this additional apulse stuff before, but when I started using Gentoo, and did not know there was such a thing as 'firefox-bin', I just built Firefox from source. So I guess I've gotten mixed up, as usual.

I would prefer not to have this additional compatibility layer in Firefox, but I guess the only solution is to spend another four days building Firefox from source. I can't think what on Earth possessed the Firefox people to dump ALSA support in their binary, but I can't blame Gentoo for that.

BR, Lars.
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 420

PostPosted: Tue Sep 17, 2024 2:11 pm    Post subject: Reply with quote

lars_the_bear wrote:


I would prefer not to have this additional compatibility layer in Firefox, but I guess the only solution is to spend another four days building Firefox from source.

I don't see how spending "four days building Firefox" is the ideal solution. It seems only logical that given the troubles you report building packages from source, accepting apulse as dependency would be the easiest solution. Maybe you should re-evaluate whether this is really that important to you.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2728
Location: Here and Away Again

PostPosted: Tue Sep 17, 2024 2:31 pm    Post subject: Reply with quote

lars_the_bear wrote:
I would prefer not to have this additional compatibility layer in Firefox, but I guess the only solution is to spend another four days building Firefox from source.

Looking at the Gentoo binary packages available right now, it seems that 'firefox-115.15.0-4' for example is built without USE="pulseaudio", if I'm seeing things right-like (just downloaded the tar packages and looked around in them, no testing or anything done here).

That 4-day compilation, and other compilation related things you've mentioned elsewhere, do seem a bit odd to me; my father is running Gentoo on bits and pieces of my old computers from around 2005-2008, CPU being an AMD Athlon X2 7750 if I remember right, and I still compile things with it.

That said, for bigger updates I do help it out with 'distcc', because I can, and since it will run out of RAM for things like Qt WebEngine (suppose I could add swap out of interest to see how long it would take). Might move it onto the binary packages though, since that is also now a possibility.

Granted, laptops are always a bit special... and I do have some old ones laying about, that I've received from people, and have been meaning to test how (un)well they do these days.

In any case, I digress, there is a thread on that topic already where I meant to initially post about it.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Wed Sep 18, 2024 8:12 am    Post subject: Reply with quote

Chiitoo wrote:

That said, for bigger updates I do help it out with 'distcc', because I can, and since it will run out of RAM for things like Qt WebEngine (suppose I could add swap out of interest to see how long it would take).


According to `emerge`, it need 80Gb to compile qtwebengine. In my case that would be 8Gb RAM and 72Gb swap. I'm not even going to try :/

BR, Lars.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3687
Location: Rasi, Finland

PostPosted: Wed Sep 18, 2024 11:32 am    Post subject: Reply with quote

lars_the_bear wrote:
According to `emerge`, it need 80Gb to compile qtwebengine. In my case that would be 8Gb RAM and 72Gb swap. I'm not even going to try :/

BR, Lars.
That's got to be the temporary disk space requirement.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2728
Location: Here and Away Again

PostPosted: Wed Sep 18, 2024 11:54 am    Post subject: Reply with quote

lars_the_bear wrote:
Chiitoo wrote:

That said, for bigger updates I do help it out with 'distcc', because I can, and since it will run out of RAM for things like Qt WebEngine (suppose I could add swap out of interest to see how long it would take).


According to `emerge`, it need 80Gb to compile qtwebengine. In my case that would be 8Gb RAM and 72Gb swap. I'm not even going to try :/

BR, Lars.

That would mean you are building it with MAKEOPTS="-j40" ('-j1' would check for 2GiB, '-j2' would check for 4GiB etc.), so something not quite right there. :]

Zucca wrote:
That's got to be the temporary disk space requirement.

That is checked for only 8GiB.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Wed Sep 18, 2024 12:58 pm    Post subject: Reply with quote

Zucca wrote:
lars_the_bear wrote:
According to `emerge`, it need 80Gb to compile qtwebengine. In my case that would be 8Gb RAM and 72Gb swap. I'm not even going to try :/

BR, Lars.
That's got to be the temporary disk space requirement.


It's definitely RAM:

Code:

* Messages for package dev-qt/qtwebengine-6.7.2:

 * There is NOT at least 80 GiB RAM
 *
 * Memory or space constraints set in the ebuild were not met!
 * The build will most probably fail, you should:
 * - enhance the memory (reduce MAKEOPTS, add swap), or
 * - add more space
 * as required depending on the failed tests.


But...

I have in `make.conf`

Code:

EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --jobs=40 --load-average=40


I have no idea why -- I'm pretty sure I didn't put those settings there, because I have very little idea what they do. I only see them in this one machine, and I've installed Gentoo, perhaps, thirty times in the last couple of months. So I'm completely baffled.

I presume that these settings are wrong? In the past I've just put nothing, in the expectation that `emerge` will work them out.

BR, Lars.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2728
Location: Here and Away Again

PostPosted: Wed Sep 18, 2024 1:50 pm    Post subject: Reply with quote

lars_the_bear wrote:
I have in `make.conf`

Code:

EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --jobs=40 --load-average=40


I have no idea why -- I'm pretty sure I didn't put those settings there, because I have very little idea what they do. I only see them in this one machine, and I've installed Gentoo, perhaps, thirty times in the last couple of months. So I'm completely baffled.

I presume that these settings are wrong? In the past I've just put nothing, in the expectation that `emerge` will work them out.

The ebuild checks for MAKEOPTS for this, not EMERGE_DEFAULT_OPTS, but that said, 40 for 'emerge --jobs' seems pretty high as well, and could certainly explain some long compile times due to swapping.

With 'emerge --jobs 40' you could end up with 40 packages being built at the same time.

Now if MAKEOPTS has '--jobs 40' as well... that could potentially mean "build 40 packages using 40 CPUs at the same time. Of course a lot of build phases, such as configure-time, will only use 1 thread in any case, but yeah... something to look into there perhaps. :]
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Wed Sep 18, 2024 3:10 pm    Post subject: Reply with quote

Thanks. Except...

I'm pretty sure I didn't make that configuration change. Until today I had no idea that these settings existed and, having looked up what they do, I don't own any hardware for which these settings would be even remotely appropriate.

I noticed the different concurrency behaviour of `emerge`, compared to what I'm used to, as soon as I started to set up the machine. I just assumed that something has changed in the stage3 file I downloaded. But I looked in the latest stage3 of the type I use, and I don't see those settings there. I don't see them on any of my other installations, either.

So either there is, by some fluke, just one stage3 file that has these settings, and that I can no longer find, or I just had a senior moment and did something really stupid. I can imagine what everybody but me would think is the more likely explanation.

Oh, well. Whatever the explanation, I shall remove those settings.

BR, Lars.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 9261

PostPosted: Wed Sep 18, 2024 3:11 pm    Post subject: Reply with quote

No one but you could have put it there. This file is under your responsibility, as explained by the Gentoo Installation Handbook.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 517

PostPosted: Wed Sep 18, 2024 5:48 pm    Post subject: Reply with quote

asturm wrote:
No one but you could have put it there.


I can certainly see why you might think that. But, if you're right, then I'm truly losing my mind. This isn't the kind of mistake a sane person could make.
Back to top
View user's profile Send private message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1029
Location: Somewhere in Denmark

PostPosted: Wed Sep 18, 2024 6:09 pm    Post subject: Reply with quote

lars_the_bear wrote:
asturm wrote:
No one but you could have put it there.


I can certainly see why you might think that. But, if you're right, then I'm truly losing my mind. This isn't the kind of mistake a sane person could make.


Did your install start with a stage3 fetched from Gentoo-mirrors - or did you follow some other guide?
I don't recal ever (20-ish years) having emerge/portage/Gentoo having 'magically' change my make.conf (it changed from /etc/make.conf to /etc/portage/make.conf - but not without news-item iirc)
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 9261

PostPosted: Wed Sep 18, 2024 6:19 pm    Post subject: Reply with quote

That is obviously the moment where you look into the Gentoo Handbook section regarding make.conf settings. It should look familiar to you, but if not, I guess a few people would be interested by what other means you have been installing Gentoo so far.

I mean, even the statement about having it installed more than 30 times during a couple of months raises a big red flag to me. You would be an expert in Gentoo configuration by now.

@freke: even that change was manual. It is still in the old location on a couple of systems of mine.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20484

PostPosted: Wed Sep 18, 2024 10:59 pm    Post subject: Reply with quote

Chiitoo wrote:
Yes, with the source build, if USE="-pulseaudio" you get the ALSA backend enabled automatically (there is no USE="alsa" there), and 'media-sound/apulse' is a dependency only if USE="pulseaudio" (it needs to be installed first, or 'media-libs/libpulse' will be pulled in instead):
So either apulse or libpulse is still required, correct? What's the difference? I have apulse installed, but emerge says I can remove it because nothing depends on it. I use firefox esr from source, and libpulse is not installed.
emerge -cav apulse:
>>> These are the packages that would be unmerged:

 media-sound/apulse
    selected: 0.1.13-r3
   protected: none
     omitted: none

All selected packages: =media-sound/apulse-0.1.13-r3

_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Navar
Guru
Guru


Joined: 20 Aug 2012
Posts: 355
Location: usa

PostPosted: Wed Sep 18, 2024 11:58 pm    Post subject: Reply with quote

Code:
$ equery d apulse
 * These packages depend on apulse:
games-util/steam-client-meta-0-r20211228 (!pulseaudio ? media-sound/apulse[abi_x86_32])
mail-client/thunderbird-115.14.0 (pulseaudio ? >=media-sound/apulse-0.1.12-r4[sdk])
media-sound/spotify-1.2.42 (!pulseaudio ? media-sound/apulse)
www-client/firefox-115.14.0 (pulseaudio ? >=media-sound/apulse-0.1.12-r4[sdk])
$ grep -i pulse /etc/make.conf
USE="-avahi -gnome -hal -ipv6 -libav -systemd -pulseaudio -gnome-keyring          \
$ ls -ld /etc/make.conf
lrwxrwxrwx 1 root root 17 Sep 14  2020 /etc/make.conf -> portage/make.conf


These are all more or less various forms of the same outcome for logic on dependency. Which is why I'm forced to dig into the actual ebuild to [strike]sanity check[/strike] confirm, again.

Code:

COMMON_DEPEND="${FF_ONLY_DEPEND}
...
    pulseaudio? (
        || (
            media-libs/libpulse
            >=media-sound/apulse-0.1.12-r4[sdk]
        )
    )


I read that as a || bash OR short circuit logic test, if left hand side not true, continue (it may be POSIX compliant too, irrelevant to deeper discussion and don't care). If -pulseaudio (which you'd usually expect to see ref'ed as !pulseaudio), then it goes off requiring the other two. Which circles back to the aforementioned bugzilla from 8+ years ago on The Great Decision. Likely to consolidate API calling code involved instead of maintaining if(not pulse audio but alsa present) {do this}. I get it, involved devs can generally do as they like, or as their corporate dictators encourage. Or fork it with all our free time and perhaps enjoy public lashings, if it gains any popularity, on why your changes == bad. This was one of the reasons I went to Gentoo around 2008. The broken pulseaudio shovelfest was too time consuming, inconsistent garbage in Ubuntu, etc. and yet forced into production, permanently. That said, I do greatly miss when pulseaudio was mostly one of the biggest concerns of the day in FOSS. ;)

tl;dr: the equery output shows source related packages logic depending on apulse replacement when -pulseaudio use is set.
_________________
(I don't speak for/represent my current employer)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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