github / codeql-cli-binaries

Binaries for the CodeQL CLI
Other
741 stars 105 forks source link

Cannot create a database on M1 Mac #144

Closed po6ix closed 1 year ago

po6ix commented 1 year ago

Hola, github developers.

The database creation doesn't work with --language=cpp argument on my environment. Otherwise, it works with --language=python.

It shows me messages below when it fails.

[user@mac 15708] codeql database create db --language=cpp
Initializing database at /private/tmp/15708/db.
Running build command: [/opt/homebrew/Caskroom/codeql/2.11.4/codeql/cpp/tools/autobuild.sh]
[2022-12-04 23:43:40] [build-stderr] dyld[88229]: terminating because inserted dylib '/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' could not be loaded: tried: '/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' (fat file, but missing compatible architecture (have 'x86_64,arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' (no such file), '/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' (fat file, but missing compatible architecture (have 'x86_64,arm64', need ''))
[2022-12-04 23:43:40] [ERROR] Spawned process exited abnormally (code 134; tried to run: [/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/preload_tracer, /opt/homebrew/Caskroom/codeql/2.11.4/codeql/cpp/tools/autobuild.sh])
[2022-12-04 23:43:40] [build-stderr] dyld[88229]: tried: '/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' (fat file, but missing compatible architecture (have 'x86_64,arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' (no such file), '/opt/homebrew/Caskroom/codeql/2.11.4/codeql/tools/osx64/libtrace.dylib' (fat file, but missing compatible architecture (have 'x86_64,arm64', need ''))
A fatal error occurred: Exit status 134 from command: [/opt/homebrew/Caskroom/codeql/2.11.4/codeql/cpp/tools/autobuild.sh]

It seems that it couldn't the load the library (libtrace.dylib) which is needed. The strange thing is It doesn't have the valid arch string what is needed like need ''. libtrace.dylib what the messages is refering is an universal binary which contains both x86_64 and arm64 binary.

I tried v2.11.4, v2.11.3 and they printed the same message.

Version

hvitved commented 1 year ago

Thanks for your report. @criemen could you take a look, please?

po6ix commented 1 year ago

Tested v2.5.3, v2.10.0 and they didn't work as well.

criemen commented 1 year ago

Do you have Rosetta installed? I don't think CodeQL works on M1 macs without.

Otherwise, I'm as puzzled as you are about that empty arch string - that's clearly unexpected.

po6ix commented 1 year ago
 arch -x86_64 codeql database create db --language=cpp

I could run the command by prepending arch -x86_64 wrapper to use rosetta explicitly. Thank you for the help!