AyatanaIndicators / ayatana-indicator-messages

Ayatana Indicator Messages Applet
GNU General Public License v3.0
1 stars 6 forks source link

Compile error with multicore compile #29

Closed z3ntu closed 2 years ago

z3ntu commented 2 years ago
make[2]: *** No rule to make target 'src/indicator-messages-service.c', needed by 'tests/CMakeFiles/indicator-messages-service.dir/__/src/indicator-messages-service.c.o'.  Stop.

See build log https://gitlab.alpinelinux.org/z3ntu/aports/-/jobs/594755/raw or https://gitlab.alpinelinux.org/z3ntu/aports/-/jobs/594802/raw

Using -j1 for make seems to work around this well.

tari01 commented 2 years ago

@z3ntu

I cannot replicate this - I always do test builds with -j 4 using both clang and gcc. Can you please give me the exact command line you use for cmake .. and make? Thanks.

z3ntu commented 2 years ago

Here's the build script: https://gitlab.alpinelinux.org/alpine/aports/-/blob/7feec0019c7180eee572413171432418f358f740/testing/ayatana-indicator-messages/APKBUILD

I'm not really sure how many threads the build machine has though, but I assume more than 4.. Also didn't happen every time but often enough on the builders there to need the workaround.

tari01 commented 2 years ago

@z3ntu

I've run a loop of 1000 builds with your parameters using -j 8, bull no error on my end. I need a little help from you - could you please try to replace this block in tests/CMakeLists.txt:

set_source_files_properties(${HEADERS_GEN} ${SOURCES_GEN} PROPERTIES GENERATED TRUE)
set_source_files_properties(${HEADERS} ${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("indicator-messages-service" STATIC ${HEADERS} ${HEADERS_GEN} ${SOURCES} ${SOURCES_GEN})
target_include_directories("indicator-messages-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_compile_definitions("indicator-messages-service" PUBLIC G_LOG_DOMAIN="Ayatana-Indicator-Messages")
target_link_libraries("indicator-messages-service")

with:

set_source_files_properties(${HEADERS_GEN} ${SOURCES_GEN} PROPERTIES GENERATED TRUE)
set_source_files_properties(${HEADERS} ${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("indicator-messages-service" STATIC ${HEADERS} ${HEADERS_GEN} ${SOURCES} ${SOURCES_GEN})
target_include_directories("indicator-messages-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_compile_definitions("indicator-messages-service" PUBLIC G_LOG_DOMAIN="Ayatana-Indicator-Messages")
add_dependencies("indicator-messages-service" "ayatana-indicator-messages-service")

(the change is the last line).

Let's see if the explicit dependency gets you the indicator-messages-service test library built...

ghost commented 2 years ago

appears to now be functional with that change (https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/30509/diffs?commit_id=3110ce590b56eff1ed0fcd54120f5ae33b047e16)

z3ntu commented 2 years ago

Yep, wanted to comment that. Works now reliably where before it failed most of the time in Alpine CI (@psycholance do you know how many cores the x86/x86_64 CI machines have?)

ghost commented 2 years ago

CI is... either 48 or 64, forget which. similar for the actual builders

ghost commented 2 years ago

i can reproduce this consistently on one of the developer machines with 48 threads, and funnily, the problem is also fixed by using -G Ninja with cmake and using ninja/samurai as the build tool, without the above patch

z3ntu commented 2 years ago

Sounds like CMake is flawless /s

And thanks for trying :)