Target triple changed between intercept and Analyze : FreeBSD > Linux
See original GitHub issueDescribe the bug I am cross compiling a binary and dependencies using BSD Make
Host is Ubuntu 16.04,x64 Target is FreeBSD 11,i386 Target build is done using Clang 5 - internal revision. Analysis is done using Clang 9, release branch.
LLVM supplied intercept-build
is used to generate the compilation database JSON file since CodeChecker throws error due to LD_PRELOAD of “ldlogger.so”. We mix 32 and64 bit tools in the build process.
This is the intercepted build command (collected from ‘build-action’ in results/failed/)
[some internal include and macro definitions are removed]
c++ -c -Qunused-arguments --target=i386-unknown-freebsd11.0 -m32 -nostdinc++
-I/[path masked]/i386-unknown-freebsd11.0/usr/include/c++/v1
-O -pipe -fno-builtin-printf
-D__ELF__
-Dunix
-D__unix
-D__unix__
-D__FreeBSD__=11
-D__i386__
-I/[path masked]/obj/stage/common/plugin/include
-I/[path masjed]/stage/i386/usr/include
-DTARGET_BSDX -march=pentium2 -march=pentium2 -ggdb -gdwarf-4 -feliminate-unused-debug-types -fstandalone-debug
-I/pub/llvm-5.0/freebsd/stable_11/[path masked]/stage/i386/usr/lib
Wcomment -Werror -Wformat -Winline -Wparentheses -Wpointer-arith -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wwrite-strings -Wno-address-of-packed-member -Wno-format-security -Wno-tautological-constant-out-of-range-compare
-DTARGET_UI
-I/[path masked]/obj/bsd11/stage/i386/usr/include
-I/[path masked]/obj/bsd11/stage/i386/include
-I/[path masked]/stage/i386/usr/include
--sysroot /[path masked]/i386-unknown-freebsd11.0 -Wno-error -Wno-unused-const-variable -Wno-unneeded-internal-declaration
-I/[path masked]/obj/bsd11/stage/i386/usr/include
drend_cache.cpp
The analyzer-command file has the following content: [some internal include and macro definitions are removed]
clang --analyze -Qunused-arguments --analyzer-no-default-checks -Xclang -analyzer-opt-analyze-headers -Xclang -analyzer-output=plist-multi-file -o /[path masked]/results/drend_cache.cpp_a8a54f171a18f5cc364fdc505ebda3e4.plist
.....
-x c++ --target=x86_64-unknown-linux-gnu -std=gnu++14 -m32 -nostdinc++
-I/[path masked]/i386-unknown-freebsd11.0/usr/include/c++/v1 -fno-builtin-printf -D__ELF__ -Dunix -D__unix -D__unix__ -D__FreeBSD__=11 -D__i386__
-DTARGET_BSDX -march=pentium2 -march=pentium2 -feliminate-unused-debug-types -fstandalone-debug
-I/[path masked]/stage/i386/usr/lib -Wno-format-security -Wno-tautological-constant-out-of-range-compare -DTARGET_UI
-I/[path masked]/obj/stage/bsd11/i386/usr/include
-I/[path masked]/stage/i386/usr/include
--sysroot /[path masked]/i386-unknown-freebsd11.0 -Wno-error -Wno-unused-const-variable -Wno-unneeded-internal-declaration clang/9.0.1/include
-isystem /[path masked]/i386-unknown-freebsd11.0/usr/include /source/path/drend_cache.cpp
–target=i386-unknown-freebsd changed to --target=x86_64-unknown-linux-gnu in the analysis invocation.
Is this expected ?
CodeChecker version
CodeChecker analyzer version: --------------------------------------------------------------- Kind \| Version --------------------------------------------------------------- Base package version \| 6.10.1 Package build date \| 2019-11-13T12:27 Git commit ID (hash) \| d3928e30d25bd10da977d2d1119f300a30179cc0 Git tag information \| 6.10.1 --------------------------------------------------------------- CodeChecker web version: ------------------------------------------------------------------------ Kind \| Version ------------------------------------------------------------------------ Base package version \| 6.10.1 Package build date \| 2019-11-13T12:27 Git commit ID (hash) \| d3928e30d25bd10da977d2d1119f300a30179cc0 Git tag information \| 6.10.1 Server supported API (Thrift) \| 6.21 Client API (Thrift) \| 6.21 ------------------------------------------------------------------------
--
clangsa clang clang version 9.0.1 (https://github.com/llvm/llvm-project.git 6851dcc0abf77a3fa7acb0bd206a5297ce8ac6de) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /b/ats/llvm-ssd/90/install/bin clang-tidy clang-tidy LLVM (http://llvm.org/): LLVM version 9.0.1 Optimized build. Default target: x86_64-unknown-linux-gnu Host CPU: sandybridge
--
To Reproduce Steps to reproduce the behavior
- intercept-build --cdb $OUTFILE bmake
- CodeChecker analyze --keep-gcc-include-fixed --ctu --analyzers clangsa --enable-all --enable alpha --enable valist --enable unix -j
nproc
$OUTFILE -o $CCRESULTS - Go to results/failed and see any of the failed zip files
- See errors
/[path masked]/i386-unknown-freebsd11.0/usr/include/c++/v1/__config:169:10: fatal error: 'features.h' file not found
#include <features.h>
-----
error: no member named '_IO_read_end' in 'struct __sFILE'
return (fp->_IO_read_ptr < fp->_IO_read_end);
~~ ^
- The ‘features.h’ and ‘_IO_read_end’ specific code are guarded to be compiled under Linux only.
Expected behavior Successful analysis
Desktop (please complete the following information)
- OS: Ubuntu 16.04 ,x64
- Browser Firefox
Additional context Many other files are analyzed successfully in the same batch.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (17 by maintainers)
when doing the analysis with
CodeCheker log
result - things are working as expected. Closing the issue.Great news that it works in your environment @Xazax-hun