Compiling TBB on Linux using Sun Studio 12.1 compilers
In the past I managed to compile Intel Threading Building Blocks on Linux using the GNU C/C++ compiler or the Intel C/C++ compiler. TBB also support Sun Studio compilers on Solaris. Today I tried to compile TBB on a Linux box running Ubuntu 9.10 (x86) using the Sun Studio 12.1 compilers, unfortunately without success.
This combination of OS and compiler is not supported by TBB 2.2. Thus, I copied the file SunOS.suncc.inc to linux.suncc.inc and started the compilation of TBB by "OS=linux compiler=suncc make". However, I got several errors. My approach is probably to naive.
Has anybody managed to compile TBB on Linux using Sun Studio compilers?
Your approach is basically right. Please check whether some OS-specific stuff sneaked into compiler-specific "linux.suncc.inc" or vice-versa, compiler-spicifics come into linux.inc. E.g. I found "EXPORT_KEY" definition in linux.inc which should not be there by design. So, please try to move it into compiler files instead. If you still are not able to compile with suncc, could you share the output with the errors?
Finally, I managed to compile TBB on Linux using the Sun compiler. However, just editing "linux.suncc.inc" was not enough. The main problem is that TBB includes several Linux system headers that declare different sets of functions and macros depending on the compiler. For example syscall and pthread_getattr_np cannot be found if the Sun compiler is used. Thus, I had to apply several work-arounds. E.g. in scheduler.cpp I had to add
[cpp]extern "C" int pthread_getattr_np(pthread_t thread, pthread_attr_t *attr); [/cpp]