[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#846266: solid: FTBFS on mipsel and m68k - src/solid/predicate_parser.c: No such file or directory



Source: solid
Version: 5.28.0-1
Severity: serious
Tags: patch

Hi,

So I've had a look at the mips FTBFS, and while I have not been able to
reproduce it there does seem to be a parallel build race going on with
the bison/flex parser generation.

In src/solid/CMakeLists.txt, the parser is generated using bison_target
which uses add_custom_command under the hood. The output file is then
added to the list of sources creating a file-level dependency from the
KF5Solid target to the bison/flex generation command. However, the list
of sources is later used as part of the KF5Solid_static target. Since
file-level dependencies cannot cross between targets, the bison
generation happens twice completely independently as part of the two
targets. If you are very unlucky, the generation in one target can
happen at the same time as the compilation of the parser in the other
target causing a collision.

The attached patch should fix that by putting the generation in a
separate target and manually adding a dependency on it. This forces the
parser to be generated before anything is compiled.

As a side node, there seems to be a bug in CMake 3.7.0 which causes
bison targets to be remade repeatedly, but it looks like it'll be fixed
in 3.7.1.

Thanks,
James
--- a/src/solid/CMakeLists.txt
+++ b/src/solid/CMakeLists.txt
@@ -9,6 +9,7 @@ endif()
 set(solid_LIB_SRCS ${solid_LIB_SRCS} ${solid_QM_LOADER})
 
 add_library(KF5Solid  ${solid_LIB_SRCS})
+add_dependencies(KF5Solid SolidParserTarget)
 target_include_directories(KF5Solid PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/..;${CMAKE_CURRENT_BINARY_DIR}/..>")
 generate_export_header(KF5Solid BASE_NAME Solid)
 add_library(KF5::Solid ALIAS KF5Solid)
@@ -87,6 +88,7 @@ install(TARGETS KF5Solid EXPORT KF5SolidTargets ${KF5_INSTALL_TARGETS_DEFAULT_AR
 ########### static lib for tests  ###############
 
 add_library(KF5Solid_static STATIC ${solid_LIB_SRCS})
+add_dependencies(KF5Solid_static SolidParserTarget)
 set_target_properties(KF5Solid_static PROPERTIES COMPILE_FLAGS -DSOLID_STATIC_DEFINE=1)
 
 target_link_libraries(KF5Solid_static PUBLIC Qt5::Core)
diff --git a/src/solid/devices/CMakeLists.txt b/src/solid/devices/CMakeLists.txt
index b841b54..a020825 100644
--- a/src/solid/devices/CMakeLists.txt
+++ b/src/solid/devices/CMakeLists.txt
@@ -90,6 +90,7 @@ flex_target(SolidLexer
 )
 add_flex_bison_dependency(SolidLexer SolidParser)
 list(APPEND solid_LIB_SRCS ${BISON_SolidParser_OUTPUTS} ${FLEX_SolidLexer_OUTPUTS})
+add_custom_target(SolidParserTarget DEPENDS ${BISON_SolidParser_OUTPUTS} ${FLEX_SolidLexer_OUTPUTS})
 
 include(devices/backends/fakehw/CMakeLists.txt)
 

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: