# Building cvmfs on alpine linux "musl" not "glibc"

**URL:** <https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385>\
**Category:** Client\
**Created:** [December 7, 2023, 1:35pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385 "2023-12-07T13:35:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tru.huynh](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@tru.huynh](https://cernvm-forum.cern.ch/u/tru.huynh)\
**Post date:** [December 7, 2023, 1:35pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/1 "2023-12-07T13:35:22Z")

</div>

Hello

I am trying to build cvmfs on alpine linux and obviously failed at the first stage…

```auto
alpine-virt-318:~/cvmfs/build$ cmake ../
Running CMake version 3.26.5
Installing shared libraries to: lib64
-- checking gcc version...
-- using compiler opt flag -Os 
Enable inotify support
-- running bootstrap.sh ...
Bootstrap - Externals lib location: /home/bisadm/cvmfs/externals
Bootstrap - Externals build location: /home/bisadm/cvmfs/externals_build
Bootstrap - Externals install location: /home/bisadm/cvmfs/externals_install
Bootstrap - Base CVMFS C flags: -Os -g -fno-strict-aliasing -fasynchronous-unwind-tables -fno-omit-frame-pointer -fwrapv -fvisibility=hidden -Wall -Wno-format-truncation -fno-optimize-sibling-calls
Bootstrap - Base CVMFS C++ flags: -Os -g -fno-strict-aliasing -fasynchronous-unwind-tables -fno-omit-frame-pointer -fwrapv -fvisibility=hidden -Wall -Wno-format-truncation -fno-exceptions -fno-optimize-sibling-calls
Bootstrap - 64bit: TRUE
Bootstrap - found libcurl
Bootstrap - found libcrypto
Bootstrap - found pacparser
Bootstrap - found zlib
Bootstrap - found sparsehash
Bootstrap - found leveldb
Bootstrap - found googletest
Bootstrap - found ipaddress
Bootstrap - found maxminddb
Bootstrap - found protobuf
Bootstrap - found googlebench
Bootstrap - found sqlite3
Bootstrap - found vjson
Bootstrap - found sha3
Bootstrap - found libarchive
Project prefix path: /home/bisadm/cvmfs/externals_install
System prefix path: /usr/local;/usr;/;/usr;/usr;/usr/X11R6;/usr/pkg;/opt
CMake Error at CMakeLists.txt:250 (message):
  execinfo.h is missing on your system
Call Stack (most recent call first):
  CMakeLists.txt:266 (pedantic_include_check)
  CMakeLists.txt:304 (look_for_required_include_files)

-- Configuring incomplete, errors occurred!

```

`execinfo.h` is provided on CentOS-7 by `glibc-headers` but as alpine linux is musl based, there is no glibc …

dead end?

Thanks

Tru

---

<div class="post-metadata">

**Author:** ![vavolkl](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ebca7d/32.png) [@vavolkl](https://cernvm-forum.cern.ch/u/vavolkl)\
**Post date:** [December 7, 2023, 2:06pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/2 "2023-12-07T14:06:12Z")

</div>

Hi Tru,

welcome to the forum! This does not seem like a dead end, but certainly means some work will have to be done. CVMFS explicitly uses execinfo to generate stack traces, so you’d either need to `ifdef`-out this functionality, or you could check if getting this header file from another package is is an option for you (a quick web search indicates that libexecinfo has been removed from alpine, but libelfutil-dev could be an option?).

---

<div class="post-metadata">

**Author:** ![tru.huynh](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@tru.huynh](https://cernvm-forum.cern.ch/u/tru.huynh)\
**Post date:** [December 7, 2023, 2:52pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/3 "2023-12-07T14:52:30Z")

</div>

Hello Valentin,

Thanks for the hint:

```auto
alpine-virt-318:~/cvmfs/build$ apk info -L elfutils-dev
elfutils-dev-0.189-r2 contains:
usr/include/dwarf.h
usr/include/gelf.h
usr/include/libelf.h
usr/include/nlist.h
usr/include/elfutils/elf-knowledge.h
usr/include/elfutils/known-dwarf.h
usr/include/elfutils/libasm.h
usr/include/elfutils/libdw.h
usr/include/elfutils/libdwelf.h
usr/include/elfutils/libdwfl.h
usr/include/elfutils/version.h
usr/lib/libasm.so
usr/lib/libdw.so
usr/lib/libelf.so
usr/lib/pkgconfig/libdw.pc
usr/lib/pkgconfig/libelf.pc

```

no execinfo.h ! cmake fails at the same step (obviously):

```auto
alpine-virt-318:~/cvmfs/build$ \rm -rf *; cmake ..
...
-- Looking for syslog.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for execinfo.h
-- Looking for execinfo.h - not found
CMake Error at CMakeLists.txt:250 (message):
  execinfo.h is missing on your system
Call Stack (most recent call first):
  CMakeLists.txt:266 (pedantic_include_check)
  CMakeLists.txt:304 (look_for_required_include_files)

-- Configuring incomplete, errors occurred!

```

---

<div class="post-metadata">

**Author:** ![tru.huynh](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@tru.huynh](https://cernvm-forum.cern.ch/u/tru.huynh)\
**Post date:** [December 7, 2023, 3:01pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/4 "2023-12-07T15:01:38Z")

</div>

cvmfs is not alone:

- [[execinfo.h] has been removed from alpine linux · Issue #3036 · spdk/spdk · GitHub](https://github.com/spdk/spdk/issues/3036)
- [Compilation fails on latest Alpine Linux (missing execinfo.h) · Issue #124 · awslabs/aws-lambda-cpp · GitHub](https://github.com/awslabs/aws-lambda-cpp/issues/124)  
from the many google hits

Cheers

Tru

---

<div class="post-metadata">

**Author:** ![tru.huynh](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@tru.huynh](https://cernvm-forum.cern.ch/u/tru.huynh)\
**Post date:** [December 7, 2023, 3:05pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/5 "2023-12-07T15:05:59Z")

</div>

Oh, I missed the closed issue:

> <https://github.com/cvmfs/cvmfs/issues/3070>
>
> Some Linux distributions, like Alpine Linux, for example, build on top of \[musl …libc\](https://musl.libc.org/) instead of glibc. Using musl is also possible in Gentoo Linux, but it's optional. We have a tinderbox testing packages against musl, and that tinderbox filed a \[bug\](https://bugs.gentoo.org/832422) for CVMFS on Gentoo as it doesn't seem to be ready to be compiled with musl libc. The installation fails at configuration time, complaining about lack of the \`execinfo.h\` header, which is not provided by musl. Please see the full details in the bug report.

Tru

---

<div class="post-metadata">

**Author:** ![vavolkl](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ebca7d/32.png) [@vavolkl](https://cernvm-forum.cern.ch/u/vavolkl)\
**Post date:** [December 7, 2023, 3:25pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/6 "2023-12-07T15:25:54Z")

</div>

I’ve quickly tried to build [GitHub - resslinux/libexecinfo](https://github.com/resslinux/libexecinfo) from source and that seems to work - although I would not use this in production, in the end it’ll likely be better to patch out execinfo alltogether.

Going on to compile, I’ve hit  
[https://inbox.vuxu.org/musl/20220412182436.519e76e5598d272e7a1afada@zhasha.com/T/](https://inbox.vuxu.org/musl/20220412182436.519e76e5598d272e7a1afada@zhasha.com/T/)

and

[https://bugs.gentoo.org/717542](https://bugs.gentoo.org/717542)

but gcc seems happy with the workaround that can luckily also be found in those links.

---

<div class="post-metadata">

**Author:** ![vavolkl](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ebca7d/32.png) [@vavolkl](https://cernvm-forum.cern.ch/u/vavolkl)\
**Post date:** [December 7, 2023, 3:33pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/7 "2023-12-07T15:33:13Z")

</div>

Next, it seems like \<glob.h\> in musl also differs significantly, missing functionality used in swissknife\_sync

---

<div class="post-metadata">

**Author:** ![tru.huynh](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@tru.huynh](https://cernvm-forum.cern.ch/u/tru.huynh)\
**Post date:** [December 7, 2023, 4:53pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/8 "2023-12-07T16:53:15Z")

</div>

I have manually compiled `libexecinfo` but I am stuck a little further down (after adding manually more packages)…

```auto
alpine-virt-318:~/cvmfs/build$ \rm -rf * && cmake ..
<...>
Using libcrypto for libcvmfs_crypto from /home/bisadm/cvmfs/externals_install/crypto/include
-- Found GTest: /home/bisadm/cvmfs/externals_install/lib/libgtest.a  
-- Found VJSON: /home/bisadm/cvmfs/externals_install/lib/libvjson.a  
-- Found LibArchive: /home/bisadm/cvmfs/externals_install/lib/libarchive.a  
-- Found ZLIB: /home/bisadm/cvmfs/externals_install/lib/libz.a (found version "1.2.8")  
-- Found SHA3: /home/bisadm/cvmfs/externals_install/lib/libsha3.a  
-- Found CARES: /home/bisadm/cvmfs/externals_install/lib/libcares.a  
-- Found CURL: /home/bisadm/cvmfs/externals_install/lib/libcurl.a (found version "7.86.0")  
-- Checking for module 'sqlite3'
-- Found sqlite3, version 3.41.2
-- Found Sqlite3: /home/bisadm/cvmfs/externals_install/lib/libsqlite3.a
-- Found leveldb: /home/bisadm/cvmfs/externals_install/lib  
-- Found UUID: /usr/lib/libuuid.so
-- Found pacparser: /home/bisadm/cvmfs/externals_install/lib/libpacparser.a
-- Found Sparsehash: /home/bisadm/cvmfs/externals_install/include  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Protobuf: /home/bisadm/cvmfs/externals_install/lib/libprotobuf.a  
-- Found FUSE: /usr/lib/libfuse.so
-- Found FUSE3: /usr/lib/libfuse3.so
Enable Fuse3 cache_readdir support
-- Found PythonLibs: /usr/lib/libpython3.11.so (found version "3.11.6") 
FATAL Cap include dirs cannot be found
FATALPcap library cannot be found
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LibCAP (missing: CAP_LIBRARIES CAP_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindLibCAP.cmake:42 (find_package_handle_standard_args)
  CMakeLists.txt:438 (find_package)

-- Configuring incomplete, errors occurred!
alpine-virt-318:~/cvmfs/build$ 

```

but `libpcap-dev` is installed …

```auto
alpine-virt-318:~/cvmfs/build$ apk info |grep libpcap
libpcap
libpcap-dev

```

---

<div class="post-metadata">

**Author:** ![laura](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/l/a4c791/32.png) [@laura](https://cernvm-forum.cern.ch/u/laura)\
**Post date:** [December 8, 2023, 12:51pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/9 "2023-12-08T12:51:43Z")

</div>

just as a side note: if you fail during the “cmake” process of cvmfs and you install new packages, you have start the configuration process from new. easiest is to just delete `build/` and recreate it

edit: sometimes it also includes the externals `externals_build/` and `externals_install/`

---

<div class="post-metadata">

**Author:** ![laura](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/l/a4c791/32.png) [@laura](https://cernvm-forum.cern.ch/u/laura)\
**Post date:** [December 8, 2023, 1:11pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/10 "2023-12-08T13:11:13Z")

</div>

and for the `libcap` it seems like you might have nstalled the wrong package.

there is a `libcap` package (no `libPcap`) for alpine [Alpine Linux packages](https://pkgs.alpinelinux.org/packages?name=libcap-dev&branch=edge&repo=&arch=&maintainer=)

---

<div class="post-metadata">

**Author:** ![tru.huynh](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@tru.huynh](https://cernvm-forum.cern.ch/u/tru.huynh)\
**Post date:** [December 8, 2023, 2:08pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/11 "2023-12-08T14:08:19Z")

</div>

oh… facepalm’ed, fixing my typoed installed libcap-dev.

thx

---

<div class="post-metadata">

**Author:** ![system](https://cernvm-forum.cern.ch/uploads/default/original/1X/3e336816dfbfe00295701fad16d3bf5b3fca3a02.jpeg) [@system](https://cernvm-forum.cern.ch/u/system)\
**Post date:** [December 23, 2023, 2:08pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/12 "2023-12-23T14:08:43Z")

</div>

Closed on December 23, 2023, 2:08pm UTC

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![vavolkl](https://cernvm-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ebca7d/32.png) [@vavolkl](https://cernvm-forum.cern.ch/u/vavolkl)\
**Post date:** [January 22, 2024, 2:08pm UTC](https://cernvm-forum.cern.ch/t/building-cvmfs-on-alpine-linux-musl-not-glibc/385/13 "2024-01-22T14:08:32Z")

</div>

Opened on January 22, 2024, 2:08pm UTC


