question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Target triple changed between intercept and Analyze : FreeBSD > Linux

See original GitHub issue

Describe 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

  1. intercept-build --cdb $OUTFILE bmake
  2. CodeChecker analyze --keep-gcc-include-fixed --ctu --analyzers clangsa --enable-all --enable alpha --enable valist --enable unix -jnproc $OUTFILE -o $CCRESULTS
  3. Go to results/failed and see any of the failed zip files
  4. 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);
                               ~~  ^
  1. 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:closed
  • Created 4 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
itzurabhicommented, Feb 11, 2020

when doing the analysis with CodeCheker log result - things are working as expected. Closing the issue.

0reactions
gyorbcommented, Jan 9, 2020

Sorry for the confusion. Most likely, I forgot to rebase when I tried this out. I do see the correct target with the latest master.

Great news that it works in your environment @Xazax-hun

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 21. The Z File System (ZFS)
ZFS is an advanced file system designed to solve major problems found in previous storage subsystem software.
Read more >
Writeup-Vulnhub-Kioptrix #5
This writeup goes through exploiting outdated services/applications to get a root shell on the machine. The Target machine being used in Kioptrix 2014...
Read more >
Understanding what a Linux binary is doing
It intercepts and records the dynamic library calls which are called by the executed process and the signals which are received by that...
Read more >
PyInstaller Documentation
3. Run pip install . from the unpacked source directory. ... variable is used to discover libraries, it is the library search path...
Read more >
CVE-2021-44228: Apache Log4j2 Zero-Day Exploited in the ...
Update – February 10, 2022 3:00 PM ET. Log4j QIDs have undergone many changes recently that include enhancement in reporting, fix for false ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found