On Sun, Mar 15, 2015 at 4:27 AM, Bernd Kuhls <bernd.ku...@t-online.de> wrote: > Patch inspired by > https://www.winehq.org/pipermail/wine-bugs/2011-September/288987.html > http://git.alpinelinux.org/cgit/aports/tree/main/wine/uclibc-fmaxf-fminf.patch?id=c9b491b6099eec02a835ffd05539b5c783c6c43a > > Starting an app using mesa3d 10.5.x, Kodi for example, fails: > > /usr/lib/kodi/kodi.bin: symbol 'fminf': can't resolve symbol in lib > '/usr/lib/dri/i965_dri.so'. > libGL error: unable to load driver: i965_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: i965 > libGL error: unable to load driver: swrast_dri.so > libGL error: failed to load driver: swrast > > Here is some background information about the fminf/fmaxf situation in uClibc: > http://thread.gmane.org/gmane.comp.lib.uclibc.general/24189 > > Please backport this patch to the 10.5 branch. > > Signed-off-by: Bernd Kuhls <bernd.ku...@t-online.de> > --- > src/glsl/nir/nir_constant_expressions.py | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/glsl/nir/nir_constant_expressions.py > b/src/glsl/nir/nir_constant_expressions.py > index 22bc4f0..139c25a 100644 > --- a/src/glsl/nir/nir_constant_expressions.py > +++ b/src/glsl/nir/nir_constant_expressions.py > @@ -50,6 +50,18 @@ static double copysign(double x, double y) > } > #endif > > +#ifdef __UCLIBC__ > +float fmaxf(float a, float b) > +{ > + return (a > b) ? a : b; > +} > + > +float fminf(float a, float b) > +{ > + return (a < b) ? a : b; > +} > +#endif > + > /** > * Evaluate one component of packSnorm4x8. > */ > -- > 1.7.10.4
We're really trying to get rid of cruft like this. I'd really rather not add more. fminf(3) shows that it should be available if _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L, which is true if compiling with -std=c99, which we should be using if compiling with gcc. Does uclibc not implement c99 functions? I read the thread, but I didn't understand why uclibc doesn't provide them. There's a comment in the code, quoted in that thread saying... /* For the time being, do _NOT_ implement these functions * that are defined by SuSv3 [because we don't need them * and nobody asked to include them] */ so maybe uclibc just needs to add them. Also, if we were going to add more cruft like this it should go in include/c99*. The implementations are also wrong. The purpose of fmin/fmax is precisely to avoid the problem of comparison with NaN. The man page says "If one argument is a NaN, the other argument is returned.", but your implementation does not do that. But really, I think uclibc should be implementing this. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev