New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General issue (No source was seen and extracted) #10132
Comments
|
The CodeQL C/C++ analyser tracks which source files are compiled during the build process. The error message says that CodeQL somehow did not "see" any source files. This can have various causes:
Could you have a look at Could you have a look in the If there are few (or no) files in the zip file then CodeQL likely failed to detect the compiler calls. In this case you best have a look at the |
|
thank you for the valuable information, any idea? |
Apologies, the |
|
Ok, in that case we should have a look in the One thing to check; did you run |
|
I am running all the steps in docker container in the interactive mode. |
|
The build-tracer.log file tends to be very large and repetitive and it can be a bit challenging to find the interesting parts. It would be good to look for lines like If you are comfortable sharing the contents of the build-tracer.log file (please |
|
Please have a review on this attached .zip |
|
I found the relevant bits of the build-tracer.log . I think CodeQL could not understand the output of and |
|
Thank you very much for the identification, I hope we will have some good fix. second, I need one clarification, Thanks :) |
You could skip the first compilation and compile your code only once with CodeQL. CodeQL shouldn't change the compilation process. If you're using the https://github.com/github/codeql-action them you can add a You can do something similar with the |
|
Hi aibaars, Thanks:) |
|
@FaiqueAli There is no fix yet. In the mean time, could you try switching to |
|
How can I switch to them? |
|
@FaiqueAli I think |
|
Well, I have compiled the code it has been compiled but while generating the database it pop up error.. also, it seems that the compiler is not compatible with the code as it takes too much time to compile code.. Have a look at the attached log file below.. |
|
@FaiqueAli It is normal for the compilation to get slower when running CodeQL. The CodeQL analyser is like a C compiler, so when running CodeQL actually 2 compilers are being run. Therefore a slowdown of 2-3 times the normal compilation is quite common. The error message about the evaluator heap surprises me a little. Does this machine (or the docker container) have very little memory? I believe if no |
|
without --ram flag I am still getting the same error, infact I close all running processes and restarted my pc. having --ram flag I am getting current codeql CLI create query is |
|
@FaiqueAli you need to write something like |
|
still getting same with error : |
|
@FaiqueAli could you also add the following flag It would also be great if you could share the logs of the |
|
Hi, is that everything normal? Second, I can not actually change the compiler setting and build commands, so I can not use this GCC compiler as per the instruction by the team. For the time, I am trying with this solution to proceed with further steps but I am actually looking for the fixes, could you please guess how much time the codeql support team will take to provide some fix for my current compiler ( |
|
@FaiqueAli Yes, that looks all normal now. It's still a bit of a mystery why this worked so badly without the memory related flags. I guess things behave slightly differently in the docker container. Other than their names I think the quickest work-around would be to specify an "additional tracing config" file to I think it should be possible to tell CodeQL to "mimic" |
|
Thank you for the detailed description, |
|
Glad we got #10188 sorted out. From CodeQL's perspective using the configuration above is indeed very similar to switching to |
|
Yes, it seems like that, Anyway, as I got my .sarif file and after uploading the result to Github it shows nothing. In fact, I made some changes in code to generate some warning or failure but still, the result count is zero. Second, I n my Github Actions there are multiple workflows being executed at the same time but I noticed in the code scanning screen in Github, it just hide/update the previous workflow, as we need to show and keep tracing on each push/ pull. |
That makes sense.
Have you checked the contents of the SARIF file? SARIF is just JSON so you can open it in a text editor and see if there are any results. Just search for any "results": [
{
"ruleId": "com.lgtm/java-queries:java/non-sync-override",
"ruleIndex": 0,
"rule": {
"id": "com.lgtm/java-queries:java/non-sync-override",
"index": 0
},
"message": {
"text": "Method 'mark' overrides a synchronized method in [org.apache.commons.io.input.ProxyInputStream](1) but is not synchronized."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/main/java/org/apache/commons/io/input/MarkShieldInputStream.java",
"uriBaseId": "%SRCROOT%",
"index": 0
},
"region": {
"startLine": 50,
"startColumn": 17,
"endColumn": 21
}
}
}
],If there are no result entries then it is expected that CodeScanning does not show any alerts. If there are results, then
I'm not sure I understand the question. The CodeScanning screen only shows the latest run to give an idea of whether things are working. |
I have applied these suggested changes and it is not working hence getting the same error |
There is probably some mistake in the script above. I don't have Windows myself so I cannot try things out. Could you look in the build-tracer.log file for hints what went wrong? See also #10132 (comment) |
|
could you please have a look into the attached log file. |
Sure, the relevant snippet is It looks like the Lua script actually works. The error message is different than the one before and it replaced |
|
Sorry for jumping in the middle of conversation. Just want to point out a place regarding this comment.
You can find snippets that could trigger some warnings from here https://codeql.github.com/codeql-query-help/cpp/. |
Hi, that works! Second, I also tried but it stuck with the same error |
You mentioned:
Which means that the team does not like changing the compiler using When you set The I hope this clarifies things a bit.
yes, that is expected. The original Lua script has |
|
Ah ok, that means tweaking the Lua script, setups the things(versioning, plateform architecutre, etc) for extractor of |
Yes that is right, the original call to |
|
Hi, For testing purposes, I updated the file manually and uploaded it by the container ID. Since it is more than 10 to 15 days we need to implement the process asap. |
|
I don't expect a fiv to be included in a released package soon. Can't you include the additional lua script in the Docker image and use the --extra-tracing-config= flag? See also #10132 (comment) |
|
In order to avail of this option, I need to include |
I understand, it would also be tricky to maintain. Having to update that file in all repositories if you need to make a change to the configuration would be a hassle. That's why I suggested including the file in a custom docker image. Not sure if that is possible for your use-case. With file approach all repositories can use the same docker image, which should be easier to maintain. |
|
Each repo has its own docker files according to project configurations. To include |
|
Thanks for clarifying. I had hoped there was at least some shared base image that all projects were using. In that case the best short-term solution would be to use the |
|
Hi Aibaars, |
The |
|
No, I actually know how to use these. |
Are you running the Otherwise you need to supply a |
No, I am just using a separate folder where my .sarif file is located and uploading it using the command Right now I am using Secondly, in my feature branch, I got the result of codeql which shows an error(as a result of codeql analysis) but when I go to the security>code scanning tab inside Similarly, it counts the total lines but it is not counting the total number of user-written code, please have a look (below screen shots) and suggest something. Thanks :) |
For GitHub Actions cron jobs (
I assume you are talking about the
The lines of code numbers are an indication of how many lines of code were actually analysed by CodeQL. If this number is much lower than expected then CodeQL is probably not "seeing" all of the code. A typical cause is that a build command may be compiling only a subset of the components in the repo which can be solved by providing a better build command. The total lines of code includes both user written code (the code from the repository) as well as system header or other "library" files . In your case the total lines of user written code looks wrong. It shouldn't be |
|
I understand all the answers and that make scens.. regarding
So, I checked the source root in
what I am getting, codeql is taking a source-path where actually the build command is being executed. |
|
@FaiqueAli The source location prefix is set by Could you have a look at the folder structure of the |
|
Yes, now I have added |
|
Great! Let's close this issue now. If you have any new questions, please open a new issue. |
|
Small follow up: the detection of |
wonderful, thanks you very much for the information :) |






Hi,
i am trying to use codeql cli in my cpp project and trying to create a database file in a docker container.
but I am getting this issue
No source code was seen and extracted to C:\xxx.
This can occur if the specified build commands failed to compile or process any code.
an explicit --command.
all the source code files without reusing existing build artefacts.
I am using the GNU MinGW compiler to compile my code.
the commands are using the script(.bat) file
waiting for good response :)
The text was updated successfully, but these errors were encountered: