crouton: Unable to compile CRAS

I have been trying to create a chroot with target audio and I get this error

Compiling CRAS (i386)...
In file included from libcras/cras_client.c:47:
libcras/cras_client.h:1439:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1454:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1475:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1491:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1506:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1530:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1550:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1570:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1592:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1608:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1623:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1638:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1653:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1668:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1683:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1732:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1753:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1767:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1784:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1799:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1815:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1831:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1847:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1878:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1893:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1908:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1924:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1940:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1955:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1970:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:1985:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
libcras/cras_client.h:2000:1: error: 'cfi-icall' attribute directive ignored [-Werror=attributes]
 {
 ^
cc1: all warnings being treated as errors
Failed to complete chroot setup.

I tried changing the releases to xenial, bionic, focal, sid, stretch and none of them worked. I even tried gcc-7, gcc-9, gcc-10, gcc-11 and still the same error. If -Wno-error=attributes flag is added to the make target, this issue can be resolved. Any help would be greatly appreciated!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (6 by maintainers)

Most upvoted comments

@haberda That’s a great find! This issue arises because of -Werror in the Makefile of CRAS. It considers all the warnings as errors. So I developed a simple fix to overcome this. Just follow your steps of 1,2. In step 3, instead of deleting the contents after line 12, just add this command in line 119 in audio target file - sed -i 's/-Werror//g' Makefile.am. This will remove any occurrence of -Werror in the Makefile. CRAS will then compile successfully. You can follow the remaining steps as it is. This fix will allow you to have audio working in your chroot instead of completely removing it.

I managed a temporary workaround. Please note, there will be no audio working, but it seems everything else does:

  1. If you haven’t done so, install crouton according to the docs
  2. In the console run sudo crouton -x ~/mylocation Where mylocation is a folder where you can extract crouton to
  3. Navigate to the mylocation folder in the file browser, you will see a number of folders, open the targets folder and open the audio file with a text editor and delete everything below line 12, save.
  4. Now in the console, assuming you are in the mylocation folder, you can run all the same crouton commands by: sudo ./installer/main.sh

Alternatively, you could probably just clone the repo to the local machine and just do the same thing without installing it, but I don’t know what the implications of that are.

@haberda That’s a great find! This issue arises because of -Werror in the Makefile of CRAS. It considers all the warnings as errors. So I developed a simple fix to overcome this. Just follow your steps of 1,2. In step 3, instead of deleting the contents after line 12, just add this command in line 119 in audio target file - sed -i 's/-Werror//g' Makefile.am. This will remove any occurrence of -Werror in the Makefile. CRAS will then compile successfully. You can follow the remaining steps as it is. This fix will allow you to have audio working in your chroot instead of completely removing it.

@sandeep-gh Please try this, it works for me.

Update: Thanks to DennisLfromGA for showing me where the fix was merged in. By switching from Stable to Beta I was able to hitch a ride on the fixed build, and now CRAS compiles.

@haberda Great! I was caught up with something else, I was gonna work on submitting a PR in a couple of hours 😬