mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.61k stars 534 forks source link

how to use sccache for ccv850( or how to add complier type for sccache)? #2138

Open chenx319 opened 4 months ago

chenx319 commented 4 months ago

i use a complier of greenhills(ccv850.exe), a gcc-like complier. i want to use sccache to fasten my build . but it seems sccache not support it.

can you kindly give me some help? thanks!

the detail error as follow:

`D:\CX\SW\ccachetest>sccache ccv850.exe -filetype.c main2.c -c main2.o

[2024-03-24T14:46:09Z DEBUG sccache::config] Attempting to read config file at "C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config"

[2024-03-24T14:46:09Z DEBUG sccache::config] Couldn't open config file: failed to open file C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config

[2024-03-24T14:46:10Z DEBUG sccache::commands] Server sent UnsupportedCompiler: ""

sccache: error: failed to execute compile

sccache: caused by: Compiler not supported: ""`

AJIOB commented 4 months ago

If you can, you may rename the ccv850.exe to the gcc.exe if your compiler continue to work.

chenx319 commented 4 months ago

hello @AJIOB , thanks for you help!

it failed after I rename it . but it seems sccache seems to execute it , so i have to find a new solution .

the detail as follow:

D:\CX\SW\ccachetest>sccache gcc.exe -filetype.c main2.c -c main2.o
[2024-03-26T22:06:58Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\abc\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-03-26T22:06:58Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\abc\AppData\Roaming\Mozilla\sccache\config\config`
[2024-03-26T22:07:00Z DEBUG sccache::commands] Server sent UnsupportedCompiler: "gcc: Error: can\'t find project \"C:\\greenhills_rel\\4\\target\\win32.bld\"\r\n"
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "gcc: Error: can\'t find project \"C:\\greenhills_rel\\4\\target\\win32.bld\"\r\n"    
AJIOB commented 4 months ago

Is the sccache gcc.exe main2.c -c main2.o works nice?

I cannot find any info about -filetype.c flag for GCC.

Also, are the usual commands ccv850.exe -filetype.c main2.c -c main2.o and ccv850.exe main2.c -c main2.o work without error?

P.S. You can use triple-` at the start and in the end of your pasted logs/code for having the nicer view. More info here

chenx319 commented 4 months ago

@AJIOB thanks again !

ccv850.exe -filetype.c main2.c -c main2.o and ccv850.exe main2.c -c main2.o work without error

I try one :

D:\CX\SW\ccachetest2>dir /b
main2.c

D:\CX\SW\ccachetest2>ccv850.exe  main2.c -c main2.o
ccv850: Warning: file 'main2.o' ignored with these options

D:\CX\SW\ccachetest2>dir /b
main2.c
main2.o

D:\CX\SW\ccachetest2>

I delete main2.o, then try two as follow:

D:\CX\SW\ccachetest2>dir /b
main2.c

D:\CX\SW\ccachetest2>ccv850.exe -filetype.c main2.c -c main2.o
ccv850: Warning: file 'main2.o' ignored with these options

D:\CX\SW\ccachetest2>dir /b
main2.c
main2.o

D:\CX\SW\ccachetest2>

I copy some information about -filetype.c

Manually Setting Input File Types On the command line, use -filetype.suffix to indicate that the next file on the command line has the type appropriate for suffix. For example: ccv850 -filetype.cc hello.i compiles hello.i as if it were a C++ file. To process all C files as C++ files, use the following syntax: cxv850 -dotciscxx files Note that these options should not be used in the Builder.

some other tests:

D:\CX\SW\ccachetest2>sccache ccv850.exe  main2.c -c -o main22.o
[2024-03-27T14:00:38Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\xia.chen\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-03-27T14:00:38Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config`
[2024-03-27T14:00:40Z DEBUG sccache::commands] Server sent UnsupportedCompiler: ""
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: ""

D:\CX\SW\ccachetest2>sccache gcc.exe  main2.c -c -o main22.o
[2024-03-27T14:00:59Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\xia.chen\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-03-27T14:00:59Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config`
[2024-03-27T14:00:59Z DEBUG sccache::commands] Server sent UnsupportedCompiler: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"

D:\CX\SW\ccachetest2>sccache gcc.exe  main2.c -c main22.o
[2024-03-27T14:01:21Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\xia.chen\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-03-27T14:01:21Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config`
[2024-03-27T14:01:21Z DEBUG sccache::commands] Server sent UnsupportedCompiler: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"

D:\CX\SW\ccachetest2>sccache ccv850.exe  main2.c -c  main22.o
[2024-03-27T14:01:36Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\xia.chen\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-03-27T14:01:36Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config`
[2024-03-27T14:01:36Z DEBUG sccache::commands] Server sent UnsupportedCompiler: ""
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: ""

D:\CX\SW\ccachetest2>

gcc.exe is a copy of ccv850.exe

AJIOB commented 4 months ago

If you have time, try to check if usual gcc (such as mingw64-gcc) works correctly on Windows.

Looks like we have some problems with it on Windows.

P.S. About -filetype.c: it may be the reason not to cache, because it is not gcc-one P.P.S. What about this one: sccache gcc main2.c -c main22.o and pure gcc main2.c -c main22.o, where gcc.exe is ccv850.exe copy?

AJIOB commented 3 months ago

One more note: if you really have time for implementing support for new compiler, you can refer to the #2045 as an example of it.

chenx319 commented 3 months ago

@AJIOB thanks for your help!

chenx319 commented 3 months ago

If you have time, try to check if usual gcc (such as mingw64-gcc) works correctly on Windows.

Looks like we have some problems with it on Windows.

P.S. About -filetype.c: it may be the reason not to cache, because it is not gcc-one P.P.S. What about this one: sccache gcc main2.c -c main22.o and pure gcc main2.c -c main22.o, where gcc.exe is ccv850.exe copy?

if i use gcc, it works correctly

PS: 1 yes , this is not a standard gcc 2 from https://github.com/mozilla/sccache/issues/2138#issuecomment-2020398597 you give a suggestion that rename the ccv850.exe to gcc.exe. I don't rename it , but I copy ccv850.exe to gcc.exe

AJIOB commented 3 months ago

I don't rename it , but I copy ccv850.exe to gcc.exe

A1. Yes. Try not to pass .exe extension for sccache's gcc arg. Maybe it will help you with compiler detection.

Also, try to pass full path compiler argument, such as c:/awesome-compiler/gcc (A2) and c:/awesome-compiler/gcc.exe (A3).

The A letter was used just for referencing, nothing else.

AJIOB commented 3 months ago

Hi again, @chenx319

Is the question resolved?

chenx319 commented 3 months ago

I don't rename it , but I copy ccv850.exe to gcc.exe

A1. Yes. Try not to pass .exe extension for sccache's gcc arg. Maybe it will help you with compiler detection.

Also, try to pass full path compiler argument, such as c:/awesome-compiler/gcc (A2) and c:/awesome-compiler/gcc.exe (A3).

The A letter was used just for referencing, nothing else.

still failed , detail as follow

D:\CX\SW\ccachetest>sccache.exe C:\toolbase\greenhills_rel\comp_202115_2fp_x64\gcc  main2.c -c main2.o
[2024-04-03T13:37:40Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\xia.chen\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-04-03T13:37:40Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config`
[2024-04-03T13:37:41Z DEBUG sccache::commands] Server sent UnsupportedCompiler: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"

D:\CX\SW\ccachetest>
D:\CX\SW\ccachetest>sccache.exe C:\toolbase\greenhills_rel\comp_202115_2fp_x64\gcc.exe  main2.c -c main2.o
[2024-04-03T13:35:57Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\xia.chen\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2024-04-03T13:35:57Z DEBUG sccache::config] Couldn't open config file: failed to open file `C:\Users\xia.chen\AppData\Roaming\Mozilla\sccache\config\config`
[2024-04-03T13:35:57Z DEBUG sccache::commands] Server sent UnsupportedCompiler: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "gcc: Error: can\'t find project \"C:\\toolbase\\greenhills_rel\\comp_202115_2fp_x64\\target\\win32.bld\"\r\n"

D:\CX\SW\ccachetest>
chenx319 commented 3 months ago

One more note: if you really have time for implementing support for new compiler, you can refer to the #2045 as an example of it.

thanks for your information , Rust is a new language to me , I need a long time to learn it and understand the sccache's concept