zim-tools

Has anyone managed to build zim-tools
https://github.com/openzim/zim-tools
It's meant for tools working with zim files; zimcheck, zimdiff, zimdump, zimpatch, zimrecreate, zimsearch, zimsplit, zimwriterfs.

They say to use meson, and then ninja to compile.
I seemed to have satisfied meson, but I don't fancy my luck with building it.

Code:
# ninja -C build
ninja: Entering directory `build'
[4/4] Linking target src/zimcheck/zimcheck
FAILED: src/zimcheck/zimcheck
c++  -o src/zimcheck/zimcheck src/zimcheck/zimcheck.p/main.cpp.o src/zimcheck/zimcheck.p/zimcheck.cpp.o src/zimcheck/zimcheck.p/checks.cpp.o src/zimcheck/zimcheck.p/json_tools.cpp.o src/zimcheck/zimcheck.p/.._tools.cpp.o src/zimcheck/zimcheck.p/.._metadata.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,-rpath,/usr/local/lib -Wl,-rpath-link,/usr/local/lib -Wl,--start-group /usr/local/lib/libzim.so /usr/lib/liblzma.so /usr/local/lib/libzstd.so /usr/local/lib/libxapian.so /usr/local/lib/libicui18n.so /usr/local/lib/libicuuc.so /usr/local/lib/libicudata.so /usr/local/lib/libdocopt.so -Wl,--end-group
ld: error: undefined symbol: pthread_create
>>> referenced by __threading_support:317 (/usr/include/c++/v1/__threading_support:317)
>>>               src/zimcheck/zimcheck.p/checks.cpp.o:(std::__1::__libcpp_thread_create[abi:fe180100](pthread**, void* (*)(void*), void*))
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
 
And pthread_create(3) says it exists in libpthread. So maybe you need to add some include/linker directories?
For POSIX threads, there's the special compiler switch -pthread, which should be used instead of directly linking a threading library (like libthr.so on FreeBSD). It will link whatever is the default POSIX threads implementation of the target platform (and, if necessary, enable other stuff required for a threaded C or C++ program).

If ninja respects LDFLAGS, just try LDFLAGS=-pthread ninja ... instead. I'm not too familiar with these build systems, maybe it must be passed to meson somehow instead.
 
There are plenty of ports using meson/ninja to build things. It's probably easier if you create a basic port skeleton to build this software. Then most of those settings are automagically set by the ports system.

 
pkg install -A meson ninja

And pthread_create(3) says it exists in libpthread. So maybe you need to add some include/linker directories?
Thanx, but with /usr/include/pthread.h already available, and meson having already found other things in /usr/include
the build has reached a point where I'm not comfortable with further experimenting unless I'm damn sure what it's doing, and frankly I have no idea what meson and ninja are actually doing.
 
It build fine, for mustache it is mustache and not libmustache.
Here is my diff
Code:
diff --git a/src/zimcheck/meson.build b/src/zimcheck/meson.build
index 6871df7..ed6e851 100644
--- a/src/zimcheck/meson.build
+++ b/src/zimcheck/meson.build
@@ -2,6 +2,8 @@ if compiler.has_header('mustache.hpp')
   extra_include = []
 elif compiler.has_header('mustache.hpp', args: '-I/usr/include/kainjow')
   extra_include = ['/usr/include/kainjow']
+elif compiler.has_header('mustache.hpp', args: '-I/usr/local/include/kainjow')
+  extra_include = ['/usr/local/include/kainjow']
 else
   error('Cannot find header mustache.hpp')
 endif
@@ -11,6 +13,8 @@ inc = include_directories(extra_include)
 if compiler.get_id() == 'gcc' and host_machine.system() == 'linux'
   # C++ std::thread is implemented using pthread on linux by gcc
   thread_dep = dependency('threads')
+elif host_machine.system() == 'freebsd'
+  thread_dep = dependency('threads')
 else
   thread_dep = dependency('', required:false)
 endif
 
Back
Top