Closed Bug 1578530 Opened 5 years ago Closed 5 years ago

--enable-clang-plugin JS builds are broken: js-confdefs.h file not found

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(firefox71 fixed)

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: Waldo, Assigned: glandium)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

I'm using this clang:

[jwalden@find-waldo-now src]$ clang++-tip --version
clang version 10.0.0 (https://github.com/llvm/llvm-project.git b5aefed40aba09252dd350897a231c4ec5a4376c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jwalden/.programs/new-compilers

and this (run from js/src) is the command I'm using to build the JS engine with static analysis clang-plugin bits enabled:

rm -rf dbg && autoconf-2.13 && mkdir dbg && (cd dbg && LLVM_SYMBOLIZER='/home/jwalden/.programs/new-compilers/llvm-symbolizer-tip' LLVMCONFIG='/home/jwalden/.programs/new-compilers/llvm-config-tip' CC='ccache clang-tip' CXX='ccache clang++-tip' ../configure --enable-oom-breakpoint --enable-clang-plugin --enable-debug --disable-optimize --enable-readline --enable-valgrind --enable-signed-overflow-sanitizer --enable-unsigned-overflow-sanitizer && BUILD_VERBOSE_LOG=1 make -s -j8)

where llvm-symbolizer, llvm-config, clang-tip, and clang++-tip all refer into things produced from my own local clang build. That clang build is produced from running this download-and-compile script a week or so ago (you could change it to hardcode the exact github rev to reproduce exact behavior, I think), with old-clang-build stuff referring to the previous clang I had built locally (I can find its exact rev if it ends up mattering, if you need it):

#!/bin/sh

# https://llvm.org/docs/CMake.html
# https://llvm.org/docs/GettingStarted.html

# Prerequisites:
#   sudo dnf install cmake

set -e

export SOURCE_AND_BUILD_LOCATION=~/Programs/clang-build

#################
# UPDATE SOURCE #
#################

# This is the last clang known to compile with gcc.
#export REV=317840

# This is clang 8 with different, non-compatible clang-plugin API.  It can
# *only* be compiled with clang!  gcc produces a bad build.
export CC=/home/jwalden/Programs/old-clang-build/prefixdir/bin/clang
export CXX=/home/jwalden/Programs/old-clang-build/prefixdir/bin/clang++
export AS=/home/jwalden/Programs/old-clang-build/prefixdir/bin/clang
export LLVMCONFIG='/home/jwalden/Programs/old-clang-build/prefixdir/bin/llvm-config'

if [ ! -d "$SOURCE_AND_BUILD_LOCATION/llvm-project" ]; then
  git clone https://github.com/llvm/llvm-project.git
else
  cd "$SOURCE_AND_BUILD_LOCATION/llvm-project"
  git -C "$SOURCE_AND_BUILD_LOCATION/llvm-project" pull
  git -C "$SOURCE_AND_BUILD_LOCATION/llvm-project" checkout master
fi

## This is the rev used for old-clang-build.
##export REV=345952
#
#export REV=370084
#
## LLVM
#
#cd $SOURCE_AND_BUILD_LOCATION
#svn co -r $REV https://llvm.org/svn/llvm-project/llvm/trunk llvm
#
## Clang
#
#cd $SOURCE_AND_BUILD_LOCATION/llvm/tools
#svn co -r $REV https://llvm.org/svn/llvm-project/cfe/trunk clang
#
## Extra Clang tools
#cd $SOURCE_AND_BUILD_LOCATION/llvm/tools/clang/tools
#svn co -r $REV https://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
#
## Compiler-RT
#cd $SOURCE_AND_BUILD_LOCATION/llvm/projects
#svn co -r $REV https://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt

# libcxx, libcxxabi
#cd $SOURCE_AND_BUILD_LOCATION/llvm/projects
#svn co https://llvm.org/svn/llvm-project/libcxx/trunk libcxx
#svn co https://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi

#################
# PERFORM BUILD #
#################

cd $SOURCE_AND_BUILD_LOCATION

if [ ! -d build ]; then
  echo "build directory doesn't exist, please create it"
  exit 1
fi

cd build

cmake $SOURCE_AND_BUILD_LOCATION/llvm-project/llvm

cmake \
  -DCMAKE_INSTALL_PREFIX="$SOURCE_AND_BUILD_LOCATION/prefixdir" \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_ASSERTIONS=No \
  -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libunwind" \
  --build .

#################
# INSTALL BUILD #
#################

make -j8
make install

# --enable-optimized --disable-assertions
# ../llvm/configure --prefix=/home/jwalden/Programs/next-clang/prefixdir/ --enable-optimized --disable-assertions
# make update
# make -s -j4
# make install

When I use all the above to compile, I end up getting compile output when compiling the clang-plugin files that looks like:

build/clang-plugin/tests/TestDanglingOnTemporary.o
build/clang-plugin/tests/TestExplicitOperatorBool.o
build/clang-plugin/tests/TestGlobalClass.o
build/clang-plugin/tests/TestHeapClass.o
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 5: methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES cannot be && ref-qualified
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 6: methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES must return a pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 34: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 35: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 40: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 43: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 44: calling `get` on a temporary, potentially allowing use after free of the raw pointer
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 24: through the variable declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 25: the raw pointer escapes the function scope here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 27: the raw pointer escapes the function scope here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 27: through the parameter declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 30: the raw pointer escapes the function scope here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 30: through the return value of the function declared here
14 errors generated.
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 4: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 5: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 6: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 8: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 47: bad implicit conversion constructor for 'Template'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 49: bad implicit conversion constructor for 'Template'

and while the js-confdefs.h thing might be JS-related, the rest of it looks like the clang-plugin things Just Not Working At All.

Anyway. I have no idea what's up, maybe it's on me somehow (but I've been using these basic steps to build a clang-plugin-ready compiler for awhile), maybe some of it is on the JS engine build system. But I was told to file a bug here, and so here it is, hopefully with way more info than is necessary to figure out what's wrong. :-)

I'm building it against c0da99ee6c41d7ac4ed7919865dd17f71babb764 and I'm encountering other static-analysis errors, related with the MustReturnFromCallerChecker. Also I'm running this on Mac, but I don't think it should make much of a difference.
Can you please use that revision and tell me if you encounter the same issues?

Flags: needinfo?(jwalden)

Do you need the static analysis clang-plugins ?

(In reply to Andi-Bogdan Postelnicu [:andi] from comment #1)

I'm building it against c0da99ee6c41d7ac4ed7919865dd17f71babb764 and I'm encountering other static-analysis errors, related with the MustReturnFromCallerChecker. Also I'm running this on Mac, but I don't think it should make much of a difference.
Can you please use that revision and tell me if you encounter the same issues?

Uh. I'm not sure what you mean. https://github.com/llvm/llvm-project/commit/c0da99ee6c41d7ac4ed7919865dd17f71babb764 doesn't exist, and neither https://hg.mozilla.org/integration/mozilla-inbound/rev/c0da99ee6c41d7ac4ed7919865dd17f71babb764 nor https://github.com/mozilla/gecko-dev/commits/c0da99ee6c41d7ac4ed7919865dd17f71babb764 exists if you meant to refer to a Mozilla hash (but I never thought you did, just grabbing at possible meanings that hash might have). Do you mean some other hash, or should I be looking some completely different place?

(In reply to Sylvestre Ledru [:Sylvestre] from comment #2)

Do you need the static analysis clang-plugins ?

As far as I know, the LLVM_ENABLE_PROJECTS directive should be enough to build clang, clang-tools-extra, and compiler-rt (providing symbols ubsan'd builds of SpiderMonkey can use). And prior update-clang.sh iterations I've used have manually pulled and built those (plus llvm itself) and produced working builds. (And while https://llvm.org/docs/CMake.html doesn't mention clang-tools-extra, http://clang-developers.42468.n3.nabble.com/Separating-clang-tools-extra-from-clang-in-LLVM-ENABLE-PROJECTS-td4064002.html does and seems likely newer.) As far as I can tell, everything should be in place...

Flags: needinfo?(jwalden) → needinfo?(bpostelnicu)

You are right to be confused, sorry. What I meant to say was that I'm using commit c0da99ee6c41d7ac4ed7919865dd17f71babb764 from this git clang repo - https://git.llvm.org/git/clang. This commit would be equivalent to this commit from the official GitHub repo.

One more thing to comment here, if you want to use static-analysis for C/C++ you can use the one that's already integrated into mach, by running ./mach static-analysis. This kind of analysis will use some default clang-tidy checkers and all of our Mozilla specific checkers. I would strongly suggest to use it since it's more streamlined for the ease-of-use and it's independent of the compiler pipeline that you have in place.
If you feel the need to use clang-plugin and our mach static-analysis doesn't satisfy your needs, please let me know.

Flags: needinfo?(bpostelnicu)

If I change up my build script to pull that 2c9f hash from the Github repository, my build proceeds as

build/clang-plugin/tests/TestExplicitOperatorBool.o
build/clang-plugin/tests/TestGlobalClass.o
build/clang-plugin/tests/TestHeapClass.o
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 4: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 5: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 6: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 8: bad implicit conversion constructor for 'Foo'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 47: bad implicit conversion constructor for 'Template'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 49: bad implicit conversion constructor for 'Template'
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 4: consider adding the explicit keyword to the constructor
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 5: consider adding the explicit keyword to the constructor
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 6: consider adding the explicit keyword to the constructor
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 8: consider adding the explicit keyword to the constructor
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 47: consider adding the explicit keyword to the constructor
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp Line 49: consider adding the explicit keyword to the constructor
13 errors generated.
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
1 error generated.
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestBadImplicitConversionCtor.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:731: TestNANTestingExprC.o] Error 1
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestExplicitOperatorBool.cpp Line 4: bad implicit conversion operator for 'Bad'
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestExplicitOperatorBool.cpp Line 4: consider adding the explicit keyword to 'operator bool'
3 errors generated.
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestAssertWithAssignment.cpp Line 35: Forbidden assignment in assert expression
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestAssertWithAssignment.cpp Line 39: Forbidden assignment in assert expression
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestAssertWithAssignment.cpp Line 62: Forbidden assignment in assert expression
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestAssertWithAssignment.cpp Line 64: Forbidden assignment in assert expression
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestAssertWithAssignment.cpp Line 65: Forbidden assignment in assert expression
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
6 errors generated.
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 18: variable of type 'Global' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 19: variable of type 'Global [2]' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 27: variable of type 'Global' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 28: variable of type 'Global' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 29: variable of type 'TemplateClass<int>' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 30: variable of type 'Global' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 50: variable of type 'BadInherit' only valid as global
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 51: variable of type 'RandomClass' only valid as global
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 18: value incorrectly allocated in an automatic variable
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 19: 'Global [2]' is a global type because it is an array of global type 'Global'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 19: value incorrectly allocated in an automatic variable
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 27: value incorrectly allocated on the heap
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 28: value incorrectly allocated on the heap
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 29: value incorrectly allocated on the heap
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 30: value incorrectly allocated on the heap
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 38: 'RandomClass' is a global type because member 'nonstaticMember' is a global type 'Global'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 46: 'BadInherit' is a global type because it inherits from a global type 'Global'
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 50: value incorrectly allocated in an automatic variable
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestGlobalClass.cpp Line 51: value incorrectly allocated in an automatic variable
20 errors generated.
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 5: methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES cannot be && ref-qualified
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 6: methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES must return a pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 34: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 35: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 40: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 43: calling `get` on a temporary, potentially allowing use after free of the raw pointer
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 44: calling `get` on a temporary, potentially allowing use after free of the raw pointer
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 24: through the variable declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 25: the raw pointer escapes the function scope here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 27: the raw pointer escapes the function scope here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 27: through the parameter declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 30: the raw pointer escapes the function scope here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestDanglingOnTemporary.cpp Line 30: through the return value of the function declared here
14 errors generated.
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestExplicitOperatorBool.o] Error 1
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestAssertWithAssignment.o] Error 1
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestGlobalClass.o] Error 1
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestDanglingOnTemporary.o] Error 1
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCustomHeap.cpp Line 27: variable of type 'X' is not valid on the heap
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCustomHeap.cpp Line 28: variable of type 'X' is not valid on the heap
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCustomHeap.cpp Line 27: value incorrectly allocated on the heap
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCustomHeap.cpp Line 28: value incorrectly allocated on the heap
5 errors generated.
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestCustomHeap.o] Error 1
error: 'error' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 12: functions marked as MOZ_CAN_RUN_SCRIPT can only be called from functions also marked as MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 37: functions marked as MOZ_CAN_RUN_SCRIPT can only be called from functions also marked as MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 55: functions marked as MOZ_CAN_RUN_SCRIPT can only be called from functions also marked as MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 63: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'new RefCountedBase' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 63: functions marked as MOZ_CAN_RUN_SCRIPT can only be called from functions also marked as MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 68: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'new RefCountedBase' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 92: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  't' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 93: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  't' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 111: functions marked as MOZ_CAN_RUN_SCRIPT can only be called from functions also marked as MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 115: functions marked as MOZ_CAN_RUN_SCRIPT cannot override functions that are not marked MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 118: functions marked as MOZ_CAN_RUN_SCRIPT cannot override functions that are not marked MOZ_CAN_RUN_SCRIPT
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 157: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'x' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 166: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '*t' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 171: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '*t' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 177: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'ref' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 183: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'ref' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 210: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '*(RefCountedBase*)x' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 218: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '*x' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 225: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '*unsafe' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 232: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '(*safe)' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 244: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  't' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 252: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'new RefCountedBase()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 261: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  't' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 285: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mRefCounted' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 288: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mRefCounted' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 295: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mRefCounted.get()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 298: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mRefCounted.get()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 321: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'MOZ_KnownLive(mWeakPtrReturner1)->getWeakPtr()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 325: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'MOZ_KnownLive(mWeakPtrReturner1)->getWeakPtr()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 329: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'MOZ_KnownLive(mWeakPtrReturner2)->getWeakPtr()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 333: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'MOZ_KnownLive(mWeakPtrReturner2)->getWeakPtr()' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 360: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mMember->mRefCounted' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 363: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mMember->mRefCounted' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 370: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mRefCounted' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 373: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mRefCounted' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 404: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'WeakSmartPtr(new RefCountedBase())' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 408: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  '*WeakSmartPtr(new RefCountedBase())' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 412: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'WeakSmartPtr(new RefCountedBase())' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 428: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mArray[0]' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 431: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mArray[0]' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 438: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mArray[0]' is neither.
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 441: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument).  'mArray[0]' is neither.
error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found
error: 'note' diagnostics expected but not seen: 
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 11: caller function declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 36: caller function declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 54: caller function declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 62: caller function declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 107: overridden function declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 107: overridden function declared here
  File /home/jwalden/moz/after/build/clang-plugin/tests/TestCanRunScript.cpp Line 107: caller function declared here
