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

backtrace not available on alpine linux #245

Closed
ksedgwic opened this issue Oct 18, 2024 · 13 comments
Closed

backtrace not available on alpine linux #245

ksedgwic opened this issue Oct 18, 2024 · 13 comments

Comments

@ksedgwic
Copy link
Collaborator

reported by @king-11:

410.1 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ./.libs/libclboss.a(libclboss_la-Signature.o):Signature.cpp:(.text._ZN4Util18BacktraceExceptionISt16invalid_argumentEC2IJRA23_KcEEEDpOT_[_ZN4Util18BacktraceExceptionISt16invalid_argumentEC5IJRA23_KcEEEDpOT_]+0x89): more undefined references to `backtrace' follow

RUN apk add --repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main/ libexecinfo-dev
RUN apk add elfutils-dev
before that the error was about missing header execinfo.h
@ksedgwic
Copy link
Collaborator Author

I think libunwrap will work

@king-11
Copy link
Contributor

king-11 commented Oct 18, 2024

Actually I have tried all the available options at most of the implementations I have found related to backtrace they generally make it optional for alpine because of library incompatibility if that's an easier route to go with

@ksedgwic
Copy link
Collaborator Author

I was using libunwrap initially, and it worked. After a bunch of exploration I decided it wasn't any better than backtrace, which I thought was omnipresent, so I switched back to backtrace.

I'd love to have a consistent solution that works averywhere, so maybe libunwrap is the one ... I don't think it is hard to try anyway (probably have the code in a git stash).

@king-11
Copy link
Contributor

king-11 commented Oct 19, 2024

That would be great I can help in trying it out if you can push it to some branch.

ksedgwic added a commit to ksedgwic/clboss that referenced this issue Oct 24, 2024
The backtrace() interface is not available on Alpine. ([ZmnSCPxj#245])
@ksedgwic
Copy link
Collaborator Author

I pushed a draft: #249

@chrisguida
Copy link
Contributor

Left a comment on #249

@king-11
Copy link
Contributor

king-11 commented Oct 25, 2024

52.27 ../../Util/BacktraceException.hpp:5:10: fatal error: execinfo.h: No such file or directory
52.27     5 | #include <execinfo.h>
52.27       |          ^~~~~~~~~~~~

bare minimum clboss docker image

FROM alphine:3.18

WORKDIR /build

RUN apk update && \
    apk add \
      git \
      autoconf-archive \
      automake \
      bind-tools \
      build-base \
      curl-dev \
      libev-dev \
      libtool \
      pkgconf \
      sqlite-dev

# new package for backtrace
RUN apk add libunwind-dev

ARG CLBOSS_GIT_HASH \
    CLBOSS_REPO
RUN git clone --recurse-submodules $CLBOSS_REPO clboss
RUN cd clboss && \
    git checkout $CLBOSS_GIT_HASH && \
    autoreconf -i && \
    ./configure --prefix=/usr && \
    make -j $(nproc) && \
    make -j $(nproc) install && \
    make clean

@king-11
Copy link
Contributor

king-11 commented Oct 25, 2024

adding libexecinfo-dev reaches a litte farther but its not available with latest alpine images due to mentioned reasons here and moreover it still fails

294.9 make[2]: *** [Makefile:3251: dev-boltz] Error 1
296.1 /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ./.libs/libclboss.a(libclboss_la-open_rpc_socket.o): in function `Util::BacktraceException<std::runtime_error>::format_backtrace[abi:cxx11]() const':
296.1 open_rpc_socket.cpp:(.text._ZNK4Util18BacktraceExceptionISt13runtime_errorE16format_backtraceB5cxx11Ev[_ZNK4Util18BacktraceExceptionISt13runtime_errorE16format_backtraceB5cxx11Ev]+0xf0): undefined reference to `backtrace_symbols'
296.1 /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ./.libs/libclboss.a(libclboss_la-Object.o): in function `Util::BacktraceException<std::invalid_argument>::format_backtrace[abi:cxx11]() const':
296.1 Object.cpp:(.text._ZNK4Util18BacktraceExceptionISt16invalid_argumentE16format_backtraceB5cxx11Ev[_ZNK4Util18BacktraceExceptionISt16invalid_argumentE16format_backtraceB5cxx11Ev]+0x10f): undefined reference to `backtrace_symbols'
296.2 /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ./.libs/libclboss.a(libclboss_la-runcmd.o): in function `Util::BacktraceException<Util::BacktraceException<std::runtime_error> >::format_backtrace[abi:cxx11]() const':
296.2 runcmd.cpp:(.text._ZNK4Util18BacktraceExceptionINS0_ISt13runtime_errorEEE16format_backtraceB5cxx11Ev[_ZNK4Util18BacktraceExceptionINS0_ISt13runtime_errorEEE16format_backtraceB5cxx11Ev]+0x11a): undefined reference to `backtrace_symbols'
296.2 /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ./.libs/libclboss.a(libclboss_la-NodeId.o): in function `Util::BacktraceException<std::range_error>::format_backtrace[abi:cxx11]() const':
296.2 NodeId.cpp:(.text._ZNK4Util18BacktraceExceptionISt11range_errorE16format_backtraceB5cxx11Ev[_ZNK4Util18BacktraceExceptionISt11range_errorE16format_backtraceB5cxx11Ev]+0xf0): undefined reference to `backtrace_symbols'
296.2 /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ./.libs/libclboss.a(libclboss_la-PrivKey.o): in function `Util::BacktraceException<std::out_of_range>::format_backtrace[abi:cxx11]() const':
296.2 PrivKey.cpp:(.text._ZNK4Util18BacktraceExceptionISt12out_of_rangeE16format_backtraceB5cxx11Ev[_ZNK4Util18BacktraceExceptionISt12out_of_rangeE16format_backtraceB5cxx11Ev]+0x10f): undefined reference to `backtrace_symbols'

@vasild
Copy link
Contributor

vasild commented Oct 25, 2024

@king-11 that probably needs an extra -lexecinfo:

export LDFLAGS=-lexecinfo
./configure
make

@ksedgwic
Copy link
Collaborator Author

@king-11 Pls let me know if the additional LDFLAGS=-lexecinfo works for you (and I'll update the PR)

@king-11
Copy link
Contributor

king-11 commented Oct 28, 2024

Thanks @vasild that did it, @ksedgwic the build succeeded.

The dependencies for alpine are:

  • libunwind-dev
  • libexecinfo-dev

@ksedgwic
Copy link
Collaborator Author

great! I'll update the PR #249

@vasild thanks for figuring this out!

ksedgwic added a commit to ksedgwic/clboss that referenced this issue Oct 28, 2024
The backtrace() interface is not available on Alpine. ([ZmnSCPxj#245])
ksedgwic added a commit that referenced this issue Oct 28, 2024
The backtrace() interface is not available on Alpine. ([#245])
@ksedgwic
Copy link
Collaborator Author

Fixed with #249

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

4 participants