how to work around some compilation failures

C compilers are getting more aggressive with warnings and are producing
more false positives.  While I intend to keep ssocr compiling without
warnings (as in the last 15 years), I do not use the newest C compilers,
but rather the GCC version included in a stable GNU/Linux distribution,
it may take some time for me to encounter those problems myself, and thus
it may take some time for me to work around them.

A user reported a compilation failure due to new warnings in GCC 10.1.
Since I currently use GCC 7.5.0 from Ubuntu 18.04 LTS, I do not see
those warnings yet, and thus cannot test any workarounds yet.

A first investigation into the issue hints at a need to replace valid code
with code invalid for GCC's default C standard version (necessitating
the specification of a newer C standard in the CFLAGS) to work around
said problem.  I have no idea if there are additional warnings with GCC
10.1 after working around that one.  Since Google blocks my emails to
the reporting user, I cannot even communicate to find this out.  Thus any
code changes will have to wait for either a GCC version with additional
warnings arriving in my GNU/Linux distribution, or establishment of a
different communication channel, e.g., a GitHub issue.
This commit is contained in:
Erik Auerswald
2020-08-03 23:12:08 +02:00
parent 3a08177381
commit 08a628ff04
2 changed files with 22 additions and 0 deletions
+19
View File
@@ -54,6 +54,8 @@ Platform Specifics
- On macOS, you may need to specify the X11 include path manually, using e.g.
make CPPFLAGS=-I/opt/X11/include
C Compiler Problems:
--------------------
Some users have reported problems with their C compilers. If you are not
using a stable release version of GCC, you may need to disable security
features supposed to be provided by the C compiler, but broken in your
@@ -65,6 +67,23 @@ CFLAGS definition in the Makefile:
If you need to do this to compile ssocr, please consider reporting the issue
to your source for your C compiler (e.g., vendor or distribution).
Another problem can be the introduction of new compiler warnings. Some of
those are prone to false positives, and this problem does occur for stable
GCC releases as well. Because ssocr's CFLAGS include both options -Werror
and -pedantic-errors, false positives will break compilation of ssocr.
To work around this problem, you can remove both of these options from
the CFLAGS definition in the Makefile:
-Werror -pedantic-errors
If you suspect that your C compiler has problems with the ssocr source code,
you can use the minimal CFLAGS definition given below:
CFLAGS := $(shell imlib2-config --cflags)
You can do this by commenting out the default CFLAGS definition and removing
the comment sign in front of the minimal CFLAGS definition in the Makefile.
Website
-------
You can get the current ssocr version from the official ssocr website:
+3
View File
@@ -1,3 +1,6 @@
# minimal CFLAGS definition (try if compilation fails with default CFLAGS)
#CFLAGS := $(shell imlib2-config --cflags)
# default CFLAGS definition
CFLAGS := -D_FORTIFY_SOURCE=2 -Wall -W -Wextra -pedantic -Werror -pedantic-errors -fstack-protector-all $(shell imlib2-config --cflags) -O3
LDLIBS := -lm $(shell imlib2-config --libs)
PREFIX := /usr/local