50 errors generated.
make[3]: *** [/home/jwalden/moz/after/config/rules.mk:789: TestCanRunScript.o] Error 1
make[2]: *** [/home/jwalden/moz/after/config/recurse.mk:74: build/clang-plugin/tests/target-objects] Error 2
make[1]: *** [/home/jwalden/moz/after/config/recurse.mk:34: export] Error 2
make: *** [/home/jwalden/moz/after/config/rules.mk:391: default] Error 2

which on the surface looks pretty similar to the failure I was having that I pasted into comment 0.

I think this is important:

error: 'error' diagnostics seen but not expected: 
  Line 1: '/home/jwalden/moz/after/js/src/dbg/js/src/js-confdefs.h' file not found

After that, the compilation can't proceed, so it makes sense that none of those expected errors will be seen.

Could you please run through your steps again and see if configure produces any odd messages? Also, it seems like a lack of js-confdefs.h would bust your build with or without clang-plugin, so I would additionally try a more vanilla configure to see whether it too lacks that header.

Just a flat, minimized

rm -rf dbg && autoconf-2.13 && mkdir dbg && (cd dbg && CC='clang-tip' CXX='clang++-tip' ../configure --enable-clang-plugin && BUILD_VERBOSE_LOG=1 make)

will hit the same errors. I suppose the js-confdefs.h thing could explain a fair bit of this...but I'm not sure why it only would have shown up for me with an updated clang. Also while #include failures are harder failures than most, my recollection was that compilers would try to keep compiling past such, so you would end up getting the usual warning/etc. output. But maybe not? Or maybe -include $FOO on the command line is immediately fatal in a way that #include inside a file wouldn't be.

