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

tests/stacktrace_test.cc fails #160

Open
qzmfranklin opened this issue Jan 17, 2020 · 8 comments
Open

tests/stacktrace_test.cc fails #160

qzmfranklin opened this issue Jan 17, 2020 · 8 comments

Comments

@qzmfranklin
Copy link

commit: 2020/01/16 master 9eff867

repro:

My repo already build zlib, lzma, bzip2, etc.. So I just reused my existing builds of those repositories. I also modified the workspace names of zlib and lzma to match rules_boost.

Essentially:

13:59 $ bazel test examples/cc/boost:stacktrace_test
INFO: Invocation ID: a01f8363-eb10-46c2-bf46-46c6593ded31
INFO: Analyzed target //examples/cc/boost:stacktrace_test (3 packages loaded, 4539 targets configured).
INFO: Found 1 test target...
INFO: Writing explanation of rebuilds to 'build/logs'
ERROR: /mnt/data/cache/bazel/_bazel_zhongming/5a5efdfcd4f98edbd655a37c61128c16/external/boost/BUILD.bazel:1627:1: C++ compilation of rule '@boost//:stacktrace' failed (Exit 1) clang failed: error executing command
  (cd /mnt/data/cache/bazel/_bazel_zhongming/5a5efdfcd4f98edbd655a37c61128c16/sandbox/linux-sandbox/1579/execroot/logi && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  tools/toolchains/cc/clang/wrappers/clang -nostdinc -isystemexternal/clang/include/c++/v1 -isystemexternal/clang/lib/clang/9.0.0/include -isystem/usr/include -isystem/usr/include/x86_64-linux-gnu -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -Wall -fcolor-diagnostics -fno-omit-frame-pointer -fstack-protector -MD -MF bazel-out/k8-fastbuild/bin/external/boost/_objs/stacktrace/backtrace.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/external/boost/_objs/stacktrace/backtrace.pic.o' -fPIC -DBOOST_FALLTHROUGH -iquote external/boost -iquote bazel-out/k8-fastbuild/bin/external/boost -isystem external/boost -isystem bazel-out/k8-fastbuild/bin/external/boost -isystem external/boost/boost/stacktrace -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/stacktrace -isystem external/boost/boost/array -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/array -isystem external/boost/boost/assert -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/assert -isystem external/boost/boost/config -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/config -isystem external/boost/boost/version -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/version -isystem external/boost/boost/core -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/core -isystem external/boost/boost/functional -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/functional -isystem external/boost/boost/container_hash -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/container_hash -isystem external/boost/boost/integer -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/integer -isystem external/boost/boost/cstdint -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/cstdint -isystem external/boost/boost/limits -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/limits -isystem external/boost/boost/static_assert -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/static_assert -isystem external/boost/boost/type_traits -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/type_traits -isystem external/boost/boost/mpl -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/mpl -isystem external/boost/boost/move -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/move -isystem external/boost/boost/detail -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/detail -isystem external/boost/boost/preprocessor -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/preprocessor -isystem external/boost/boost/swap -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/swap -isystem external/boost/boost/throw_exception -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/throw_exception -isystem external/boost/boost/current_function -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/current_function -isystem external/boost/boost/exception -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/exception -isystem external/boost/boost/lexical_cast -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/lexical_cast -isystem external/boost/boost/chrono -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/chrono -isystem external/boost/boost/operators -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/operators -isystem external/boost/boost/predef -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/predef -isystem external/boost/boost/ratio -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/ratio -isystem external/boost/boost/system -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/system -isystem external/boost/boost/cerrno -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/cerrno -isystem external/boost/boost/noncopyable -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/noncopyable -isystem external/boost/boost/utility -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/utility -isystem external/boost/boost/container -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/container -isystem external/boost/boost/intrusive -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/intrusive -isystem external/boost/boost/math -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/math -isystem external/boost/boost/atomic -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/atomic -isystem external/boost/boost/concept_check -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/concept_check -isystem external/boost/boost/concept -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/concept -isystem external/boost/boost/concept_archetype -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/concept_archetype -isystem external/boost/boost/iterator -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/iterator -isystem external/boost/boost/fusion -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/fusion -isystem external/boost/boost/call_traits -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/call_traits -isystem external/boost/boost/function_types -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/function_types -isystem external/boost/boost/get_pointer -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/get_pointer -isystem external/boost/boost/ref -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/ref -isystem external/boost/boost/tuple -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/tuple -isystem external/boost/boost/typeof -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/typeof -isystem external/boost/boost/lambda -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/lambda -isystem external/boost/boost/mp11 -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/mp11 -isystem external/boost/boost/range -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/range -isystem external/boost/boost/optional -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/optional -isystem external/boost/boost/none -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/none -isystem external/boost/boost/type -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/type -isystem external/boost/boost/regex -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/regex -isystem external/boost/boost/smart_ptr -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/smart_ptr -isystem external/boost/boost/align -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/align -isystem external/boost/boost/scoped_array -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/scoped_array -isystem external/boost/boost/checked_delete -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/checked_delete -isystem external/boost/boost/scoped_ptr -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/scoped_ptr -isystem external/boost/boost/shared_array -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/shared_array -isystem external/boost/boost/shared_ptr -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/shared_ptr -isystem external/boost/boost/numeric_conversion -isystem bazel-out/k8-fastbuild/bin/external/boost/boost/numeric_conversion '-D__DATE__='\''redacted'\''' '-D__TIMESTAMP__='\''redacted'\''' '-D__TIME__='\''redacted'\''' -Wno-builtin-macro-redefined -no-canonical-prefixes -Wno-unused-value -c external/boost/libs/stacktrace/src/backtrace.cpp -o bazel-out/k8-fastbuild/bin/external/boost/_objs/stacktrace/backtrace.pic.o)
Execution platform: //tools/platforms:linux64_clang

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/boost/libs/stacktrace/src/backtrace.cpp:15:
In file included from external/boost/boost/stacktrace/detail/frame_unwind.ipp:25:
external/boost/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: 'backtrace.h' file not found
#   include <backtrace.h>
            ^~~~~~~~~~~~~
1 error generated.
Target //examples/cc/boost:stacktrace_test failed to build
INFO: Elapsed time: 19.442s, Critical Path: 0.44s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

FAILED: Build did NOT complete successfully

I searched the boost-1.71.0 repository using find . -name 'backtrace.h'. But it did not return me anything.

I also briefly Google 'backtrace.h boost'. The first few pages relate to the 0boost stacktrace module but does not mention anything super useful yet.

I'm not familiar with boost. Running out of ideas to try here.

Any pointers or keywords would be appreciated.

Thanks.

@reltuk
Copy link
Collaborator

reltuk commented Jan 17, 2020

Hi @qzmfranklin,

Sorry you're having some issues here. You can find information about different configurations for boost stacktrace and their dependencies here: https://www.boost.org/doc/libs/1_71_0/doc/html/stacktrace/configuration_and_build.html

On linux-x86_64, this repo's BUILD.boost is compiling the library in a non-header-only mode and is compiling with libs/stacktrace/src/backtrace.cpp. That's where the requirement for backtrace.h is coming from, since that file defines #define BOOST_STACKTRACE_USE_BACKTRACE.

backtrace.h itself is expected to come from libbacktrace itself, which is typically part of the compiler I think. I think you're probably running into footnote number (4) on the boost instructions above: https://www.boost.org/doc/libs/master/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3.

Let me see if I can reproduce and investigate any possible solutions...

Is a working boost stacktrace relevant to your use of rules_boost in this project, or is this more of an inquiry into the broken test suite under some situations?

@reltuk
Copy link
Collaborator

reltuk commented Jan 17, 2020

I can confirm that CC=clang CXX=clang++ bazel test :stacktrace_test on Ubuntu 18.04.3 fails with the same error.

@qzmfranklin
Copy link
Author

Wow, thanks for the nicely formatted and informative reply.

Re

Is a working boost stacktrace relevant to your use of rules_boost in this project, or is this more of an inquiry into the broken test suite under some situations?

The latter (a broken test suite). The motivating situation for me was to introduce boost into our build system for building a few other libraries that depend on boost.

We do not actively use boost directly yet. But I view supporting building boost from source as an important milestone for our team as lots of high impact libraries depend on it.

I appreciate your help here.

@QuantamHD
Copy link
Contributor

Was there any solution to this problem?

@wijagels
Copy link
Contributor

wijagels commented May 8, 2022

Not every OS provides the required library by default. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66570

Should be fixable by installing the package on your system.

Or if rules_boost included https://github.com/ianlancetaylor/libbacktrace

@QuantamHD
Copy link
Contributor

I'm building libbacktrace in bazel at the moment. I'd be happy to send a PR to this repo

@QuantamHD
Copy link
Contributor

I managed to get this to work with a hermetic cc toolchain in this commit by building libbstacktrace hermetically.

hdl/bazel_rules_hdl@196706d

@baryluk
Copy link

baryluk commented Aug 14, 2022

I am having same issue. I am trying to use boost::stacktrace , but compilation failes due to missing backtrace.h include. I am using hermetic builds, and I would like to use addr2line instead as a stacktrace backend.

Maybe `:stacktrace_addr2line" , so I can use that insead of backtrace.cpp (which is default on Linux). I only use the stacktrace at top level of main when exiting abnormally, so performance is not horribly important. Also I am trying to make static executable so less library depdendencies the better.

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

5 participants