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.
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.
applied in cvs. thanks!
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.
do you have as-needed in your LDFLAGS? could you try without?
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.
'--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