Skip to content

Does not compile on Alpine (musl) #101

Open
@ventosus

Description

@ventosus
ninja: job failed: c++ -Insmd.p -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -pthread -MD -MQ nsmd.p/src_nsmd.cpp.o -MF nsmd.p/src_nsmd.cpp.o.d -o nsmd.p/src_nsmd.cpp.o -c ../src/nsmd.cpp
../src/nsmd.cpp:47:10: fatal error: fts.h: No such file or directory
   47 | #include <fts.h>
      |          ^~~~~~~
compilation terminated.

musl does not include 'fts_*' functions, they are in a separate library 'musl-fts' which needs to be linked to:

I've not found out how to detect musl in meson, but looking for 'fts_open' seems to be the better check.

Possible fix to get inspired from:

diff --git a/meson.build b/meson.build
index ff5364d..92c1c0b 100644
--- a/meson.build
+++ b/meson.build
@@ -41,6 +41,8 @@ fltkdep = cc.find_library('fltk', required: get_option('nsm-legacy-gui') or get_
 fltkimagesdep = cc.find_library('fltk_images', required: get_option('nsm-legacy-gui'))
 fluid = find_program('fluid', required: get_option('nsm-proxy'))
 
+has_fts = cc.has_function('fts_open')
+ftsdep = dependency('musl-fts', required: not has_fts)
 
 ##############
 #Build Targets
@@ -48,7 +50,7 @@ fluid = find_program('fluid', required: get_option('nsm-proxy'))
 
 executable('nsmd',
     sources: ['src/nsmd.cpp', 'src/debug.cpp', 'src/Endpoint.cpp', 'src/file.cpp', 'src/Thread.cpp'],
-    dependencies: [liblodep, threaddep],
+    dependencies: [liblodep, threaddep, ftsdep],
     install: true,
     )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions