[LLVMbugs] [Bug 14065] New: compile_commands.json / clang-check doesn't work well with cross-compiled files

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 11 04:12:06 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=14065

             Bug #: 14065
           Summary: compile_commands.json / clang-check doesn't work well
                    with cross-compiled files
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In chromium, we build some files multiple times: Once with clang, and then a
few times with a custom gcc crosscompiler (for native client).

If I create a compilation database with all build commands, several rules are
written for these input files. For example, for `file: "base/string16.cc"`, I
get one json object that compiles that file with clang and several that compile
it with cross-nacl-gccs with strange compiler flags.

`clang-check base/string16.cc` will build that file once successfully using
clang, and then unsuccessfully a few times, with clang complaining about the
weird nacl flags:

Nicos-MacBook-Pro:src thakis$ ~/src/llvm/Release+Asserts/bin/clang-check -p
compile_commands.json base/string16.cc 
Processing: /Users/thakis/src/chrome/src/base/string16.cc.
Processing: /Users/thakis/src/chrome/src/base/string16.cc.
error: unsupported option '--arch'
error: unsupported option '--build'
error: unsupported option '--root'
error: unsupported option '--name'
error: unsupported option '--objdir'
error: unsupported option '--include-dirs=../out/Release/gen/tc_newlib/include
.. ../ppapi ..'
error: unsupported option '--lib-dirs= '
error: unsupported option '--compile_flags=-m64 -fomit-frame-pointer
-fasynchronous-unwind-tables -mtls-use-call  -O2 -g -Wall
-fdiagnostics-show-option '
error: unsupported option '--defines=__linux__ "__STDC_LIMIT_MACROS=1"
"__STDC_FORMAT_MACROS=1" "_GNU_SOURCE=1" "_BSD_SOURCE=1"
"_POSIX_C_SOURCE=199506" "_XOPEN_SOURCE=600" "DYNAMIC_ANNOTATIONS_ENABLED=1"
"DYNAMIC_ANNOTATIONS_PREFIX=NACL_" "NACL_BUILD_ARCH=x86" CHROMIUM_BUILD
COMPONENT_BUILD "USE_LIBJPEG_TURBO=1" ENABLE_ONE_CLICK_SIGNIN
"ENABLE_REMOTING=1" "ENABLE_WEBRTC=1" ENABLE_CONFIGURATION_POLICY
ENABLE_INPUT_SPEECH ENABLE_NOTIFICATIONS "ENABLE_HIDPI=1" "DCHECK_ALWAYS_ON=1"
"ENABLE_GPU=1" "ENABLE_EGLIMAGE=1" "USE_SKIA=1" "ENABLE_TASK_MANAGER=1"
"ENABLE_WEB_INTENTS=1" "ENABLE_EXTENSIONS=1" "ENABLE_PLUGIN_INSTALLATION=1"
"ENABLE_PROTECTOR_SERVICE=1" "ENABLE_SESSION_SERVICE=1" "ENABLE_THEMES=1"
"ENABLE_BACKGROUND=1" "ENABLE_AUTOMATION=1" "ENABLE_PRINTING=1"
"ENABLE_CAPTIVE_PORTAL_DETECTION=1" __STDC_FORMAT_MACROS BASE_IMPLEMENTATION'
error: unsupported option '--link_flags=-B../out/Release/gen/tc_newlib/lib64  '
error: unsupported option
'--source-list=newlib-x86-64.base_untrusted.source_list.gypcmd'
warning: ../../base;: 'linker' input unused
warning: export: 'linker' input unused
warning: BUILT_PRODUCTS_DIR=/Users/thakis/src/chrome/src/out/Release;: 'linker'
input unused
warning: export: 'linker' input unused
warning: CONFIGURATION=Release;: 'linker' input unused
warning: export: 'linker' input unused
warning: PRODUCT_NAME=base_untrusted;: 'linker' input unused
warning: export: 'linker' input unused
warning:
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk;:
'linker' input unused
warning: export: 'linker' input unused
warning: SRCROOT=/Users/thakis/src/chrome/src/out/Release/../../base;: 'linker'
input unused
warning: export: 'linker' input unused
warning: SOURCE_ROOT=${SRCROOT};: 'linker' input unused
warning: export: 'linker' input unused
warning: TARGET_BUILD_DIR=/Users/thakis/src/chrome/src/out/Release;: 'linker'
input unused
warning: export: 'linker' input unused
warning: TEMP_DIR=${TMPDIR};python: 'linker' input unused
warning: ../native_client/build/build_nexe.py: 'linker' input unused
warning: ../out/Release/gen/sdk/toolchain/: 'linker' input unused
warning: x86-64: 'linker' input unused
warning: newlib_nlib: 'linker' input unused
warning: ..: 'linker' input unused
warning: ../out/Release/gen/tc_newlib/lib64/libbase_untrusted.a: 'linker' input
unused
warning:
../out/Release/obj/base/base_untrusted.gen/newlib-x86-64/base_untrusted:
'linker' input unused
error: unable to handle compilation, expected exactly one compiler job in ''
Error while processing /Users/thakis/src/chrome/src/base/string16.cc.


I'm not sure what the best way to deal with this is. Maybe only execute
commands that match "*clang*" in their first component?

(Also, the error messages are hard to comprehend, and it took me a while to
figure out what's going on.)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list