It looks like maybe the js-confdefs.h file generated by the JS build system is not yet generated at the time the clang-plugin files get built or so. I'm not sure why this only would have started manifesting with a new clang, tho, if this is really a JS build system-ish bug...

I was able to reproduce this in WSL, with both trunk LLVM and clang-8 (!). Bisection points to https://hg.mozilla.org/mozilla-central/rev/c51ba76790c01fe9c00aa4a03ea2f6d3aa397286.

Waldo: I can only assume that your working LLVM build happened on the other side of that Mozilla changeset. If I rewind my Gecko tree to the parent of that changeset, I can almost build successfully with trunk LLVM. There's a single broken translation unit remaining, for which I've just filed bug 1580260.

Glandium: To summarize, the following standalone build no longer works because js-confdefs.h is not produced in time for clang-plugin tests.

rm -rf dbg && autoconf-2.13 && mkdir dbg && (cd dbg && CC='clang-tip' CXX='clang++-tip' ../configure --enable-clang-plugin && BUILD_VERBOSE_LOG=1 make
No longer blocks: build-clang-trunk
Flags: needinfo?(mh+mozilla)
Regressed by: 1573566
Summary: --enable-clang-plugin not working with very-tippy clang for me → --enable-clang-plugin JS builds are broken: js-confdefs.h file not found
Keywords: regression
Flags: needinfo?(mh+mozilla)
Assignee: bpostelnicu → mh+mozilla
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/4a0245aad475
Add missing dependencies for clang-plugin tests. r=froydnj
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Has Regression Range: --- → yes
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.