Bug 5329

Summary: flex broken on target due to sysroot path to m4
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Paul Eggleton <bluelightning>
Component: devtools / tool chainAssignee: Laurentiu Palcu <laurentiu.palcu>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: diego.ml, dvhart, enrico.scholz, meta.mr.watcher, meta.watcher, olof.johansson
Version: 1.5   
Target Milestone: 1.5.1   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Paul Eggleton 2013-10-09 14:12:07 UTC
If you attempt to use flex on the target it tries to call m4 at the sysroot path and fails:

flex: fatal internal error, exec of /opt/yocto_builder/build/tmp/sysroots/x86_64-linux/usr/bin/m4 failed

This was fixed earlier using a wrapper script:

http://cgit.openembedded.org/openembedded-core/commit/?id=7bdb617f2f0e246feb4dc32931fdb87258fd1207

But then seems to have regressed after this change:

http://cgit.openembedded.org/openembedded-core/commit/?id=2ca72d35e839a0fa24d33bf75343f187792f4e2c

It's also worth noting that flex currently doesn't have a runtime dependency on m4. I'm not 100% sure that it's needed, but if it can't process the examples/testxxLexer.l file supplied with flex without calling it (as seen here) it does suggest that it is required.
Comment 1 Enrico Scholz 2013-11-05 18:03:42 UTC
will

EXTRA_OECONF += " ac_cv_path_M4=${M4}"
EXTRA_OEMAKE += " m4=${M4_class-native}"

solve it?
Comment 2 Paul Eggleton 2013-11-05 18:21:41 UTC
That would be preferable to the profile.d-based fix, however it's somewhat unorthodox to use overrides in the manner the second line does. We do also need the extra RDEPENDS as far as I can tell.
Comment 3 Enrico Scholz 2013-11-05 18:53:14 UTC
When it is really too unorthodix, then add add a helper variable

M4NATIVE = "${STAGING_BINDIR_NATIVE}/m4"
M4_class-native = "${M4NATIVE}"
EXTRA_OECONF += "ac_cv_path_M4=${M4}"
EXTRA_OEMAKE += "m4=${M4NATIVE}"

About which RDEPENDS are you speaking?  By using fix above, all the 'create_wrapper' appends can be removed.
Comment 4 Enrico Scholz 2013-11-05 18:59:44 UTC
By looker further into it, the M4 variable can be removed completely when 'create_wrapper' scripts are removed. So, add

EXTRA_OECONF += "ac_cv_path_M4=${bindir}/m4"
EXTRA_OEMAKE += "m4=${STAGING_BINDIR_NATIVE}/m4"

and remove 'M4* = ...' and the do_install_append...()