Skip to content

Commit b166f13

Browse files
committed
Fix failures while building runtime library
Flang builds occasionally fails with errors like: F90-F-0004-Corrupt or Old Module file ../../include/__norm2.mod (.../flang/runtime/flang/norm2.F95: 1270) Serialize the build of flang_shared and flang_static to eliminate conflicts with the same module files being created/recreated in the common directory ${CMAKE_Fortran_MODULE_DIRECTORY}. The build of each library is still parallelized.
1 parent 10d0e8e commit b166f13

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

runtime/flang/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,17 @@ add_flang_library(flang_shared
495495
${SHARED_SOURCES}
496496
)
497497
set_property(TARGET flang_shared PROPERTY OUTPUT_NAME flang)
498+
499+
#
500+
# Seralize the building of flang_shared and flang_static to eliminate
501+
# conflicts with the same module files from the shared and static builds
502+
# being created/recreated in the common directory
503+
# ${CMAKE_Fortran_MODULE_DIRECTORY}.
504+
#
505+
# Note: building of each library is still parallelized.
506+
#
507+
add_dependencies(flang_shared flang_static)
508+
498509
target_link_libraries(flang_shared ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/libflangrti.so)
499510
# Resolve symbols against libm and librt
500511
target_link_libraries(flang_shared m rt)

0 commit comments

Comments
 (0)