You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "err931 (via GitHub)" <gi...@apache.org> on 2025/02/01 09:29:14 UTC

[I] [misc] Kvrocks building problems and solutions on Alpine Linux [kvrocks]

err931 opened a new issue, #2758:
URL: https://github.com/apache/kvrocks/issues/2758

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
   
   
   ### Motivation
   
   Driven by my intellectual curiosity, I experimented with building Kvrocks on Alpine Linux, which uses `musl libc` as its C library. During this process, I encountered several build errors, and I would like to share the solutions I discovered with the Kvrocks development team.
   
   ## Version
   
   - Kvrocks: v2.11.0
   
   ## Specs
   
   - OS: Alpine Linux 3.21.2
   - Compiler: gcc (Alpine 14.2.0)
   
   ## Error Details
   
   1. **Backtrace unavailable.**
   
    Since `libbacktrace` is an extension of glibc and not defined in `musl libc`, the line `find_package(Backtrace REQUIRED)` in `CMakeLists.txt` should be removed. Additionally, the dependency [cpptrace](https://github.com/jeremy-rifkin/cpptrace#library-back-ends) suggests using `libdwarf` for symbol resolution, which should be set as the default option.
   
   2. **`#include <execinfo.h>` unavailable in musl.**
   
    This header file is not available in `musl libc`. Adding a guard as shown below can resolve the issue:
   
   - **`src/cli/signal_util.h`**
   
   ```cpp
   #ifdef __GLIBC__
   #include <execinfo.h>
   #endif
   ```
   
   3. **`google/glog v0.7.x` causes build errors with `musl libc`.**
   
    **This is an issue on the `google/glog v0.7.x` side, not Kvrocks.** We need to wait for bug fixes from the dependent library.
   
   Best regards,
   
   ### Solution
   
   mentioned above
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [misc] Kvrocks building problems and solutions on Alpine Linux [kvrocks]

Posted by "aleksraiden (via GitHub)" <gi...@apache.org>.
aleksraiden commented on issue #2758:
URL: https://github.com/apache/kvrocks/issues/2758#issuecomment-2628883520

   Thanks about investigation, @err931 
   Early version of kvrocks use a Alpine (at 2.5.0, see: https://github.com/apache/kvrocks/pull/1434) but we are switched to debian for compatibility, when fully support of musl are breached. 
   
   1 and 2 your points maybe is easy to fix, as I see, but glog is not so easy. Could you add patch for 1 and 2 problems? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [misc] Kvrocks building problems and solutions on Alpine Linux [kvrocks]

Posted by "err931 (via GitHub)" <gi...@apache.org>.
err931 commented on issue #2758:
URL: https://github.com/apache/kvrocks/issues/2758#issuecomment-2628920764

   Thanks for your quick reply!
   
   Once I confirm that the build is successful in my development environment, I'll submit a pull request to address these issues.
   
   > If we include it but didn't use it, it can be just removed. Otherwise we should know which function we're using from execinfo.
   
   Yeah. I built with the `-DSYMBOLIZE_BACKEND=libdwarf` option and it was successful. By default (`addr2line`) had the same result. No problem to delete it. Maybe.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [misc] Kvrocks building problems and solutions on Alpine Linux [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #2758:
URL: https://github.com/apache/kvrocks/issues/2758#issuecomment-2628902065

   Thank for your effort! It's valuable for Kvrocks.
   
   > Since libbacktrace is an extension of glibc and not defined in musl libc, the line find_package(Backtrace REQUIRED) in CMakeLists.txt should be removed.
   
   Yeah it can be removed.
   
   > Additionally, the dependency [cpptrace](https://github.com/jeremy-rifkin/cpptrace#library-back-ends) suggests using libdwarf for symbol resolution, which should be set as the default option.
   
   IIRC we currently use addr2line as the backtrace backend of cpptrace. For libdwarf it's a little complicated: it's LGPL licensed, and due to ASF policy, it's in [Category X](https://www.apache.org/legal/resolved.html#category-x). So currently we make it an optional and non-default dep, see here:
   https://github.com/apache/kvrocks/blob/b87827533396557bc84ee348e2b29674d02ddf64/cmake/cpptrace.cmake#L27-L32
   
   > This header file is not available in musl libc. Adding a guard as shown below can resolve the issue:
   
   If we include it but didn't use it, it can be removed. Otherwise we should know which function we're using from execinfo.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [misc] Kvrocks building problems and solutions on Alpine Linux [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice closed issue #2758: [misc] Kvrocks building problems and solutions on Alpine Linux
URL: https://github.com/apache/kvrocks/issues/2758


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org