Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./build-infer.sh clang ends with error on Ubuntu 20.04 #1294

Open
RadioPotin opened this issue Jul 22, 2020 · 10 comments
Open

./build-infer.sh clang ends with error on Ubuntu 20.04 #1294

RadioPotin opened this issue Jul 22, 2020 · 10 comments

Comments

@RadioPotin
Copy link

Hello,
I've tried to install infer from source for the passed two days in order to run the analyzer on C code, and have found myself repeatedly getting an error after running ./build-infer clang as follows:

...
[ 98%] Built target arcmt-test
make[3]: Entering directory '/tmp/clang-setup.4nnVxP/build'
Scanning dependencies of target c-arcmt-test
make[3]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
make[3]: Entering directory '/tmp/clang-setup.4nnVxP/build'
[ 98%] Building C object tools/clang/tools/c-arcmt-test/CMakeFiles/c-arcmt-test.dir/c-arcmt-test.c.o
[ 98%] Linking CXX executable ../../../../bin/c-arcmt-test
make[3]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
[ 98%] Built target c-arcmt-test
make[3]: Entering directory '/tmp/clang-setup.4nnVxP/build'
Scanning dependencies of target clang-check
make[3]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
make[3]: Entering directory '/tmp/clang-setup.4nnVxP/build'
[ 98%] Building CXX object tools/clang/tools/clang-check/CMakeFiles/clang-check.dir/ClangCheck.cpp.o
[100%] Linking CXX executable ../../../../bin/clang-check
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[3]: *** [tools/clang/tools/clang-shlib/CMakeFiles/clang-cpp.dir/build.make:1751: lib/libclang-cpp.so.9] Error 1
make[3]: *** Deleting file 'lib/libclang-cpp.so.9'
make[3]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
make[2]: *** [CMakeFiles/Makefile2:28654: tools/clang/tools/clang-shlib/CMakeFiles/clang-cpp.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
[100%] Built target clang-check
make[2]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
make[1]: *** [Makefile:152: all] Error 2
make[1]: Leaving directory '/tmp/clang-setup.4nnVxP/build'
make: *** [Makefile:355: clang_setup] Error 2

  compilation failure; you can try running

    make clean
    './build-infer.sh' clang

Also I've prospected the ongoing issues and running NO_CMAKE_STRIP=1 hasn't been of any help to me.

infer version is 0.17.0

Please tell me if I have forgotten anything of relevance and/or I've duplicated an issue.
Cordially

@aytey
Copy link
Contributor

aytey commented Jul 22, 2020

Can you please try installing the ninja package on whatever version of Linux you're running and re-try this?

Ninja should be automatically detected by Infer's build system, so you shouldn't need to do anything different than what you did before.

@RadioPotin
Copy link
Author

Will do, and keep you informed on it, thank you for the quick answer !

@RadioPotin
Copy link
Author

Hi again, compilation has failed again with following message:

-- Build files have been written to: /tmp/clang-setup.ibSPYr/build/tools/clang/runtime/compiler-rt-bins
[3431/3434] Cleaning compiler-rt...
[1/1] Cleaning all built files...
Cleaning... 0 files.
[3431/3434] Performing build step for 'compiler-rt'
[38/727] Building CXX object lib/sanitizer_common/CMakeF...erCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o
FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o 
/tmp/clang-setup.ibSPYr/build/./bin/clang++  -DHAVE_RPC_XDR_H=1 -I/tmp/clang-setup.ibSPYr/llvm/projects/compiler-rt/lib/sanitizer_common/.. -g -O2 -Wall -std=c++11 -Wno-unused-parameter -O3 -DNDEBUG    -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -MD -MT lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o -c /tmp/clang-setup.ibSPYr/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
/tmp/clang-setup.ibSPYr/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1131:1: error: 'assertion_failed__1131' declared as an array with a negative size
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/clang-setup.ibSPYr/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1437:3: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/clang-setup.ibSPYr/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:336:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/clang-setup.ibSPYr/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:342:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
    typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                        ^~~~~~~~~~~~~~~
1 error generated.
[47/727] Building CXX object lib/sanitizer_common/CMakeF...anitizerCommon.x86_64.dir/sanitizer_procmaps_common.cc.o
ninja: build stopped: subcommand failed.
FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-build 
cd /tmp/clang-setup.ibSPYr/build/tools/clang/runtime/compiler-rt-bins && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /tmp/clang-setup.ibSPYr/build/tools/clang/runtime/compiler-rt-stamps//compiler-rt-build
ninja: build stopped: subcommand failed.
make: *** [Makefile:355: clang_setup] Error 1

@aytey
Copy link
Contributor

aytey commented Jul 22, 2020

Hmm, not sure, but I found this: rust-lang/rust#69556

@aytey
Copy link
Contributor

aytey commented Jul 22, 2020

Just an FYI, ubuntu-latest for GitHub Actions is 18.04 and not 20.04, which could mean that this is genuinely broken on 20.04, if the current version of LLVM that Infer uses is incompatible with glibc 2.31.

@RadioPotin
Copy link
Author

Thank you, I'll check if that helps me somehow a keep you informed. cordially

@RadioPotin
Copy link
Author

RadioPotin commented Jul 27, 2020

Soooo, twas impossible for me to get it running on my release of ubuntu so I've proceeded to make it happen in a docker environment, thanks to the dockerfile provided here.
I've not quite put my finger down on what broke the building on Ubuntu 20.04 so I suppose that you are right for that matter. Thanks for taking this issue into account, cordially.

@aytey
Copy link
Contributor

aytey commented Jul 27, 2020

I just tried to build facebook-clang-plugins on 20.04 -- I confirm I get the same error as you do:

/tmp/clang-setup.8icOVA/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1131:1: error: 'assertion_failed__1131' declared as an array with a negative size
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/clang-setup.8icOVA/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1437:3: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/clang-setup.8icOVA/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:336:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/clang-setup.8icOVA/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:342:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
    typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                        ^~~~~~~~~~~~~~~
1 error generated.
[52/727] Building CXX object lib/sanitizer_comm...on.x86_64.dir/sanitizer_deadlock_detector1.cc.
ninja: build stopped: subcommand failed.
FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-build

My guess is that llvm_clang_compiler-rt_libcxx_libcxxabi_openmp-9.0.0.tar.xz will need to be updated to a version of LLVM that works with glibc 2.31.

An alternative solution is to do something like this:

(search for Fix a problem introduced by Glibc-2.31 if you are using compiler-rt).

@ubnt-kannan
Copy link

@andrewvaughanj hello! I am having trouble trying to compile from source on 19.10 Ubuntu. When can we expect a new release (and hopefully new binary)?

For compiling from source, would it be possible to use the installed version of clang rather than building it? Compiling clang takes a very long time.

@aytey
Copy link
Contributor

aytey commented Aug 7, 2020

@ubnt-kannan:

Unfortunately, I am not a maintainer or anything of Infer -- simply a contributor. This problem really is with facebook-clang-plugins and not Infer itself, and facebook-clang-plugins needs to be updated to a newer LLVM to avoid this issue.

Unfortunately, given the way that clang plugins work, I believe it is very hard (impossible maybe?) to build facebook-clang-plugins against your system clang, rather than the clang that gets built at part of facebook-clang-plugins. Maybe if your system clang is precisely what's in facebook-clang-plugins you might be able to make it work, but I really have no idea about that.

In terms of a binary release, I know that's been waiting a while (and Infer recently went to 1.0), but I am not sure when that's happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants