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

Does not compile on Alpine (musl) #101

Open
ventosus opened this issue Jan 24, 2024 · 0 comments
Open

Does not compile on Alpine (musl) #101

ventosus opened this issue Jan 24, 2024 · 0 comments

Comments

@ventosus
Copy link

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,
     )
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

1 participant