-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix build failure due to vasprintf on Windows #295
base: master
Are you sure you want to change the base?
Conversation
MinGW’s compiler (GCC 14.2.0) errors out compiling `synctex_parser.c`. ``` synctex_parser.c: In function '_synctex_updater_print_gz': synctex_parser.c:8448:13: error: implicit declaration of function 'vasprintf'; did you mean 'vsprintf'? 8448 | if (vasprintf(&buffer, format, va) < 0) { | ^~~~~~~~~ | vsprintf ``` `vasprintf` is a custom function (not the standard `vsprintf`) that’s defined in the same translation unit a few lines above. However its definition is wrapped within a `if defined(_MSC_VER)` i.e. it’s only enabled when compiled with MSVC compiler. This fix enables it also for MinGW compilers.
i am getting the same error with a compiler different than MinGW, but the #295 only addresses the MinGW scenario. https://lists.gnu.org/archive/html/emacs-elpa-diffs/2022-08/msg01485.html |
`vasprintf` is a function available on Linux and macOS but not in Windows. Instead of restricting it for MSVC and MinGW, enable it for all compilers using standard C library function `vsnprintf`.
The function I've updated the PR to address all Windows builds in general; not specifically MinGW or MSVC. I've changed the implementation to use the standard C library function @danielkrizian This should address your issue; please let me know if it worked for you. Thank you! |
Thank you @legends2k , that fixed it for me! |
Note: Consider merging PR #308 as it's a superset of this. |
MinGW’s compiler (GCC 14.2.0) errors out compiling
synctex_parser.c
.vasprintf
is a custom function (not the standardvsprintf
) that’s defined in the same translation unit a few lines above.However its definition is wrapped within a
if defined(_MSC_VER)
i.e. it’s only enabled when compiled with MSVC compiler.This fix implements
vasprintf
(available on Linux and macOS) for Windows irrespective of compiler/toolchain used. I've implemented it using the standard C functionvsnprintf
.Fixes #286.