LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How to redirect compilation/build error to a file? (https://www.linuxquestions.org/questions/linux-kernel-70/how-to-redirect-compilation-build-error-to-a-file-831099/)

archieval 09-08-2010 09: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?

Quote:

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/checksyscalls.sh
CC [M] drivers/media/video/samsung/tv20_ap/acc_tvout.o
perl or awk scripts are also appreciated.

Thanks,
archieval

archieval 09-08-2010 10:19 PM

I have found some solutions. >__<

bash:
$ gcc temp.c &> error.log

csh:
% gcc temp.c |& tee error.log

bsat 09-09-2010 02: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 01:03 PM.