Bug 398338 - Compilation failure on Musl due to use of vasprintf
Summary: Compilation failure on Musl due to use of vasprintf
Status: REOPENED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-06 20:09 UTC by Bart Ribbers
Modified: 2024-03-30 22:37 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bart Ribbers 2018-09-06 20:09:56 UTC
If building Okular on a Musl based system (like Alpine Linux or postmarketOS), compilation will fail:

okular-18.08.1/core/synctex/synctex_parser.c:8202:13: error: implicit declaration of function 'vasprintf' [-Werror=implicit-function-declaration]
         if (vasprintf(&buffer, format, va) < 0) {
             ^~~~~~~~~


This is due to the use of "vasprintf()" which is not part of POSIX (https://linux.die.net/man/3/vasprintf). It can be quite easily resolved by using "vsprintf()" instead, but I'm guessing this will cause problems during runtime due to missing the terminating null byte.
Comment 1 Albert Astals Cid 2018-09-09 18:25:40 UTC
Those files are "copied" from syntex, you should open an issue at https://github.com/jlaurens/synctex/issues since that way we can import fixes from them.

Also given that musl is kind of not easy to come by i guess it'd be great if you could provide a patch. It should not be very hard since there seems to be already an own implementation of vasprintf 

https://github.com/jlaurens/synctex/blob/2017/synctex_parser.c#L8409

Please if you open a bug on their side please link it here so we can also keep track of it.
Comment 2 Jonáš Vidra 2024-03-30 20:44:51 UTC
This bug is still present in Okular 23.08.5.

The error was fixed upstream in https://github.com/jlaurens/synctex/pull/39 but reappeared, because the fix was only applied to one branch. I filed a new upstream bug here: https://github.com/jlaurens/synctex/issues/80

There are two related pull requests currently open:
https://invent.kde.org/graphics/okular/-/merge_requests/722
https://invent.kde.org/graphics/okular/-/merge_requests/723
Comment 3 Jonáš Vidra 2024-03-30 22:37:42 UTC
> The error was fixed upstream in https://github.com/jlaurens/synctex/pull/39
> but reappeared, because the fix was only applied to one branch.

It was actually applied to all branches except for one, which was the one I checked. An import of the changes from either the `2024` stable branch or the `main` development one should fix the issue.