Option Directory Not Found

Hello, I’m a bit new to the world of PGI, so I will try to explain this the best I can. I’m working with Mac OS 10.9.5 and PGI 15.1. I’m trying to compile, but I keep getting this error that I can’t seem to chase down.

I installed the PGI software with default options. Here are the environment vars I’m using:

setenv PGI /opt/pgi/osx86-64/15.1
set path = ( $PGI/bin /opt/pgi/osx86-64/2015/mpi/mpich/bin $path )
setenv LM_LICENSE_FILE <our license server>

setenv CC pgcc
setenv FC pgf90
setenv F77 pgf90
setenv F90 pgf90
setenv FCFLAGS -I/opt/pgi/osx86-64/2015/mpi/mpich/include
setenv F90FLAGS -I/opt/pgi/osx86-64/2015/mpi/mpich/include
setenv CPPFLAGS -I/opt/pgi/osx86-64/2015/mpi/mpich/include
setenv LDFLAGS -L/opt/pgi/osx86-64/2015/mpi/mpich/lib
setenv MPIF90 /opt/pgi/osx86-64/2015/mpi/mpich/bin/mpif90
setenv MPIF77 /opt/pgi/osx86-64/2015/mpi/mpich/bin/mpif90
setenv MPICC /opt/pgi/osx86-64/2015/mpi/mpich/bin/mpicc
setenv C_INCLUDE_PATH /opt/pgi/osx86-64/2015/mpi/mpich/include

Then, I try to compile a simple test file:

mpicc -o cpi cpi.c

The output error I keep getting is:

ld: warning: directory not found for option '-L/proj/ta/libraries/mpich-3.1.3/osx86-64/pgi/15.1/Darwin-10.8.0-i386-64bit/lib'

I’ve tried quite a few different environment variable settings, but I keep ending up stuck with the above error. I have no idea where this option is coming from. It just seems to be limited to 15.1 for me- I try with 14.10 (and change the appropriate environment vars), and it compiles and runs fine.

Anyone have any idea what might be causing the issue or how I can chase it down?


This is a bug which has been reported as TPR#21383. We inadvertently introduced this issue during the update of MPICH to version 3.1.3 in 15.1.

This will be fixed with the PGI 15.3 update, due soon.

In the meantime, you can fix this problem in your existing installation as follows:

  1. Save the following script as fix-mpi.sh:


mkdir /tmp/fix_mpi
cd /tmp/fix_mpi

for i in mpicc mpicxx mpif77 mpif90 mpifort ;

cp $MPI_DIR/bin/$i .
sed -e 's#\/proj\/ta\/libraries\/mpich-3.1.3\/osx86-64\/pgi\/15.1\/Darwin-10.8.0-i386-64bit#\/opt\/pgi\/osx86-64\/2015\/mpi\/mpich#g' $i > $i.fixed
cp $i.fixed $MPI_DIR/bin/$i


rm -rf /tmp/fix_mpi
  1. Run the script as follows:
$ sudo sh fix-mpi.sh

You will need to type in your password at the prompt when running the sudo command.

Hope this helps.

Best regards,


Thanks, this appears to fix the issue.

TPR 21383 - UF: MacOSX MPICH has hardcoded path to internal directory

has been fixed in the current 15.3 release.


I’m getting an error on 15.3 that may be related:

pgf90 -byteswapio -Mmpi=mpich -o ideal_make_grid -L/Users/muellermichel/lib/nusdas/lib -L/Users/muellermichel/lib/netcdf/lib -L/Users/muellermichel/typhoon/Repository/asuca/branches/hybrid/asuca-kij/build/cpu/Framework/…/HybridSources ideal_make_grid.o prepsub.o parameter_control.o restart_vars.o vertical.o checktool_vars.o sf_parameters.o -lasuca -lnusdas -lnwp -lnetcdf
ld: warning: directory not found for option ‘-L/opt/pgi/osx86-64/15.3/bin/…/mpi/mpich/lib’
ld: library not found for -lfmpich

Relevant in the .bashrc:

#PGI settings
export PGI=/opt/pgi
export PGROUPD_LICENSE_FILE=$PGI/license.dat
export PGI_ROOT=${PGI}/osx86-64/15.3
export PATH=${PGI_ROOT}/bin:$PATH
export MPICH_PATH=${PGI}/osx86-64/2015/mpi/mpich
export PATH=${MPICH_PATH}/bin:$PATH
export MANPATH

The path for the installed mpi (that comes with pgi) is under /opt/pgi/osx86-64/2015/mpi/mpich - as set in .bashrc. I’ve checked that LD_LIBRARY_PATH for mpich is correct. Note that pgf90 seems to search in the wrong directory. I’m setting softlinks now.


I have logged this issue as TPR#21469.

In the interim, you can potentially work around this issue in a simpler way by setting the $MPIDIR environment variable to the location where the PGI-provided MPICH is installed, when invoking -Mmpi=mpich.

For example:

export MPIDIR=/opt/pgi/osx86-64/2015/mpi/mpich

The driver will use the value of $MPIDIR when passing -Mmpi=mpich, if $MPIDIR is set.

Hope this helps.

Best regards,


TPR 21469 - UF: -Mmpi=mpich has bad path to libraries in OS X

is a problem reported in the Forum, and has been fixed in the current
15.4 release.

Thanks for the report.