github / codeql-cli-binaries

Binaries for the CodeQL CLI
Other
703 stars 101 forks source link

No supported build system detected. #158

Open dmc1778 opened 1 year ago

dmc1778 commented 1 year ago

Hi I want to run codeQL on some C/C++ source files. I am getting the following errors when running ./codeql database create mydb --language=cpp

Initializing database at /home/nimashiri/SATS/codeql-linux64/codeql/mydb.
Running build command: [/home/nimashiri/SATS/codeql-linux64/codeql/cpp/tools/autobuild.sh]
[2023-02-04 19:51:58] [build-stderr] + TOOLS_DIR=/home/nimashiri/SATS/codeql-linux64/codeql/cpp/tools
[2023-02-04 19:51:58] [build-stderr] + /home/nimashiri/SATS/codeql-linux64/codeql/cpp/tools/detect_source_root
[2023-02-04 19:51:58] [build-stdout] detect_source_root: Build will be attempted from '.'
[2023-02-04 19:51:58] [build-stdout] even though no build system was found there.
[2023-02-04 19:51:58] [build-stderr] + '[' -L _lgtm_detected_source_root ']'
[2023-02-04 19:51:58] [build-stderr] ++ readlink _lgtm_detected_source_root
[2023-02-04 19:51:58] [build-stderr] + cd .
[2023-02-04 19:51:58] [build-stderr] + export CXXFLAGS=-fpermissive
[2023-02-04 19:51:58] [build-stderr] + CXXFLAGS=-fpermissive
[2023-02-04 19:51:58] [build-stderr] + configure_prefix_opt=
[2023-02-04 19:51:58] [build-stderr] + '[' -f configure.ac ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f configure.in ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f CMakeLists.txt ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f meson.build ']'
[2023-02-04 19:51:58] [build-stderr] + try_configure
[2023-02-04 19:51:58] [build-stderr] + build_dir=.
[2023-02-04 19:51:58] [build-stderr] + root_dir=.
[2023-02-04 19:51:58] [build-stderr] + grep -q 'AC_MSG_.* configure in a separate.* directory' configure.in configure.ac
[2023-02-04 19:51:58] [build-stderr] + for configure in configure configure.gnu
[2023-02-04 19:51:58] [build-stderr] + '[' -x configure ']'
[2023-02-04 19:51:58] [build-stderr] + for configure in configure configure.gnu
[2023-02-04 19:51:58] [build-stderr] + '[' -x configure.gnu ']'
[2023-02-04 19:51:58] [build-stderr] + rm -rf _lgtm_build_dir
[2023-02-04 19:51:58] [build-stderr] + for bootstrap in bootstrap.sh bootstrap autogen.sh
[2023-02-04 19:51:58] [build-stderr] + '[' -x bootstrap.sh ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f bootstrap.sh ']'
[2023-02-04 19:51:58] [build-stderr] + for bootstrap in bootstrap.sh bootstrap autogen.sh
[2023-02-04 19:51:58] [build-stderr] + '[' -x bootstrap ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f bootstrap ']'
[2023-02-04 19:51:58] [build-stderr] + for bootstrap in bootstrap.sh bootstrap autogen.sh
[2023-02-04 19:51:58] [build-stderr] + '[' -x autogen.sh ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f autogen.sh ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f wscript ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f Kbuild ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f configure.ac ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f configure.in ']'
[2023-02-04 19:51:58] [build-stderr] ++ echo './*.pro'
[2023-02-04 19:51:58] [build-stderr] + '[' './*.pro' '!=' './*.pro' ']'
[2023-02-04 19:51:58] [build-stderr] + exit 0
[2023-02-04 19:51:58] [build-stderr] + export VERBOSE=1
[2023-02-04 19:51:58] [build-stderr] + VERBOSE=1
[2023-02-04 19:51:58] [build-stderr] + '[' -L _lgtm_detected_source_root ']'
[2023-02-04 19:51:58] [build-stderr] ++ readlink _lgtm_detected_source_root
[2023-02-04 19:51:58] [build-stderr] + cd .
[2023-02-04 19:51:58] [build-stderr] + '[' -d _lgtm_build_dir ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f SConstruct ']'
[2023-02-04 19:51:58] [build-stdout] Semmle autobuild: no supported build system detected.
[2023-02-04 19:51:58] [build-stderr] + '[' -f wscript ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f Makefile ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f makefile ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f GNUmakefile ']'
[2023-02-04 19:51:58] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/home/nimashiri/SATS/codeql-linux64/codeql/tools/linux64/preload_tracer, /home/nimashiri/SATS/codeql-linux64/codeql/cpp/tools/autobuild.sh])
[2023-02-04 19:51:58] [build-stderr] + '[' -f build.ninja ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -d ../_lgtm_build_dir ']'
[2023-02-04 19:51:58] [build-stderr] + for f in build build.sh
[2023-02-04 19:51:58] [build-stderr] + '[' -x build ']'
[2023-02-04 19:51:58] [build-stderr] + for f in build build.sh
[2023-02-04 19:51:58] [build-stderr] + '[' -x build.sh ']'
[2023-02-04 19:51:58] [build-stderr] + '[' -f setup.py ']'
[2023-02-04 19:51:58] [build-stderr] + echo 'Semmle autobuild: no supported build system detected.'
[2023-02-04 19:51:58] [build-stderr] + exit 1
A fatal error occurred: Exit status 1 from command: [/home/nimashiri/SATS/codeql-linux64/codeql/cpp/tools/autobuild.sh]

I am running on conda env.

jketema commented 1 year ago

Hi @dmc1778,

Thanks for your question. From ./codeql database create mydb --language=cpp I suspect you are in the directory in which you installed CodeQL and not in the directory which contains your source code. CodeQL should be executed from the directory containing your source code, or you need to explicitly pass this directory to codeql database create using the --source-root option.

If the above doesn't help and still gives you the same error, then CodeQL is not able to automatically figure out how to build your code. The work around this, you can pass the command with which you build your code to CodeQL using the --command option.