dnschneid / crouton

Chromium OS Universal Chroot Environment
https://goo.gl/fd3zc?si=1
BSD 3-Clause "New" or "Revised" License
8.58k stars 1.24k forks source link

Figure out a way to build audio target now that autotools is removed #4958

Open drinkcat opened 1 year ago

drinkcat commented 1 year ago

https://chromium.googlesource.com/chromiumos/third_party/adhd/+/879fe7a51784eb07d1b85473d8927050fb000f87 removed cras/src/Makefile.am that we used to rely on.

Not sure how we can work around this, implementing a bazel parser is definitely not something I'm looking forward to.

drinkcat commented 1 year ago

That CL landed in 15378.0.0.

5 options from discussion with @dnschneid :

  1. On >=15378.0.0, fix cras fetch version to 879fe7a51784eb07d1b85473d8927050fb000f87^. IMHO that'll break fairly quickly as the structures change.
  2. On >=15378.0.0 fetch Makefile.am from 879fe7a51784eb07d1b85473d8927050fb000f87^. That might last a bit longer and we can still patch changes as needed.
  3. Deprecate audio target.
  4. Implement Bazel to shell converter.
  5. Audio over websocket.

4/5 are like, intern-sized project, so non-starter.

I think we'll end up with 3 eventually, but 2 should be easy to implement.

Basically, we just need to add a download step around here: https://github.com/dnschneid/crouton/blob/master/targets/audio#L59

mkdir -p "$CRASBUILDTMP/cras/src"
wget https://chromium.googlesource.com/chromiumos/third_party/adhd/+/c2ece09f69565afcbcf511b1693f3fe735bde511/cras/src/Makefile.am?format=TEXT -O- | base64 -d > "$CRASBUILDTMP/cras/src/Makefile.am"

(this can be done unconditionally as the extraction phase would override it)

CroutonIsFun commented 1 year ago

Why can't we just eliminate cras? If you install a basic core, e.g.,

sudo crouton -r focal -t core

then from within the chroot, install alsa-utils, e.g.,

sudo apt install alsa-utils

my experience is that you can both record and play audio using, .e.g., arecord and aplay.

I've always been able to do this in crouton. So why do we even need the cras module?

drinkcat commented 1 year ago

That should indeed work in many cases. Volume control will not integrate well though (nor any of the cras-applied volume curves, for example), and only integrated audio would work (no BT/USB headset). And there might be some weird interactions between cras and whatever userspace app.

CroutonIsFun commented 1 year ago

Thanks, drinkcat. I realize how little I know about the inner workings of crouton. You've been involved as long as I can remember. Thanks for your contributions.

CroutonIsFun commented 1 year ago

The main branch is still not fixed. How do I download your branch?

CroutonIsFun commented 1 year ago

Is Google intentionally sabotaging Crouton?

drinkcat commented 1 year ago

Is Google intentionally sabotaging Crouton?

This one is easy to answer. No, absolutely not. Chrome OS devs are moving forward and unintentionally breaking things in crouton. This happened many times throughout the years, and we could usually play catch up. This time, none of us have time (or even hardware) to test these fixes locally, so we'd need somebody from the community to step up.

DennisLfromGA commented 1 year ago

@CroutonIsFun,

I think it can be tested using the new experimental branch 'longliveautotools' like this:

Enter the crouton options you would normally use to add or update a chroot in the command above.

-DennisLfromGA

ducksosu commented 1 year ago

@DennisLfromGA i tried it out with the command and cras compiles perfectly but then this happens, cp: cannot stat 'Makefile.am': No such file or directory Failed to complete chroot setup. Unmounting /mnt/stateful_partition/crouton/chroots/jammy...

DennisLfromGA commented 1 year ago

@ducksosu,

That's strange since the PR downloads a previous 'lastgoodam', not sure why it's failing, sorry. Maybe @drinkcat [EDIT: or @dnschneid] will know.

-DennisLfromGA

dnschneid commented 1 year ago

I pushed a small change to hopefully fix that. Give it another shot, @ducksosu?

ducksosu commented 1 year ago

@dnschneid i tried and and its back to the first problem Compiling CRAS (i386)... gcc: error: unrecognized command-line option '-Wundef-prefix=HAVE_,CRAS_' Failed to complete chroot setup. Unmounting /mnt/stateful_partition/crouton/chroots/jammy...

dnschneid commented 1 year ago

Yeah, this fix needs to be combined with whatever fix for #4923, unfortunately.

CroutonIsFun commented 1 year ago

Thanks for the feedback, guys!

I also tried the longliveautotools branch:

