How to extract source files when using a special compiler (e.g. TMS320C2000 C/C++ Compiler)?
- 主要语言
- CodeQL
- 星标
- 10.1k
- 派生
- 2.1k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 141
描述
When I first created a database by `codeql-cli` for C/C++ source files for some embedded system software codes generated by [Code Composer Studio](https://www.ti.com/tool/CCSTUDIO), it failed to extract any source file even though the `gmake` build process ran successfully.
I found the root cause is that the `makefile` takes TMS320C2000 C/C++ Compiler as the compiler for the project. Even when I only have the `helloworld.c` as:
```c
int main() {
return 0;
}
```
`build.sh` as
```sh
"C:\ti\ccs1100\ccs\tools\compiler\ti-cgt-c2000_21.6.0.LTS\bin\cl2000" helloworld.c
```
And run the command as:
```sh
codeql database create cpp-database-01 --language=cpp --command="bash build.sh"
```
No source file can be extracted and the error message shows:
```
No source code was seen and extracted to ****
This can occur if the specified build commands failed to compile or process any code.
- Confirm that there is some source code for the specified language in the project.
- For codebases written in Go, JavaScript, TypeScript, and Python, do not specify
an explicit --command.
- For other languages, the --command must specify a "clean" build which compiles
all the source code files without reusing existing build artefacts.
(base)
```
I guess the extractor in `codeql` fails to monitor the compilation process of TMS320C2000 C/C++ Compiler, which technically can be traced as it has similar usages to take source/lib/include files with other compilers (e.g., `gcc`, `clang`).
I really want to apply `codeql` on those codes compiled by some special compilers to do some security analysis, but get stock with the extraction of source files. How can I fix the problem? Can I change some extractor configuration? Or if there is any direction to modify the source code of `codeql` to generalize the compiler requirement? Or can I add the source files to the database manually?
Thank you very much.
贡献指南
评估
这个 Issue 还没有评估数据。