You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04安装WRF时无执行文件且出现.F后缀文件如何解决?

Troubleshooting WRF Compilation: .F Files Instead of Executables (Ubuntu 16.04)

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 named compile.log in 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.log
    

    Common 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 --version
    

    If 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.8
    

    Then temporarily set them as your default compilers:

    export CC=gcc-4.8
    export CXX=g++-4.8
    export FC=gfortran-4.8
    
  • Check 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-dev
    

    Also, 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-gnu
    
  • Clean 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
    ./configure
    

    When 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 main directory—you should see executables like wrf.exe and real.exe instead of leftover .F files.

  • 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:44:08