Compiling CRAS (i386)... gcc: error: unrecognized command line option '-Wundef-prefix=HAVE,CRAS' Failed to complete chroot setup.

Edit: Disregard the below. The i386 is needed by AutoTools, otherwise we wouldn't be adding it.


̶S̶o̶ ̶h̶e̶r̶e̶'̶s̶ ̶a̶n̶o̶t̶h̶e̶r̶ ̶o̶u̶t̶s̶i̶d̶e̶-̶t̶h̶e̶-̶b̶o̶x̶ ̶s̶u̶g̶g̶e̶s̶t̶i̶o̶n̶:̶ ̶e̶l̶i̶m̶i̶n̶a̶t̶e̶ ̶t̶h̶e̶ ̶i̶3̶8̶6̶ ̶a̶r̶c̶h̶i̶t̶e̶c̶t̶u̶r̶e̶.̶ ̶W̶h̶y̶ ̶i̶s̶ ̶i̶t̶ ̶n̶e̶e̶d̶e̶d̶?̶


I think I was using crouton before cras was baked into the chroot. Also, it used to be that focal would install without cras, and I could access the sound card(s) directly using qjackctl and qsynth. But soon enough, the "oversight" was fixed.

There are many use cases without the need for pretty sounds. Option 3 above, deprecate audio, is looking better and better. If crouton is going to break early and often, and take days or weeks to be fixed, then it's useless, save as an intellectual curiosity.

I'm trying to keep the people on r/Crouton apprised of the situation, many of whom have no clue where to look for help. Thanks for all you guys do and have done over the years.

James :)

ducksosu commented 1 year ago

so if i removed the '-Wundef-prefix=HAVE,CRAS' option from the makefile would that cause any issues with cras or sound in general

CroutonIsFun commented 1 year ago

All you can do is try it and see what happens

ducksosu commented 1 year ago

@CroutonIsFun yeah still trying to figure out where the makefile is though. do you know?

IsolatedRainbow commented 1 year ago

@ducksosu Would this be it?

https://github.com/dnschneid/crouton/blob/9eaac08b3ffc3994a3eb64ee6dca313b09cba006/targets/audio

DennisLfromGA commented 1 year ago

@ducksosu,

The new audio file is in the 'longliveautotools' branch, you can find it here:

Look at lines 60-65 where the Makefile.am is downloaded. You could modify the file to add the sed command below:

-DennisLfromGA

ducksosu commented 1 year ago

@DennisLfromGA if i want to get rid of

gcc: error: unrecognized command-line option '-Wundef-prefix=HAVE_,CRAS_'
Failed to complete chroot setup. 

do i replace my old one with the new one and not add the sed commmand?

IsolatedRainbow commented 1 year ago

Running the below is prompting me to include the sed i think

sudo CROUTON_BRANCH=longliveautotools crouton -t xfce
image

IsolatedRainbow commented 1 year ago

What distro are you selecting to install?

ducksosu commented 1 year ago

@IsolatedRainbow ubuntu jammy with xfce

IsolatedRainbow commented 1 year ago

I stopped getting that error with specifying the branch. I'm hoping that the devs have an idea about whats going on. Im happy to help however I can. Just recently learned about Crouton so excited to use it

ducksosu commented 1 year ago

@IsolatedRainbow with the longliveautotools branch?

IsolatedRainbow commented 1 year ago

yeah

ducksosu commented 1 year ago

which distro did you install @IsolatedRainbow

IsolatedRainbow commented 1 year ago

sudo CROUTON_BRANCH=longliveautotools crouton -t xfce -u

I'm attempting to install xfce xenial

ducksosu commented 1 year ago

im gonna try xenial just to see if its just jammy doing it

ducksosu commented 1 year ago

@IsolatedRainbow what version of chromeos are you on because this issue is only for chromeos 111

IsolatedRainbow commented 1 year ago

Chrome 112? image

ducksosu commented 1 year ago

@IsolatedRainbow ok so i just updated my chromebook and now im getting the cras_messages.h not found error

Promethilaus commented 1 year ago

so as of right now is there no solution other then rolling back the version?

ducksosu commented 1 year ago

so as of right now is there no solution other then rolling back the version?

yes. im trying to figure out how i can modify the makefile to get maybe a temp fix until either the chromeos devs fix the situation or the crouton devs find a fix.

Promethilaus commented 1 year ago

if there is any way i can help let me know i dont mind testing different versions of chrome os or different configurations of the command even if it potentially screws up the install

EDIT: One thing to note is that brioche from sebanc can be a good temporary alternative BUT ONLY IF YOU USE BRUNCH DO NOT INSTALL ON A NORMAL CHROMEBOOK

