Building the vendored Lua (lua-5.1.5/toluapp-simple) sometimes fails under make -j, but not always — same source, nothing changed in between, and it can pass or fail from one run to the next:
make[5]: *** No rule to make target `liblua51.a', needed by `libtoluapp51.dylib'. Stop.
Looks like it's this bit in toluapp-simple/CMakeLists.txt:
target_link_libraries(toluapp51 PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS})
target_link_libraries(toluapp51_shared PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS})
target_link_libraries(toluapp PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS})
These link liblua51.a by its raw path instead of the lua51_static target that actually builds it. There's an add_dependencies(...) a few lines down that orders the targets correctly, but since the link step points at a plain file path rather than a CMake target, Make doesn't always know to wait for that specific file before linking against it — so under -j it sometimes wins the race and sometimes doesn't.
Swapping the raw path for the target name fixes it for me:
- target_link_libraries(toluapp51 PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS})
- target_link_libraries(toluapp51_shared PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS})
- target_link_libraries(toluapp PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS})
+ target_link_libraries(toluapp51 PUBLIC lua51_static ${CMAKE_DL_LIBS})
+ target_link_libraries(toluapp51_shared PUBLIC lua51_static ${CMAKE_DL_LIBS})
+ target_link_libraries(toluapp PUBLIC lua51_static ${CMAKE_DL_LIBS})
Hit this on macOS arm64 (CMake 3.31+, make -j3), but I don't think it's macOS-specific — seems like it'd depend on job scheduling on any platform using the Makefiles generator.
(Found while working on a from-source CI build; drafted with AI assistance.)
Building the vendored Lua (
lua-5.1.5/toluapp-simple) sometimes fails undermake -j, but not always — same source, nothing changed in between, and it can pass or fail from one run to the next:Looks like it's this bit in
toluapp-simple/CMakeLists.txt:These link
liblua51.aby its raw path instead of thelua51_statictarget that actually builds it. There's anadd_dependencies(...)a few lines down that orders the targets correctly, but since the link step points at a plain file path rather than a CMake target, Make doesn't always know to wait for that specific file before linking against it — so under-jit sometimes wins the race and sometimes doesn't.Swapping the raw path for the target name fixes it for me:
Hit this on macOS arm64 (CMake 3.31+,
make -j3), but I don't think it's macOS-specific — seems like it'd depend on job scheduling on any platform using the Makefiles generator.(Found while working on a from-source CI build; drafted with AI assistance.)