Skip to main content

Problem:

Is there a way to insure that the "cob" compile command uses the xlc_r compiler with C code?  It appears to be defaulting to xlc and causing compile issues with C code.    Is it possible to override the cob default at a user and/or server level?  

xlc_r invokes the thread safe version of xlc. It should be used when any kind of multi-threaded code is being built.

Resolution:

When linking C code the -x,CC flags are required when using the cob command - this in combination with a C source file i.e. .C will invoke the xlC (C compiler) if the -t option is also used the xlC_r (reentrant C ) compiler will be used.

cob  -t -x,CC mypgm.C

It is possible to  configure the C and C compilers used by cob on a per session basis.

To set the C compiler, set the environment variable CC, and for C use the environment variable CCOO. Assuming ksh, put the following in .profile

export CC=xlc_r

export CCOO=xlC_r

When writing a multi-thread application the cob flag -t. should always be specified.

Old KB# 2222