/usr/lib/mpich/bin/mpiCC is in mpich-bin 1.2.7-10ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | #! /bin/sh
#
# Script to compile and link MPI programs
# We'd like to just add a few libraries to the link line and an include
# directory to the compile line, but some systems that MPICH supports make
# that difficult because the compiler and the linker are different programs.
# Thus, this code tries to figure out which options go where, at least for
# things that are different between compile and link steps.
#
# New Organization:
# To better support a range of compilers and library formats, the compilation
# scripts can now read a configuration file describing the compiler (defaults
# are provided in the script for the default case, i.e., same as MPICH was
# built with. This file is mpicc-<compilername>.conf. For example, a
# typical installation might have mpicc-cc.conf and mpicc-gcc.conf, for the
# vendor compiler and gcc, respectively. These are selected by either setting
# the environment variable CC, or using the -config name switch.
#
DoLink=1
DoCompile=0
show_compile=0
show_link=0
MPILOG=
CCFLAGS=" -DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1"
Show=eval
allargs=
compileargs=
linkargs=
linkobjs=
gettinglinkarg=0
gettingdeptargetname=0
quotecount=0
HasDashC=0
UsesPmpi=0
verbose=0
#
# Directory locations: Fixed for any MPI implementation
prefix=/usr/lib/mpich
exec_prefix=${prefix}
sysconfdir=${exec_prefix}/etc
includedir=/usr/lib/mpich/include
libdir=/usr/lib/mpich/lib
#
#
# Default compiler configuration. A configuration file may override any
# of these (including the location of the MPI library), but must do so
# consistently with the MPICH library chosen. By including the library
# and include paths here, we can use the same mpicc for a range of
# libraries and compilers, including ones for 32 and 64 bit systems.
CCCBASE="g++"
CCLINKERBASE="g++"
LDFLAGSBASE="-Wl,-Bsymbolic-functions -Wl,-z,relro"
USER_CFLAGS=" -DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1"
ROMIO_TCFLAGS=""
ROMIO_LFLAGS=""
BASE_LIB_LIST=" -lpthread -lrt "
LIB_PATH="-L${libdir} "
MPILIBNAME="mpich"
MPIVERSION="1.2.7 (release) of : 2005/11/04 11:54:51"
FLIBNAME="mpich"
# F77_IN_C_LIBS are the libraries needed to link with the Fortran routines
# referenced from MPI_Init. With any luck, this will usually be empty
F77_IN_C_LIBS=""
hasMPE=yes
#
MPI_WITH_PMPI="yes"
proflib=-lp${MPILIBNAME}
proflibfullname=${libdir}/libp${MPILIBNAME}.a
# Shared library support (probably does not work yet with CC)
SHAREDKIND="gcc"
SHARED_LIB_SEARCH_PATH_LEADER='-Wl,-rpath -Wl,'
SHARED_LIB_LOCALDIR=""
sharedlibdir=/usr/lib/mpich/lib/shared/
#
# Override the compilers using environment variables
CCLINKER="${MPICH_CCLINKER-$CCLINKERBASE}"
#
# C++ variables
cpplib=-l${MPILIBNAME}++
cpplibfullname=${libdir}/lib${MPILIBNAME}++.a
cppproflib=-lp${MPILIBNAME}++
cppproflibfulname=${libdir}/libp${MPILIBNAME}++.a
CXXFLAGS="-I${includedir}/mpi2c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fexceptions"
LDFLAGS=""
CCC="${MPICH_CCC-$CCCBASE}"
CCLINKER="${MPICH_CCLINKER-$CCLINKERBASE}"
if [ -n "$MPICH_CCC" ] ; then
CCC="$MPICH_CCC"
CCCname=`echo $CCC | sed 's/ /-/g'`
if [ -s $sysconfdir/mpicxx-$CCCname.conf ] ; then
# Do this one first for OS's that don't respect filename case
. $sysconfdir/mpicxx-$CCCname.conf
elif [ -s $sysconfdir/mpiCC-$CCCname.conf ] ; then
. $sysconfdir/mpiCC-$CCCname.conf
fi
else
CCC="$CCCBASE"
fi
UseSharedLib=${MPICH_USE_SHLIB-no}
if [ -z "g++" -o -z "g++" ] ; then
echo "No C++ compiler and linker specified when MPICH configured."
exit 1
fi
for arg in "$@" ; do
# echo procssing arg $arg
# Special processing for -o name
if [ $gettinglinkarg = 1 ] ; then
linkargs="$linkargs $arg"
outputfilename="$arg"
gettinglinkarg=0
continue
fi
# Special processing for gcc -Mxxx.o
if [ $gettingdeptargetname = 1 ] ; then
# Because below we use eval, we do indirection (easier than quoting).
# Quoting for make will be done by the compiler.
eval "quotedarg$quotecount=\$arg"
compileargs="$compileargs \$quotedarg$quotecount"
allargs="$allargs \$quotedarg$quotecount"
quotecount=`expr $quotecount + 1`
gettingdeptargetname=0
continue
fi
case "$arg" in
-c)
# If -c is NOT specified, then we need to perform a link step.
allargs="$allargs $arg"
compileargs="$compileargs $arg"
# If -o was set, then we need to move the output file option
# to the compile line (note that this is non-standard, and should
# not be used in portable codes)
if [ $DoLink = 1 -a -n "$outputfilename" ] ; then
compileargs="$compileargs -o $outputfilename"
fi
DoLink=0
HasDashC=1
;;
-o)
# Need to link
allargs="$allargs $arg"
if [ $HasDashC = 1 ] ; then
# Some BUT NOT ALL compilers support -o with -c. Allow
# the user to make use of the feature, IF IT EXISTS.
compileargs="$compileargs $arg"
else
linkargs="$linkargs $arg"
# Still need to add the target of the -o
gettinglinkarg=1
DoLink=1
fi
;;
-E|-M|-MM)
# For compilers that support -E as a way to get at the C preprocessor
# Also, for compilers that support -M or -MM for creating dependencies
allargs="$allargs $arg"
compileargs="$compileargs $arg"
HasDashC=1
DoLink=0
;;
-MT|-MQ|-MF)
# recent gcc's (>2.95.4) allow dependency generation as a side effect
# while compiling, including setting the target name to be output
# in the dependency line with -MT or -MQ, and the
# dependency file with -MF.
# Do not delete the following name.
allargs="$allargs $arg"
compileargs="$compileargs $arg"
gettingdeptargetname=1
;;
-mpilog)
if [ $UsesPmpi = 1 ] ; then
echo "Only one of -mpilog, -mpitrace, or -mpianim may be used."
exit 1
else
UsesPmpi=1
fi
if [ "$hasMPE" = "yes" ] ; then
MPILOG="-llmpe -lmpe"
else
echo "-mpilog requires the MPE libraries"
fi
;;
-mpitrace)
if [ $UsesPmpi = 1 ] ; then
echo "Only one of -mpilog, -mpitrace, or -mpianim may be used."
exit 1
else
UsesPmpi=1
fi
if [ "$hasMPE" = "yes" ] ; then
MPILOG="-ltmpe -lmpe"
else
echo "-mpitrace requires the MPE libraries"
fi
;;
-mpianim)
if [ $UsesPmpi = 1 ] ; then
echo "Only one of -mpilog, -mpitrace, or -mpianim may be used."
exit 1
else
UsesPmpi=1
fi
if [ "$hasMPE" = "yes" ] ; then
MPILOG="-lampe -lmpe"
else
echo "-mpianim requires the MPE libraries"
fi
;;
-echo)
set -x
;;
-show)
Show=echo
;;
-config=*)
CCname=`echo A$arg | sed -e 's/A-config=//g'`
if [ -s $sysconfdir/mpiCC-$CCname.conf ] ; then
. $sysconfdir/mpiCC-$CCname.conf
else
echo "Configuration file mpiCC-$CCname.conf not found"
fi
;;
-CC=*)
CCC=`echo A$arg | sed -e 's/A-CC=//g'`
CCLINKER="$CCC"
;;
-compile_info|-compile-info)
show_compile=1
DoLink=0
Show=echo
;;
-link_info|-link-info)
show_link=1
Show=echo
;;
-v)
verbose=1
echo "mpiCC for $MPIVERSION"
compileargs="$compileargs -v"
linkargs="$linkargs -v"
;;
-l*)
# This SHOULD be the -l<lib> argument. Only for the linker
linkargs="$linkargs $arg"
allargs="$allargs $arg"
;;
-help)
echo "This is a program to compile or link C++ MPI programs"
echo "In addition, the following special options are supported"
echo " -mpilog - Build version that generate MPE log files"
echo " -mpitrace - Build version that generates traces"
echo " -mpianim - Build version that generates real-time"
echo " animation"
echo " -CC=pgm - Change the program to use to compile and link"
echo " MPI programs. WARNING! The program that you"
echo " choose MUST be compatible with the MPICH "
echo " libraries. If you have trouble, you should"
echo " reconfigure and rebuild MPICH, selecting"
echo " this compiler."
echo " -show - Show the commands that would be used without"
echo " runnning them"
echo " -compile-info - Show how to compile a program"
echo " -link-info - Show how to link a program"
echo " -help - Give this help"
echo " -echo - Show exactly what this program is doing."
echo " This option should normally not be used."
echo "This should be used just like the usual C++ compiler"
echo "For example,"
echo " $0 -c foo.C "
echo "and"
echo " $0 -o foo foo.o"
echo "Combining compilation and linking in a single command"
echo " $0 -o foo foo.C"
echo "may not work on some systems, and is not recommended."
exit 1
;;
# Unrecognized args. Because we do an eval, we need to
# carefully quote any args that contain quotes.
*\"*)
qarg="'"$arg"'"
allargs="$allargs $qarg"
compileargs="$compileargs $qarg"
linkargs="$linkargs $qarg"
;;
*\'*)
qarg='\"'"$arg"'\"'
allargs="$allargs $qarg"
compileargs="$compileargs $qarg"
linkargs="$linkargs $qarg"
;;
*) allargs="$allargs $arg"
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".C" -o "$ext" = ".cxx" -o "$ext" = ".cpp" -o \
"$ext" = ".cc" -o "$ext" = ".c" -o "$ext" = ".CC" ] ; then
DoCompile=1
compileargs="$compileargs $arg"
fname=`basename $arg $ext`
linkobjs="$linkobjs $fname.o"
elif [ "$ext" = ".s" -o "$ext" = ".S" ] ; then
# Support .s for those compilers that can
DoCompile=1
compileargs="$compileargs $arg"
fname=`basename $arg $ext`
linkobjs="$linkobjs $fname.o"
elif [ "$ext" = ".o" ] ; then
if [ $HasDashC = 1 ] ; then
compileargs="$compileargs $arg"
else
DoLink=1
linkobjs="$linkobjs $arg"
fi
else
compileargs="$compileargs $arg"
linkargs="$linkargs $arg"
fi
else
compileargs="$compileargs $arg"
linkargs="$linkargs $arg"
fi
;;
esac
done
#
status=0
if [ $HasDashC = 1 -a $DoCompile = 0 -a $DoLink = 0 ] ; then
# Specified -c but no files. Try to force -c behavior from compiler
DoCompile=1
fi
#
# One user has asked that
# mpicxx -o foo mysources/foo.c
# not generate the local foo.o file, which happens if you use
# two steps, like
# mpicxx -c mysources/foo.c
# mpicxx -o foo foo.o
# which is not desired. The user is correct; the MPICH2 scripts try
# to use a single step.
#
if [ $DoCompile = 1 -o $show_compile = 1 ] ; then
if [ $HasDashC != 1 ] ; then
compileargs="-c $compileargs"
fi
# note the use of HAVE_MPI_CPP to cause the mpi++.h file to be
# included from mpi.h
$Show $CCC $CCFLAGS -DHAVE_MPI_CPP $CXXFLAGS $compileargs -I$includedir
status=$?
if [ $status != 0 ] ; then
exit $status
fi
fi
if [ $DoLink = 1 -o $show_link = 1 ] ; then
# If no LDFLAGS defined, use the ones that MPICH was built with
if [ -z "$LDFLAGS" ] ; then
LDFLAGS="$LDFLAGSBASE"
fi
# Figure out the library list. Because we want to support both a single
# mpi library containing both C and Fortran interfaces, as well as
# a library that allows multiple Fortran interfaces, we may need different
# library link lines. With a unified C/Fortran library, we just
# use -l${MPILIBNAME}. With separate Fortran libraries, we need
# -l<fortranwrapperlib> -l${MPILIBNAME} -l<fortransuplib>
# We also handle the profiling library here, which may not be needed
# for those systems that support weak symbols.
if [ "${MPILIBNAME}" = "${FLIBNAME}" -o -z "${FLIBNAME}" ] ; then
mpilibs="-l${MPILIBNAME}"
else
mpilibs="-l${FLIBNAME} -l${MPILIBNAME} -l${FLIBNAME}fsup"
fi
# If the profiling library doesn't exist, or MPICH_NO_PROF environment
# variable is set, skip the profiling library.
if [ -n "$MPICH_NO_PROF" -o ! -s "$proflibfullname" ] ; then
proflib=""
fi
#
# Some programs need the profiling library, so add it if it exists
# The C++ libraries use only a single library name
if [ -s "$cppproflibfulname" ] ; then
cpplib="${cppproflib}"
elif [ ! -s "$cpplibfullname" ] ; then
cpplib=""
fi
# IRIX complains if we include a library twice. In the case of a
# library using weak symbols, we don't need the proflib. Just
# in case we do, there is an enviroment variable that
# can be used to override this test.
if [ "${MPI_WITH_PMPI}" = "yes" -a "$MPICH_INCLUDE_PROFLIB" != yes ] ; then
proflib=""
fi
# If proflib is non-empty, then add it
if [ -n "$proflib" ] ; then
# We include the last "mpilibs" because the mpilibs contains the
# ADI routines. There is a chance that a file in the first mpich.a
# invokes a pmpi routine that needs an ADIO routine.
mpilibs="$proflib $mpilibs $proflib $mpilibs"
fi
# If the C++ library doesn't exist, skip it
# This may be needed because the C++ build wants to build executables
# before the libraries are built.
#
# This also assumes that any libraries needed by the C linker to handle
# any Fortran dependencies are also needed by the C++ linker.
# This is true when using the PGI compilers and specifying pgf90 as the
# Fortran compiler (not just as the f90 compiler)
$Show $CCLINKER $CCFLAGS $LDFLAGS $ROMIO_LFLAGS $LIB_PATH $linkobjs $linkargs $LDFLAGS $cpplib $MPILOG $mpilibs $BASE_LIB_LIST $F77_IN_C_LIBS
status=$?
fi
exit $status
|