Bug 371885

Summary: kservice-5.27.0: fails to build with flex-2.6.2
Product: [Frameworks and Libraries] frameworks-kservice Reporter: Timo Gurr <timo.gurr>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED UPSTREAM    
Severity: normal CC: kdelibs-bugs-null, luis.davila.pc, zhaixiang
Priority: NOR    
Version First Reported In: 5.27.0   
Target Milestone: ---   
Platform: Exherbo   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Timo Gurr 2016-10-31 10:32:37 UTC
When flex-2.6.2 is installed the build fails with:

[...]
[ 87%] Building C object src/CMakeFiles/KF5Service.dir/lex.c.o
cd /var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build/src && /usr/bin/x86_64-pc-linux-gnu-cc  -DKCOREADDONS_LIB -DKF5Service_EXPORTS -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"kservice5\" -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build/src -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/kservice-5.27.0/src -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build/src/.. -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/kservice-5.27.0/src/services -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/kservice-5.27.0/src/sycoca -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/kservice-5.27.0/src/plugin -I/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/kservice-5.27.0/src/kdeinit -isystem /usr/include/KF5/KConfigCore -isystem /usr/include/KF5 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib/qt5/mkspecs/linux-g++ -isystem /usr/include/KF5/KCoreAddons -isystem /usr/include/KF5/KI18n -isystem /usr/include/KF5/KDBusAddons -isystem /usr/include/qt5/QtDBus -isystem /usr/include/qt5/QtXml  -pipe -O2 -march=native -DNDEBUG -DQT_NO_DEBUG -std=iso9899:1990 -fno-common -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wmissing-format-attribute -Wwrite-strings -Werror=implicit-function-declaration -fPIC -fvisibility=hidden   -fPIC -o CMakeFiles/KF5Service.dir/lex.c.o   -c /var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build/src/lex.c
services/lex.l: In function 'KTraderParse_initFlex':
services/lex.l:160:3: error: implicit declaration of function 'yy_switch_to_buffer' [-Werror=implicit-function-declaration]
services/lex.l:160:24: error: implicit declaration of function 'yy_scan_string' [-Werror=implicit-function-declaration]
services/lex.l: In function 'kiotraderwrap':
services/lex.l:166:3: error: implicit declaration of function 'yy_delete_buffer' [-Werror=implicit-function-declaration]
services/lex.l: At top level:
/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build/src/lex.c:1368:16: warning: 'input' defined but not used [-Wunused-function]
make[2]: Leaving directory '/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build'
make[1]: Leaving directory '/var/tmp/paludis/build/kde-frameworks-kservice-5.27.0/work/build'
cc1: some warnings being treated as errors
make[2]: *** [src/CMakeFiles/KF5Service.dir/build.make:953: src/CMakeFiles/KF5Service.dir/lex.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:398: src/CMakeFiles/KF5Service.dir/all] Error 2
make: *** [Makefile:131: all] Error 2
[...]

With the previous flex 2.6.1 kservice-5.27.0 builds without any issue.
Comment 1 David Faure 2016-11-04 08:28:25 UTC
So why not report this to the flex authors? ;-)
Comment 2 Timo Gurr 2016-11-08 18:08:48 UTC
There was already an open bug:
https://github.com/westes/flex/issues/113
But it wasn't entirely clear if flex needs fixing or the consumers need to adapt. Upstream reacted now and an upstream commit has finally landed resolving the problem with flex:
https://github.com/westes/flex/commit/c8ad3d682fb0ea39e30a70449c7f88b8cd8da6b4
Comment 3 Leslie Zhai 2016-12-14 02:33:54 UTC
Hi Timo,

Workaround patch:

diff --git a/src/services/lex.l b/src/services/lex.l
index b43adca..516cc4c 100644
--- a/src/services/lex.l
+++ b/src/services/lex.l
@@ -157,12 +157,12 @@ double KTraderParse_putSimplePositiveFloat( char *_str )
 
 void KTraderParse_initFlex( const char *_code, yyscan_t _scanner )
 {
-  yy_switch_to_buffer( yy_scan_string( _code, _scanner ), _scanner );
+  kiotrader_switch_to_buffer( kiotrader_scan_string( _code, _scanner ), _scanner );
 }
 
 int yywrap( yyscan_t _scanner )
 {
   struct yyguts_t * yyg = (struct yyguts_t*)_scanner;
-  yy_delete_buffer( YY_CURRENT_BUFFER, _scanner );
+  kiotrader_delete_buffer( YY_CURRENT_BUFFER, _scanner );
   return 1;
 }
Comment 4 Leslie Zhai 2017-01-03 02:58:11 UTC
flex-2.6.3 fixed ;-)