Bug 87137

Summary: Unable to build when configured with openmp and CFLAGS/LDFLAGS contain -fopenmp
Product: Mesa Reporter: Bob <chris.anderson2014>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED NOTABUG QA Contact:
Severity: trivial    
Priority: medium CC: 0xe2.0x9a.0x9b
Version: 10.3   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Bob 2014-12-09 06:18:02 UTC
For sometime now, I have a mythtv machine that I built using gentoo. I sometimes update it and have noticed that for sometime that the build fails when I enable openmp in gentoo;s use flags (does that mean it gets configured with --openmp or something or other) and also add -fopenmp to the CFLAGS and LDFLAGS.

The bug is here https://bugs.gentoo.org/show_bug.cgi?id=532020, which the gentoo nazi's will probably reject because there is no line that contains my CPU id but the solution for me is to add a define for:
extern int omp_get_num_threads();
 in src/mesa/swrast/s_aatritemp.h  
and the missing header in for  #include <omp.h>
in src/mesa/swrast/s_context.c and src/mesa/swrast/s_texcombine.c

I think that you need to add this with some goddamn ugly #if defined(...)  nastyness, but I could be wrong.
Comment 1 Matt Turner 2014-12-09 06:37:57 UTC
Dear Vlad/Bob/Chris (which is it?!),

Please submit a patch to mesa-dev@lists.freedesktop.org adding

#ifdef _OPENMP
#include <omp.h>
#endif

to the files that call omp_* functions.

Also, don't put -fopenmp in your system CFLAGS. It doesn't do anything without the package being written with OpenMP.

Sincerely, a Gentoo Developer.
Comment 2 Bob 2014-12-09 06:56:21 UTC
(In reply to Matt Turner from comment #1)
> Dear Vlad/Bob/Chris (which is it?!),
none of the above. 
> 
> Please submit a patch to mesa-dev@lists.freedesktop.org adding
> 
> #ifdef _OPENMP
> #include <omp.h>
> #endif
> 
> to the files that call omp_* functions.
> 
> Also, don't put -fopenmp in your system CFLAGS. It doesn't do anything
> without the package being written with OpenMP.

I don't remember why I added that. I did this long ago because the mythtv box is a low powered atom that struggles with video playback. Maybe I was just clutching at straws back then when I spent a few minutes trying to use it for video playback

> Sincerely, a Gentoo Developer.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.