Closed Leixb closed 7 months ago
I'm currently the maintainer of the AUR package and can confirm this issue. Arch Linux's build system contains a lot of additional compiler flags, which triggers a bunch of warning. And with -Werror
, the build just fails. The current workaround is omitting the following line in the CMake file:
For reference, these are the flags use by Arch to compile C programs:
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
From further investigation, the build will fail if any of these configurations are set:
-DCMAKE_BUILD_TYPE='Release'
.-O2
compiler flag is set.-Wp,-D_FORTIFY_SOURCE=3
compiler flag is set.Removing all three results in successful build.
Thanks for your input.
Also thanks for the compilation parameters @TheBill2001
I will try to fix the resulting warnings for it. But I think I also have to get rid of the -Werror
in the repo, as other Distributions can then again have other compilation parameters creating warnings and leading to an error.
For the asprintf Im not sure if I should replace it by the function in the code or check the return values. Checking the return values would be the 100% "right" way, but if something like memory allocation fails the program will crash anyway.
Description
When trying to build the project from source, it fails with the following error:
This seems to be caused because glibc contains its own definition of
asprintf
which has thewarn_unused_result
attribute.If I remove
-Werror
and build the binary, everything works as expected and theasprintf
linked in the final binary is the one from yourutility.h
, so it's quite strange thatgcc
complains about it.For completeness, here is the full build log:
Here are some environment details:
On which OS does the problem happen?
Linux