mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #485] Bug: clang compilation failed because of fprintf #379
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#379
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mishasychev on GitHub (Aug 18, 2025).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/485
Originally assigned to: @jmcnamara on GitHub.
I'm using libxlsxwriter 1.2.3 in c++ project. Release compilation with all compiler checks enabled fails with error:
The problem is that clang has an
fprintfmacro in glibc, so the compiler doesn't understand what is wanted from it. Solution I found is to enclose thefprintffunction in brackets:misc: file is also missing some includes (
stdio.h,stdint.h)@jmcnamara commented on GitHub (Aug 18, 2025):
Could you let me know:
@mishasychev commented on GitHub (Aug 19, 2025):
with
glibc.CMake example configuration:
clang crashes when building internal lib files, so any use is acceptable as an example:
@jmcnamara commented on GitHub (Aug 20, 2025):
Thanks for the detail.
I cannot reproduce this using Ubuntu 24 (the only version I had to hand) and clang 18 using the provided sample CMake file and example.
The sample
Are you sure that the provided example demonstrates the error?
Also, can you reproduce it on any other system?
Libxlsxwriter has been tested extensively on Ubuntu (and other Linuxes) with gcc and clang and this is the first time this issue has been reported. There is also a C++ test case in the test suite.
@mishasychev commented on GitHub (Aug 20, 2025):
@jmcnamara, I created a repo with an error reproduction. The ci failed with the exact same error we’re encountering
@jmcnamara commented on GitHub (Aug 20, 2025):
Thanks. I'll look into it.
@jmcnamara commented on GitHub (Aug 20, 2025):
Looking at the sample repo it seems that this issue manifests itself when:
clang(but notgcc).Release(bug notDebug)._FORTIFY_SOURCE>1, which is the main cause of the issue sinceclangreplacesfprintf()with a stack overflow checking version.The test macros manpage says the following:
So the easiest thing to do would be to turn off
FORTIFY_SOURCEor set it to 1 when compilinglibxlsxwriter.@mishasychev commented on GitHub (Aug 21, 2025):
Sorry for not mentioning this earlier.
I don't think it's a good option to disable some compiler checks unless they are false positive, they can be helpful in other places in the code. In our case there is a simple solution to avoid build problems and keep fortify verification enabled. I can create a pr if you agree.
@jmcnamara commented on GitHub (Aug 21, 2025):
It would have saved us both time.
I'm only suggesting turning it off for the libxlsxwriter compilation. Is there some technical reason you can't do that?
Also, for me this is a false positive: it only happens with clang and the
FORTIFY_SOURCEdocs says "conforming programs might fail" which is exactly what happens.@jmcnamara commented on GitHub (Aug 29, 2025):
Closing.