Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed source Fortran C project fails to build with 0.57 #8377

Closed
awvwgk opened this issue Feb 17, 2021 · 3 comments
Closed

Mixed source Fortran C project fails to build with 0.57 #8377

awvwgk opened this issue Feb 17, 2021 · 3 comments

Comments

@awvwgk
Copy link
Contributor

awvwgk commented Feb 17, 2021

Describe the bug

Meson 0.57 fails to build mixed source Fortran/C projects.

To Reproduce

Minimal project producing the error: mwe.tar.gz

> meson setup _build
The Meson build system
Version: 0.57.0
Source dir: /home/awvwgk/projects/src/git/bugs/meson-0.57
Build dir: /home/awvwgk/projects/src/git/bugs/meson-0.57/_build
Build type: native build
Project name: mwe
Project version: undefined
Fortran compiler for the host machine: gfortran (gcc 10.2.0 "GNU Fortran (GCC) 10.2.0")
Fortran linker for the host machine: gfortran ld.bfd 2.36
C compiler for the host machine: cc (gcc 10.2.0 "cc (GCC) 10.2.0")
C linker for the host machine: cc ld.bfd 2.36
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 1

Found ninja-1.10.2 at /home/awvwgk/miniforge3/envs/mesonbuild/bin/ninja
> ninja -C _build
ninja: Entering directory `_build'
[1/4] Module scanner.
ninja: build stopped: 'mwe.p/file.c.o' not mentioned in its dyndep file 'mwe.p/depscan.dd'.

Meson log file: meson-log.txt

Let me know if you need any additional information.

Expected behavior

Correctly build mixed Fortran/C project.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    native build
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
> conda info
conda info

     active environment : mesonbuild
    active env location : /home/awvwgk/miniforge3/envs/mesonbuild
            shell level : 2
       user config file : /home/awvwgk/.condarc
 populated config files : /home/awvwgk/miniforge3/.condarc
          conda version : 4.9.2
    conda-build version : not installed
         python version : 3.7.8.final.0
       virtual packages : __glibc=2.33=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/awvwgk/miniforge3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /home/awvwgk/miniforge3/pkgs
                          /home/awvwgk/.conda/pkgs
       envs directories : /home/awvwgk/miniforge3/envs
                          /home/awvwgk/.conda/envs
               platform : linux-64
             user-agent : conda/4.9.2 requests/2.24.0 CPython/3.7.8 Linux/5.9.16-1-MANJARO manjaro/20.2.1 glibc/2.33
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
> uname -a
Linux saw8203 5.9.16-1-MANJARO #1 SMP PREEMPT Mon Dec 21 22:00:46 UTC 2020 x86_64 GNU/Linux
  • what Python version are you using e.g. 3.8.0
  • what meson --version
  • what ninja --version if it's a Ninja build
> conda list
# packages in environment at /home/awvwgk/miniforge3/envs/mesonbuild:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
ca-certificates           2020.12.5            ha878542_0    conda-forge
certifi                   2020.12.5        py37h89c1867_1    conda-forge
ld_impl_linux-64          2.35.1               hea4e1c9_2    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h2828fa1_18    conda-forge
libgomp                   9.3.0               h2828fa1_18    conda-forge
libstdcxx-ng              9.3.0               h6de172a_18    conda-forge
meson                     0.57.0             pyhd8ed1ab_0    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
ninja                     1.10.2               h4bd325d_0    conda-forge
openssl                   1.1.1j               h7f98852_0    conda-forge
pip                       21.0.1             pyhd8ed1ab_0    conda-forge
python                    3.7.8           h6f2ec95_0_cpython    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
readline                  8.0                  he28a2e2_2    conda-forge
setuptools                49.6.0           py37h89c1867_3    conda-forge
sqlite                    3.34.0               h74cdb3f_0    conda-forge
tk                        8.6.10               hed695b0_1    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h516909a_1010    conda-forge
> python --version
Python 3.7.8
> meson --version
0.57.0
> ninja --version
1.10.2
@awvwgk awvwgk changed the title Mixed source Fortran C project fails in dependency scanning Mixed source Fortran C project fails to build with 0.57 Feb 17, 2021
@dcbaker dcbaker added this to the 0.57.1 milestone Feb 17, 2021
@jpakkane
Copy link
Member

Can you test if the linked MR fixes it for you? Thanks.

@awvwgk
Copy link
Contributor Author

awvwgk commented Feb 19, 2021

Thanks, fixes the example above. I'm still seeing a failure in the original project (module dependencies are built in wrong order), but this might be unrelated. I'll try to isolate it and report back.

@awvwgk
Copy link
Contributor Author

awvwgk commented Feb 19, 2021

I get with e2dabe1 into situation where source code is compiled before the dependency scan is done. Trying to build https://github.com/grimme-lab/xtb with the build files generated by the fixed version I get the following compilation order:

> ninja -C _build_fix -n -j 1 | cat
ninja: Entering directory `_build_fix'
[1/332] Compiling Fortran object lib_xtb.a.p/src_disp_dftd4.F90.o
[2/332] Compiling Fortran object lib_xtb.a.p/src_main_property.F90.o
[3/332] Compiling Fortran object lib_xtb.a.p/src_mctc_blas_level1.F90.o
[4/332] Compiling Fortran object lib_xtb.a.p/src_mctc_blas_level2.F90.o
[5/332] Compiling Fortran object lib_xtb.a.p/src_mctc_blas_level3.F90.o
[6/332] Compiling Fortran object lib_xtb.a.p/src_mctc_lapack_eigensolve.F90.o
[7/332] Compiling Fortran object lib_xtb.a.p/src_mctc_systools.F90.o
[8/332] Compiling Fortran object lib_xtb.a.p/src_mctc_mctc_global.F90.o
[9/332] Compiling Fortran object lib_xtb.a.p/src_mctc_mctc_init.F90.o
[10/332] Compiling C object lib_xtb.a.p/src_mctc_signal.c.o
[11/332] Compiling Fortran object lib_xtb.a.p/src_type_reader.F90.o
[12/332] Compiling Fortran object lib_xtb.a.p/src_solv_input.F90.o
[13/332] Compiling Fortran object lib_xtb.a.p/src_xtb_repulsion.F90.o
[14/332] Compiling Fortran object lib_xtb.a.p/src_filetools.F90.o
[15/332] Compiling Fortran object lib_xtb.a.p/src_hessian.F90.o
[16/332] Compiling Fortran object lib_xtb.a.p/src_scf_module.F90.o
[17/332] Compiling C object lib_xtb.a.p/symmetry_symmetry_i.c.o
[18/332] Module scanner.

All Fortran objects seem to be compiled without any knowledge of module dependencies before step 18 and will therefore fail in a normal build. I'll try to create a reduced example to reproduce this behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants