-   Linux - Kernel (
-   -   How to redirect compilation/build error to a file? (

archieval 09-08-2010 10:42 PM

How to redirect compilation/build error to a file?
Hello everyone,

How do you redirect or save compilation errors to a file? This is useful for building kernel since most warning and errors are too many sometimes?

For example, how to save/capture the "make[x]: *** Error " and warnings here?


archie@archie-desktop:~/od-kernel/kernel$ make modules | awk '{print}' | tee sample
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
drivers/media/video/samsung/tv20_ap/acc_tvout.c: In function 'init_sd':
drivers/media/video/samsung/tv20_ap/acc_tvout.c:332: error: expected ';' before '}' token
drivers/media/video/samsung/tv20_ap/acc_tvout.c: At top level:
drivers/media/video/samsung/tv20_ap/acc_tvout.c:530: warning: initialization from incompatible pointer type
make[5]: *** [drivers/media/video/samsung/tv20_ap/acc_tvout.o] Error 1
make[4]: *** [drivers/media/video/samsung/tv20_ap] Error 2
make[3]: *** [drivers/media/video/samsung] Error 2
make[2]: *** [drivers/media/video] Error 2
make[1]: *** [drivers/media] Error 2
make: *** [drivers] Error 2
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CALL scripts/
CC [M] drivers/media/video/samsung/tv20_ap/acc_tvout.o
perl or awk scripts are also appreciated.


archieval 09-08-2010 11:19 PM

I have found some solutions. >__<

$ gcc temp.c &> error.log

% gcc temp.c |& tee error.log

bsat 09-09-2010 03:27 AM

gcc temp.c > error.log 2>&1

Redirects stdout and stderr to error.log.

All times are GMT -5. The time now is 09:30 PM.