Ubuntu 16.04安装WRF时无执行文件且出现.F后缀文件如何解决?
Hey there, let’s work through this WRF build hiccup on Ubuntu 16.04. Seeing .F files left behind instead of the expected executables usually means the compilation chain broke partway through—here’s how to diagnose and fix it:
First, dig into the compilation logs
WRF generates detailed build logs (typically namedcompile.login your main WRF directory). Run this command to yank out critical error messages that’ll point to the root issue:grep -i "error\|failed" compile.logCommon triggers here are missing dependencies, incompatible compiler versions, or misconfigured environment variables.
Verify your compiler setup
Ubuntu 16.04 ships with GCC 5.x by default, but many WRF versions (especially older ones) play nicer with GCC 4.x or specific Fortran compilers like Intel Fortran. Check your current compiler versions first:gcc --version gfortran --versionIf you’re using a newer compiler that’s causing conflicts, install GCC 4.8 (a reliable compatible option for 16.04):
sudo apt-get install gcc-4.8 gfortran-4.8Then temporarily set them as your default compilers:
export CC=gcc-4.8 export CXX=g++-4.8 export FC=gfortran-4.8Check for missing dependencies
WRF relies on libraries like MPI, netCDF, and HDF5 to compile properly. Make sure you’ve installed all required packages for Ubuntu 16.04:sudo apt-get install libopenmpi-dev openmpi-bin libnetcdf-dev libhdf5-dev libpng-dev libjasper-devAlso, confirm your environment variables for these libraries are correctly set. For example:
export NETCDF=/usr export HDF5=/usr export PATH=$PATH:/usr/lib/openmpi/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/openmpi/lib:/usr/lib/x86_64-linux-gnuClean and recompile with proper configuration
Sometimes the initial config didn’t pick up your system’s settings correctly. Head back to your WRF directory, wipe the partial build, and reconfigure:cd ~/WRF ./clean -a ./configureWhen prompted, select the option matching your system (e.g., option 3 for Linux x86_64, gfortran, serial if you’re doing a test build). Then restart the compilation:
./compile em_real >& compile.log &Once it finishes, check the
maindirectory—you should see executables likewrf.exeandreal.exeinstead of leftover.Ffiles.Rule out permission issues
If you’re compiling in a directory where you don’t have full write access, the build might fail silently. Ensure you own the WRF directory and have proper permissions:sudo chown -R $USER:$USER ~/WRF
Pro tip: WRF’s compilation is super sensitive to environment settings. Double-check that all your compiler and library paths are exported correctly before starting the build—small typos here can derail the whole process.
内容的提问来源于stack exchange,提问作者CHOU

