Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 418453 - dev-cpp/tbb-4.0.297 as-needed LDFLAGS breaks OpenCL programs
Summary: dev-cpp/tbb-4.0.297 as-needed LDFLAGS breaks OpenCL programs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sébastien Fabbro (RETIRED)
URL: http://bugs.debian.org/cgi-bin/bugrep...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-31 21:33 UTC by Julian Ospald
Modified: 2012-08-08 12:05 UTC (History)
1 user (show)

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


Attachments
tbb-4.0.297-ldflags.patch (tbb-4.0.297-ldflags.patch,11.44 KB, patch)
2012-05-31 22:14 UTC, Julian Ospald
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Ospald 2012-05-31 21:33:33 UTC
LDLFLAGS only seem to apply to libs that follow them. This is the other way around (also see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=347650):

x86_64-pc-linux-gnu-g++ -fPIC -o libtbb.so.2 concurrent_hash_map.o concurrent_queue.o concurrent_vector.o dynamic_link.o itt_notify.o cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o reader_writer_lock.o spin_rw_mutex.o spin_mutex.o critical_section.o task.o tbb_misc.o tbb_misc_ex.o mutex.o recursive_mutex.o condition_variable.o tbb_thread.o concurrent_monitor.o semaphore.o private_server.o rml_tbb.o task_group_context.o governor.o market.o arena.o scheduler.o observer_proxy.o tbb_statistics.o tbb_main.o concurrent_vector_v2.o concurrent_queue_v2.o spin_rw_mutex_v2.o task_v2.o   -ldl -lpthread -lrt -shared -Wl,-soname=libtbb.so.2 -m64 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--version-script,tbb.def


that's a pretty weird build system, I'll see if I can hack together a patch.
Comment 1 Julian Ospald 2012-05-31 22:14:49 UTC
Created attachment 313767 [details, diff]
tbb-4.0.297-ldflags.patch

proposal

portage does not complain about ldflags and the build logs look all good.
Comment 2 Sébastien Fabbro (RETIRED) gentoo-dev 2012-06-01 17:59:45 UTC
applied in cvs. thanks!
Comment 3 Adam Hunt 2012-08-06 05:46:25 UTC
This patch causes a problem with programs that use intel-ocl-sdk.  With the patch applied, OpenCL devices are not detected.  Specifically, the function clGetPlatformIDs returns -1001.  By commenting out the patch in the ebuild, OpenCL programs work.

Here is a simple unit test that fails when tbb-4.0.297-ldflags.patch is applied and passes when it is not.

#include <CL/cl.h>

int main(){

    cl_uint numPlatforms = 0;
    if(clGetPlatformIDs(1, NULL, &numPlatforms) < 0)
        return 1;
    return 0;
}

I don't understand the exact problem, but I'll keep looking.  The patch looks pretty straight forward.
Comment 4 Julian Ospald 2012-08-08 05:33:55 UTC
do you have as-needed in your LDFLAGS? could you try without?
Comment 5 Adam Hunt 2012-08-08 05:49:42 UTC
That did the trick.  I hadn't specified LDFLAGS in my make.conf.  As you probably know, the default is LDFLAGS="-Wl,-O1 -Wl,--as-needed".  Now things that depend on  intel-ocl-sdk work fine.  Thank you.
Comment 6 Julian Ospald 2012-08-08 12:05:24 UTC
'--as-needed' seems to conflict with the way these libs work

which means I couldn't fix it via build system, so we just filter the flag.


+  08 Aug 2012; Julian Ospald <hasufell@gentoo.org> tbb-4.0.297.ebuild:
+  filter out --as-needed wrt #418453#c3