Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 705800 - sys-devel/flex: cross compilation fails, stage1flex segfault - pointer truncation by implicit declaration
Summary: sys-devel/flex: cross compilation fails, stage1flex segfault - pointer trunca...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2020-01-18 23:47 UTC by Andrew Aladjev
Modified: 2020-09-01 17:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

rpl malloc and realloc declarations (rpl_malloc_and_realloc_declarations.flex.patch,1.28 KB, patch)
2020-01-18 23:47 UTC, Andrew Aladjev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Aladjev 2020-01-18 23:47:06 UTC
Hello. I am working on cross compilation using musl toolchains. I've failed to cross compile sys-devel/flex. Please see build log here

The reason of this segfault was well defined by Florian Weimer in the following post.

I've investigated this bug and found that it is not related to flex, it is related to autotools itself. Autotools just adds "#define malloc rpl_malloc" and "#define realloc rpl_realloc" into config. It looks like nobody knows why and nobody will fix it Autotools are abandoned and broken by design.

This issue can be fixed properly by core flex developer only by moving from autotools to other build system. But we need some fix for now. I will attach my proposed workaround here.

Thank you.

Reproducible: Always
Comment 1 Andrew Aladjev 2020-01-18 23:47:46 UTC
Created attachment 603698 [details, diff]
rpl malloc and realloc declarations
Comment 2 tt_1 2020-09-01 17:46:45 UTC
thank you so much for the patch, it really saved the day! 

if you want to, please try to push the patched ebuild to the overlay for the time being, thanks