Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,101
    • Issues 4,101
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #17599
Closed
Open
Issue created Dec 29, 2017 by Ghost User@ghostContributor

Ninja generator dependency cycle with Fortran [OBJECT_OUTPUTS/OBJECT_DEPENDS]

I am attempting to bootstrap flang using the Ninja generator. It works except for one issue that I haven't been able to find a solution for. When compiling a particular object file, flang produces a byproduct which is needed for compiling other object files. For the makefile generator, this is expressed as such:

# State the module that the source is producing
set_source_files_properties(
  iso_c_bind.F95
  PROPERTIES
  OBJECT_OUTPUTS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
  )

# State a dependency on the module
set_source_files_properties(
  ieee_arithmetic.F95
  ieee_exceptions.F95
  PROPERTIES
  OBJECT_DEPENDS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
  )

The problem is that this is a direct cause of the following error:

ninja: error: dependency cycle: runtime/flang/CMakeFiles/flang_static.dir/Fortran.dd -> runtime/flang/CMakeFiles/flang_static.dir/ieee_arithmetic.F95-pp.f95.ddi -> runtime/flang/iso_c_binding.mod -> runtime/flang/CMakeFiles/flang_static.dir/iso_c_bind.F95.obj -> runtime/flang/CMakeFiles/flang_static.dir/Fortran.dd

The only way that I have found around this that doesn't cause race conditions is to link a library that contains that one file and make it a dependency of other libraries including those sources. It probably extends the build time by a few seconds, so it is not the end of the world, but I think this is probably a bug in the ninja generator.

Edited Dec 31, 2017 by Ghost User
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking