Bug 7141 - Cannot include omp.h from SDK
Summary: Cannot include omp.h from SDK
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 1.7
Hardware: All Multiple
: Medium normal
Target Milestone: 1.8 M3
Assignee: Paul Eggleton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-01-14 14:45 UTC by Paul Eggleton
Modified: 2015-02-12 14:47 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2015-01-14 14:45:01 UTC
If libgomp-dev is installed in the SDK, omp.h is installed in /opt/poky/1.7/sysroots/core2-64-poky-linux/usr/lib/gcc/x86_64-poky-linux/4.9.1/include, however gcc complains it cannot be found:

$ $CC -fopenmp -o temp.o temp.c
temp.c:1:17: fatal error: omp.h: No such file or directory
 #include <omp.h>
                 ^
compilation terminated.

Indeed -Wp,-v shows that gcc doesn't look in that directory at all:

$ $CC -Wp,-v -o test5 test5.c
ignoring nonexistent directory "/opt/poky/1.7/sysroots/core2-64-poky-linux/usr/local/include"
ignoring nonexistent directory "/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.9.1/../../../../../x86_64-poky-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.9.1/include
 /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.9.1/include-fixed
 /opt/poky/1.7/sysroots/core2-64-poky-linux/usr/include
End of search list.

omp.h is installed as part of the target sysroot, not nativesdk, so we need to account for this additional directory.
Comment 1 Mark Hatle 2015-01-16 23:37:46 UTC
I have reproduced the problem locally as well.  The fix in poky-contrib with commit ID: d3d5ec821fdf3e117ba76ad93cbff8bb7fd80727 is working for me as fix.
Comment 2 Paul Eggleton 2015-01-17 10:55:45 UTC
OK, thanks. I ran that fix past Richard and he has asked me to eliminate the exposure of target_libdir to the build environment, which I think I can do by instead stripping the sysroot from libdir. I should be able to send a new patch early next week.
Comment 3 Paul Eggleton 2015-01-21 17:26:44 UTC
I've sent an updated patch that takes care of Richard's earlier concerns:

http://cgit.openembedded.org/openembedded-core-contrib/commit/?h=paule/gcc-omp-fix&id=c452114d4c6cb205336bc729d3fc2f57fd821bab
Comment 4 Paul Eggleton 2015-01-29 16:20:07 UTC
Fix now merged to master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=8bef63373d605576779adef3ebd34c52f72632ef

I'm assuming we'd want to backport this to dizzy / daisy as well.
Comment 5 Paul Eggleton 2015-02-12 14:47:19 UTC
Fix merged to dizzy as well:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=dizzy&id=ceb5a66d0b378fe4898bf7ccc5945246bbe332fc

I think we can mark this one as resolved now.