ducksosu commented 1 year ago

well testing different versions of chromeos would be easy to figure out. 110 is the one that works. however, i feel like the devs will want to keep crouton accessible to everyone because with rolling back versions you need to have sd card/usb drive which not everyone has. and what do you mean by different command configs?

Promethilaus commented 1 year ago

I mean the command to install crouton and how you can use different distros, desktops and stuff like that

ducksosu commented 1 year ago

since cras is having problems and every distro uses cras that wouldnt work. i guess you could install a distro without a desktop and build cras yourself and then install a desktop.

Promethilaus commented 1 year ago

alright ill give it a try

ducksosu commented 1 year ago

is there anyway we can make a cras_messages.h file and put the correct code and stuff in it?

thatoneguy85 commented 1 year ago

I made bionic chroot with pulseaudio not very long ago.

The issue with jammy, Focal When i try this: sudo crouton -n focal -t xorg,keyboard,extension -u

I get this:

Sed: can't read common/cras_messages.h: No such file or directory

Any fixes being figured out by the crouton devs? I don't mind helping.

ducksosu commented 1 year ago

@thatoneguy85 look at the 2nd comment

thatoneguy85 commented 1 year ago

@ducksosu Still receiving the same error after adding that into the text Screenshot 2023-04-15 8 44 31 PM

CroutonIsFun commented 1 year ago

Reverting to 110 allows crouton to install with audio. My question is, will the audio still work after I update my Chromebook back to 111? Since cras is already compiled, maybe it will work.

However, new chrome os versions are the main reason for having to update your chroot with crouton. I'll let you know what happens.

Edit: My sound still works in 111. However, I'm using an external USB audio device and I'm communicating directly with it inside my crouton chroot. When I bring up alsamixer, and focus on cras, I'm still getting sound, even with cras turned all the way down.

I'm perfectly fine with my solution. I'm running the most recent ChromeOS version, and I'm also running crouton. Whoop!!!

ducksosu commented 1 year ago

@CroutonIsFun so you reverted to 110 to download the audio target and then updated and it still works?

CroutonIsFun commented 1 year ago

@CroutonIsFun so you reverted to 110 to download the audio target and then updated and it still works?

Yes!!! Realize that once you update to 111, you will not be able to update your chroot using crouton. Within the chroot, you can still go

sudo apt update

and so forth.

At some point, maybe 112, 113, 114, etc. the audio may fail to work. Then, we're screwed, unless someone figures out a way to fix the underlying problem.

ducksosu commented 1 year ago

@CroutonIsFun does reverting to 110 powerwash the chromebook

VenomousSteam81 commented 1 year ago

Hello, trying out Focal with unity and this env: CROUTON_BRANCH=longliveautotools. I will edit this message if it still gives me the error or not. I tried to install crouton 1 or 2 weeks ago, which didn't work. I'm probably not helping much here but oh well.

edit 1: it has seemed to get past the error message. i also read up further and noticed that dnschneid fixed by adding that branch

edit 2: i was very wrong. it failed with the same error, sed: can't read common/cras_messages.h: No such file or directory here is the command i'm using bash ~/Downloads/rcrouton.sh && sudo CROUTON_BRANCH=longliveautotools crouton -r focal -t audio,cli-extra,core,keyboard,unity,x11,xorg -p /media/removable/USB\ Drive/ the extra file rcrouton.sh just remounts my usb

edit 3: i've read some of this issue some more, and i now see that focal and jammy are having the issue. i will try with a debian distro and see if that fixes it. btw im on chrome v112.0.5615.62 (Official Build) (64-bit)

edit 4: i'm now trying debian buster with xfce and that same argument from above. i will edit AGAIN if it gives me that same error, or any other error (unless its because my usb got moved and unmounted)

thatoneguy85 commented 1 year ago

Trying to make use of ChatGPT to see if it can help with the current Cras issue. I'm very new to this and i'm sure not all of us here are "interns". Maybe someone here can ask the right questions in ChatGPT to help us solve it with the given last 3 options that drinkcat has mentioned in his 2nd comment.

Here's what i got from ChatGPT:

Screenshot 2023-04-17 2 23 05 PM

Screenshot 2023-04-17 2 22 15 PM

I'm not sure how accurate this script exactly is and how it can be implemented into Crouton. If anyone can follow up or solve it with right questions to get Crouton working again then post here. :)

ducksosu commented 1 year ago

edit 3: i've read some of this issue some more, and i now see that focal and jammy are having the issue.

@VenomousSteam81 its all of them not just focal and jammy. as long as you have a desktop it will download the audio target, which is not possible right now.