Skip to content

Alpine linux can't link to the library installed via apk #2860

@wisonye

Description

@wisonye
  1. Install via native apk

    doas apk --no-cache add notcurses notcurses-dev notcurses-doc notcurses-libs notcurses-static notcurses-tetris notcurses-view
  2. Create a hello program, compile and run:

    >>> [ RUN ]
    >>> OS_TYPE: Linux
    >>> BUILD_TYPE: Debug
    >>> STATIC_BUILD: No
    >>> MUSL_LIBC: Yes
    >>> COMMAND: /usr/lib/llvm19/bin/clang
    -std=c23 -Wall -Werror
    -D ENABLE_DEBUG_LOG
    -D_BSD_SOURCE -DNCURSES_WIDECHAR
    -lnotcurses -lnotcurses-core
    -D __MUSL__ -D _GNU_SOURCE
    -g
    -o ./temp_build/main
    src/main.c
    && ./temp_build/main
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/main-9b2484.o: in function `main':
    # /home/wison/c/notcurses-tutorial/c/src/main.c:95:(.text+0x4c): undefined reference to `notcurses_core_init'
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/wison/c/notcurses-tutorial/c/src/main.c:96:(.text+0x59): undefined reference to `notcurses_stdplane'
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/wison/c/notcurses-tutorial/c/src/main.c:105:(.text+0xcb): undefined reference to `notcurses_stop'
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/main-9b2484.o: in function `ncplane_putstr_yx':
    # /usr/include/notcurses/notcurses.h:2277:(.text+0x136): undefined reference to `ncplane_putegc_yx'
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/main-9b2484.o: in function `notcurses_render':
    # /usr/include/notcurses/notcurses.h:1150:(.text+0x1c1): undefined reference to `notcurses_stdplane'
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/include/notcurses/notcurses.h:1151:(.text+0x1ce): undefined reference to `ncpile_render'
    # /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/include/notcurses/notcurses.h:1154:(.text+0x1e5): undefined reference to `ncpile_rasterize'
    # clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Libraries in the default link path:

    ls -lht /usr/lib/{libnotcurses.so, libnotcurses-core.so}
    
    # lrwxrwxrwx    1 root     root          22 Mar 12 16:04 /usr/lib/libnotcurses-core.so -> libnotcurses-core.so.3*
    # lrwxrwxrwx    1 root     root          17 Mar 12 16:04 /usr/lib/libnotcurses.so -> libnotcurses.so.3*

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions