huzheng001/stardict-3

build error when add CXXFLAGS -Werror=format-security

Opened this issue · 1 comments

Take place when build in Debian 11, make deb package:

dh_auto_configure --
--disable-gnome-support
'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'

The last info is:

g++ -DHAVE_CONFIG_H -I. -I.. -Wall -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I.. -I.. -I/usr/include/libxml2 -I../../lib/src -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -c -o stardict_editor-mapfile.o test -f 'mapfile.cpp' || echo './'mapfile.cpp
In file included from /usr/include/glib-2.0/glib.h:62,
from ../../lib/config-custom.h:31,
from ../config.h:76,
from file.cpp:22:
file.cpp: In member function ‘File& File::printf(const char*, ...)’:
/usr/include/glib-2.0/glib/gmessages.h:333:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
file.cpp:60:3: note: in expansion of macro ‘g_message’
g_message(fmt);
^~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:62,
from ../../lib/config-custom.h:31,
from ../config.h:76,
from log.cpp:24:
log.cpp: In static member function ‘static void Logger::log(const gchar*, GLogLevelFlags, const gchar*, gpointer)’:
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
log.cpp:40:3: note: in expansion of macro ‘g_critical’
g_critical(message);
^~~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
log.cpp:44:4: note: in expansion of macro ‘g_critical’
g_critical(message);
^~~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
log.cpp:48:4: note: in expansion of macro ‘g_critical’
g_critical(message);
^~~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
log.cpp:52:4: note: in expansion of macro ‘g_critical’
g_critical(message);
^~~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
log.cpp:56:4: note: in expansion of macro ‘g_critical’
g_critical(message);
^~~~~~~~~~
cc1plus: some warnings being treated as errors
make[5]: *** [Makefile:2135:stardict_editor-log.o] 错误 1
make[5]: *** 正在等待未完成的任务....
cc1plus: some warnings being treated as errors
make[5]: *** [Makefile:2107:stardict_editor-file.o] 错误 1
In file included from /usr/include/glib-2.0/glib.h:62,
from ../../lib/config-custom.h:31,
from ../config.h:76,
from dsl_parser.cpp:26:
dsl_parser.cpp: In static member function ‘static bool {anonymous}::DslParser::long_to_short(std::__cxx11::string&, std::cxx11::string&)’:
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
dsl_parser.cpp:303:5: note: in expansion of macro ‘g_critical’
g_critical(lang->first);
^~~~~~~~~~
dsl_parser.cpp: In member function ‘void {anonymous}::DslParser::parse_abbrs(const string&, const string&)’:
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
dsl_parser.cpp:363:6: note: in expansion of macro ‘g_critical’
g_critical(it->c_str());
^~~~~~~~~~
dsl_parser.cpp: In member function ‘bool {anonymous}::DslParser::parse_header(MapFile&, CharsetConv&)’:
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
dsl_parser.cpp:726:7: note: in expansion of macro ‘g_critical’
g_critical(cp->first);
^~~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:62,
from ../../lib/config-custom.h:31,
from ../config.h:76,
from generator.cpp:22:
generator.cpp: In member function ‘int GeneratorBase::run(int, char**)’:
/usr/include/glib-2.0/glib/gmessages.h:333:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
generator.cpp:156:3: note: in expansion of macro ‘g_message’
g_message(version
.c_str());
^~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:333:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
generator.cpp:161:3: note: in expansion of macro ‘g_message’
g_message(format
.c_str());
^~~~~~~~~
generator.cpp: In member function ‘bool GeneratorBase::parse_option(const string&)’:
/usr/include/glib-2.0/glib/gmessages.h:336:43: error: format not a string literal and no format arguments [-Werror=format-security]
VA_ARGS)
^
generator.cpp:227:4: note: in expansion of macro ‘g_critical’
g_critical(it->first.c_str());
^~~~~~~~~~
cc1plus: some warnings being treated as errors
make[5]: *** [Makefile:2121:stardict_editor-generator.o] 错误 1
cc1plus: some warnings being treated as errors
make[5]: *** [Makefile:2093:stardict_editor-dsl_parser.o] 错误 1
make[5]: 离开目录“/home/atzlinux/stardict/tools/src”
make[4]: *** [Makefile:2549:all-recursive] 错误 1
make[4]: 离开目录“/home/atzlinux/stardict/tools/src”
make[3]: *** [Makefile:426:all-recursive] 错误 1
make[3]: 离开目录“/home/atzlinux/stardict/tools”
make[2]: *** [Makefile:358:all] 错误 2
make[2]: 离开目录“/home/atzlinux/stardict/tools”
make[1]: *** [Makefile:326:all-recursive] 错误 1
make[1]: 离开目录“/home/atzlinux/stardict”
dh_auto_build: error: make -j8 returned exit code 2
make: *** [debian/rules:6:binary] 错误 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed