Closed
Bug 1495511
Opened 6 years ago
Closed 5 years ago
Errors trying to build with --enable-clang-plugin locally
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: botond, Unassigned)
Details
I tried to build with --enable-clang-plugin locally for the first time in a while, and got the following errors: 0:01.18 build/clang-plugin 0:10.52 clang: warning: -Wl,--no-keep-files-mapped: 'linker' input unused [-Wunused-command-line-argument] 0:10.52 clang: warning: -Wl,--no-map-whole-files: 'linker' input unused [-Wunused-command-line-argument] 0:10.52 clang: warning: argument unused during compilation: '-fuse-ld=gold' [-Wunused-command-line-argument] 0:10.52 warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option] 0:10.52 In file included from /home/botond/dev/mozilla/refactoring/build/clang-plugin/ExplicitImplicitChecker.cpp:5: 0:10.52 In file included from /home/botond/dev/mozilla/refactoring/build/clang-plugin/ExplicitImplicitChecker.h:8: 0:10.52 In file included from /home/botond/dev/mozilla/refactoring/build/clang-plugin/plugin.h:9: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/AST/ASTContext.h:18: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/AST/ASTTypeTraits.h:20: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/AST/Decl.h:20: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/AST/ExternalASTSource.h:21: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/Basic/Module.h:19: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/Basic/FileManager.h:19: 0:10.52 In file included from /usr/lib/llvm-6.0/include/clang/Basic/VirtualFileSystem.h:24: 0:10.52 In file included from /usr/lib/llvm-6.0/include/llvm/Support/FileSystem.h:34: 0:10.52 In file included from /usr/lib/llvm-6.0/include/llvm/Support/Error.h:24: 0:10.53 /usr/lib/llvm-6.0/include/llvm/Support/Debug.h:118:9: warning: 'DEBUG' macro redefined [-Wmacro-redefined] 0:10.53 #define DEBUG(X) DEBUG_WITH_TYPE(DEBUG_TYPE, X) 0:10.53 ^ 0:10.53 <command line>:6:9: note: previous definition is here 0:10.53 #define DEBUG 1 0:10.53 ^ 0:10.53 /home/botond/dev/mozilla/refactoring/build/clang-plugin/ExplicitImplicitChecker.cpp:10:7: error: use of undeclared identifier 'constructorDecl' 0:10.53 cxxConstructorDecl( 0:10.53 ^ 0:10.53 /home/botond/dev/mozilla/refactoring/build/clang-plugin/plugin.h:41:28: note: expanded from macro 'cxxConstructorDecl' 0:10.53 #define cxxConstructorDecl constructorDecl 0:10.53 ^ 0:10.53 2 warnings and 1 error generated. (There are more but they're similar.) Based on the output, it looks like it's trying to use clang-6 headers. Is that a supported version of clang to use in the plugin? Any suggestions for what else I might be doing wrong?
Comment 1•6 years ago
|
||
Please tell me do you have clang-dev installed? I would suggest using the clang artifact that we provide.
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Andi-Bogdan Postelnicu [:andi] from comment #1) > Please tell me do you have clang-dev installed? I installed the libclang-6.0-dev package from apt.llvm.org. It's providing the headers like /usr/lib/llvm-6.0/include/clang/AST/ASTContext.h which the build is using. > I would suggest using the clang artifact that we provide. How do I set that up (e.g. what do I put in my .mozconfig)?
Comment 3•6 years ago
|
||
I wonder if we ought to add very restrictive checks to configure for supported versions of clang when using `--enable-clang-plugin`? It seems like the clang plugin API is not particularly stable and keeping things running in CI is hard enough.
Comment 4•6 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #2) > > How do I set that up (e.g. what do I put in my .mozconfig)? Take foe example this: >>export CC=/compilers/5.0.1/bin/clang >>export CXX=/compilers/5.0.1/bin/clang++ >>export LLVM_CONFIG=/compilers/5.0.1/bin/llvm-config To get the artifact, on linux: >>./mach artifact toolchain --from-build linux64-clang
Comment 5•6 years ago
|
||
We should probably detect the clang version used by the system and kill the configure if this isn't a version that we support.
Comment 6•6 years ago
|
||
That sort of leaves high and dry the people who periodically build and run their own clang, wouldn't it? I grant that clang's easier to get now than it was back in the day when Ehsan first posted build instructions, but I can't be the only one who periodically build clang tip for use in compiling Gecko or SpiderMonkey.
Comment 7•6 years ago
|
||
Build your clang with 2 stages. Supposedly, there are easy steps to do that now with cmake. Check out the examples in cmake/caches/ in the clang repository. See also https://llvm.org/docs/AdvancedBuilds.html
Comment 8•6 years ago
|
||
Not talking as a Mozilla employee. I am working at getting apt.llvm.org packages built in a stage2 way. Ditto for the debian and Ubuntu packages. This works with Intel and some other arches. Still have to fix Armel, armhf and some mips. So, it should be fixed in a few weeks. BTW the upstream stage2 build process is a bit fragile (gcc args passed to the Clang step... Or not, bad detect of libs like latomic, etc)
Comment 9•5 years ago
|
||
apt.llvm.org has now stage2 builds from version 7. Please move from 6 to 7.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•