Bug 492670

Summary: Build error with clang and musl (on Gentoo)
Product: [Applications] okular Reporter: vadorovsky
Component: PDF backendAssignee: Okular developers <okular-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 24.08.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description vadorovsky 2024-09-05 07:36:11 UTC
SUMMARY

Okular (both master branch and 24.08.0) fail to build with clang as compiler and musl as system libc.

STEPS TO REPRODUCE
1. Use Gentoo with musl-llvm profile . Maybe it's reproducible also on Alpine, but I'm not sure.
2. Build Okular either from source (git) or with `emerge -av kde-apps/okular`

OBSERVED RESULT

[  9%] Building C object CMakeFiles/okularcore.dir/core/synctex/synctex_parser.c.o
/home/vadorovsky/src/okular/core/synctex/synctex_parser.c:1627:85: warning: missing field 'page' initializer [-Wmissing-field-initializers]
 1627 |                                                             synctex_data_ref_thv_max};
      |                                                                                     ^
/home/vadorovsky/src/okular/core/synctex/synctex_parser.c:3717:12: warning: variable 'tested_len' set but not used [-Wunused-but-set-variable]
 3717 |     size_t tested_len = 0;    /*  the number of characters at the beginning of the_string that match */
      |            ^
/home/vadorovsky/src/okular/core/synctex/synctex_parser.c:8059:13: error: call to undeclared function 'vasprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 8059 |         if (vasprintf(&buffer, format, va) < 0) {
      |             ^
/home/vadorovsky/src/okular/core/synctex/synctex_parser.c:8059:13: note: did you mean 'vsprintf'?
/usr/include/stdio.h:116:5: note: 'vsprintf' declared here
  116 | int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
      |     ^
2 warnings and 1 error generated.
gmake[2]: *** [CMakeFiles/okularcore.dir/build.make:581: CMakeFiles/okularcore.dir/core/synctex/synctex_parser.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:731: CMakeFiles/okularcore.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2


EXPECTED RESULT
A successful build

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo Linux (musl-llvm profile)