Error! Sometimes they are hard to find!

Sometimes errors can be nested deep in the terminal output, in fact, sometimes it is so deep that you have to scroll back several HUNDRED LINES just to find it. Consider this real example from helping a fellow developer:

[CODE]

….EDITED FOR SPACE….
….LINE# 135….

device/samsung/grandprimeve3g/libs/audio/audio_hw.c:666:34: error: ‘AUDIO_DEVICE_OUT_FM_SPEAKER’ undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, “speaker” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:667:75: error: ‘AUDIO_DEVICE_OUT_FM_HEADSET’ undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_FM_HEADSET, “headphone” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:670:44: error: ‘AUDIO_DEVICE_OUT_ALL_FM’ undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_ALL_FM, “line” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:684:32: error: invalid operands to binary | (have ‘int’ and ‘const struct dev_names_para_t *’)
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, “speaker” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:684:5: error: initializer element is not constant
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, “speaker” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:684:5: error: (near initialization for ‘dev_names_digitalfm[0].mask’)
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:685:73: error: invalid operands to binary | (have ‘int’ and ‘const struct dev_names_para_t *’)
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_FM_HEADSET, “headphone” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:685:5: error: initializer element is not constant
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_FM_HEADSET, “headphone” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:685:5: error: (near initialization for ‘dev_names_digitalfm[1].mask’)
In file included from device/samsung/grandprimeve3g/libs/audio/audio_hw.c:810:0:

….EDITED FOR SPACE….
….LINE# 843….

build/core/binary.mk:803: recipe for target ‘/home/hassan/Working/LiquidDark-RRO-Layer-Ih24n/out/target/product/grandprimeve3g/obj/SHARED_LIBRARIES/audio.primary.sc8830_intermediates/audio_hw.o’ failed
make: *** [/home/hassan/Working/LiquidDark-RRO-Layer-Ih24n/out/target/product/grandprimeve3g/obj/SHARED_LIBRARIES/audio.primary.sc8830_intermediates/audio_hw.o] Error 1
make: *** Waiting for unfinished jobs….

….EDITED FOR SPACE….
….LINE# 990….

device/samsung/grandprimeve3g/libs/audio/record_process/aud_proc_config.c:956:5: warning: (near initialization for ‘recordeq_filter_set[0]’) [-Wmissing-braces]
device/samsung/grandprimeve3g/libs/audio/record_process/aud_proc_config.c: In function ‘AUDPROC_ProcessDp’:
device/samsung/grandprimeve3g/libs/audio/record_process/aud_proc_config.c:1319:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(si=0;si<uiSrcCount;si++)//AUDIO POST PROCESS
^

#### make failed to build some targets (53:06 (mm:ss)) ####

Total time elapsed: 53 minutes 12 seconds

[/CODE]

As you can see, the "make failed" line is around line 990 of the terminal output. However, the line that actually shows that make has an error is back at line 840, and the reason make has an error is all the way back at line 135! Sometimes what we are looking for is really hard to find, especially if you are scrolling through seemingly endless terminal outputs trying to read every line, looking for your failure.

One great trick that you can use is to copy your output into a text file. Then you can use standard search tools, like grep, or even your text applications search functions to find key words like: error, fail, stop, forbidden warning, or other similar words that clue you in to the real problem.

In this case, the issue that he had was captured in line 135 of his copied output from the terminal:

[CODE]

device/samsung/grandprimeve3g/libs/audio/audio_hw.c:666:34: error: 'AUDIO_DEVICE_OUT_FM_SPEAKER' undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, "speaker" },

[/CODE]

There are several options, one of which is this:

The audio_hw.c file line 666:

{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, "speaker" },

Wecould remove "AUDIO_DEVICE_OUT_FM_SPEAKER"

Like this:
{ AUDIO_DEVICE_OUT_SPEAKER, "speaker" },

And do the same for the other lines with errors. The compiler is saying that it does not know what AUDIO_DEVICE_OUT_FM_SPEAKER is, so we either need to declare it or get rid of it. To declare it is tricky and would take a little bit of ingenuity and fore thought, as well as a full understanding of what it should be declared as. If we remove it, then that function will not work. E.G., the Audio device out FM speaker. As long as you have the main other speakers defined, then it should work. If the sound then does not work in the finished product, then we can come back and declare it instead.

Sometimes there are other options for something that doesn't exist in your phone model, other times, these items need to be declared from your device tree as either existing or not, and if so, what they are supposed to be declared as. Either way, it was fun to help another developer with their project, and I am sure that they will turn out some great work!

Linux – keep it simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s