Skip to content

Commit 968a13c

Browse files
committed
Fix linux build failure affecting tcl/tk, make jobserver related.
Build was failing during Tcl install phase, which was a plain "make install" and resulting in an error: make[3]: *** read jobs pipe: Bad file descriptor. Stop. make[3]: *** Waiting for unfinished jobs.... This error is related to the make jobserver feature, pointing at a likely cmake bug in the generated make logic, or a bug in make itself, or an OS named pipe bug. Bug encountered on VMs as well as OpenSuse Linux (which may or may not have been a VM). Unexpected workaround was to actually add the -j flag to the make calls which disables jobserver mode on recursive make invocations. Took that opportunity to enforce -j1 on install calls to avoid any possibility of output race ordering on what should be an I/O-bound build stage.
1 parent 06ee31f commit 968a13c

File tree

6 files changed

+25
-28
lines changed

6 files changed

+25
-28
lines changed

flexbison/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if (NOT WIN32)
5858
CONFIGURE_COMMAND ${FLEX_SRC_DIR}/autogen.sh
5959
COMMAND ${FLEX_SRC_DIR}/configure --prefix=${CMAKE_NOBUNDLE_INSTALL_PREFIX}
6060
BUILD_COMMAND make -j${pcnt}
61-
INSTALL_COMMAND make install
61+
INSTALL_COMMAND make -j1 install
6262
DEPENDS ${ZLIB_TARGET}
6363
LOG_CONFIGURE ${EXT_BUILD_QUIET}
6464
LOG_BUILD ${EXT_BUILD_QUIET}
@@ -88,7 +88,7 @@ if (NOT WIN32)
8888
COMMAND ${BISON_SRC_DIR}/autogen.sh
8989
COMMAND ${BISON_SRC_DIR}/configure --prefix=${CMAKE_NOBUNDLE_INSTALL_PREFIX}
9090
BUILD_COMMAND make -j${pcnt}
91-
INSTALL_COMMAND make install
91+
INSTALL_COMMAND make -j1 install
9292
DEPENDS ${ZLIB_TARGET}
9393
LOG_CONFIGURE ${EXT_BUILD_QUIET}
9494
LOG_BUILD ${EXT_BUILD_QUIET}

icu/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (NOT WIN32 AND NOT APPLE)
1616
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
1717
CONFIGURE_COMMAND <SOURCE_DIR>/<SOURCE_SUBDIR>/configure --disable-extras --disable-tools --disable-tests --disable-samples --prefix=${CMAKE_BUNDLE_INSTALL_PREFIX}
1818
BUILD_COMMAND make -j${pcnt}
19-
INSTALL_COMMAND make install
19+
INSTALL_COMMAND make -j1 install
2020
LOG_CONFIGURE ${EXT_BUILD_QUIET}
2121
LOG_BUILD ${EXT_BUILD_QUIET}
2222
LOG_INSTALL ${EXT_BUILD_QUIET}

ncurses/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (NOT WIN32)
3434
#CONFIGURE_COMMAND ${NCURSES_SRC_DIR}/autogen.sh
3535
CONFIGURE_COMMAND ${NCURSES_SRC_DIR}/configure --with-shared --enable-rpath --prefix=${CMAKE_BUNDLE_INSTALL_PREFIX}
3636
BUILD_COMMAND make -j${pcnt}
37-
INSTALL_COMMAND make install
37+
INSTALL_COMMAND make -j1 install
3838
DEPENDS ${ZLIB_TARGET}
3939
LOG_CONFIGURE ${EXT_BUILD_QUIET}
4040
LOG_BUILD ${EXT_BUILD_QUIET}

tcl/CMakeLists.txt

+10-3
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ if (ENABLE_TCL)
7171
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/tcl_disable_docs.patch
7272
COMMAND ${ZLIB_PATCH_CMD}
7373
CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/tcl_configure.cmake
74-
BUILD_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/tcl_build.cmake
75-
INSTALL_COMMAND make install
74+
75+
# NOTE: Forcing -j on all sub-make calls to work around cmake+make
76+
# jobserver mode bug. Tcl also seems to have a race fixed via genstubs.
77+
78+
BUILD_COMMAND make -j${pcnt}
79+
INSTALL_COMMAND make -j1 genstubs install
7680
${RPATH_CMD}
7781
LOG_CONFIGURE ${EXT_BUILD_QUIET}
7882
LOG_BUILD ${EXT_BUILD_QUIET}
@@ -85,7 +89,10 @@ if (ENABLE_TCL)
8589

8690
else (NOT MSVC)
8791

88-
# TODO - how to pass Z_PREFIX through nmake so zlib.h has the correct prefix? Is https://stackoverflow.com/a/11041834 what we need? Also, do we need to patch makefile.vc to reference our zlib dll?
92+
# TODO - how to pass Z_PREFIX through nmake so zlib.h has the correct
93+
# prefix? Is https://stackoverflow.com/a/11041834 what we need? Also, do
94+
# we need to patch makefile.vc to reference our zlib dll?
95+
8996
ExternalProject_Add(TCL_BLD
9097
URL "${CMAKE_CURRENT_SOURCE_DIR}/tcl"
9198
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}

tcl/tcl_build.cmake.in

+10-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
if (WIN32)
2-
execute_process(
3-
COMMAND "@VCVARS_BAT@"
4-
)
5-
execute_process(
6-
COMMAND nmake -f makefile.vc INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=
7-
RESULT_VARIABLE TCL_RET
8-
WORKING_DIRECTORY "@TCL_SRC_DIR@/win"
9-
OUTPUT_VARIABLE MSG
10-
ERROR_VARIABLE MSG
11-
)
12-
else (WIN32)
13-
execute_process(
14-
COMMAND make
15-
RESULT_VARIABLE TCL_RET
16-
WORKING_DIRECTORY "@TCL_BIN_DIR@"
17-
OUTPUT_VARIABLE MSG
18-
ERROR_VARIABLE MSG
19-
)
20-
endif (WIN32)
1+
execute_process(
2+
COMMAND "@VCVARS_BAT@"
3+
)
4+
execute_process(
5+
COMMAND nmake -f makefile.vc INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=
6+
RESULT_VARIABLE TCL_RET
7+
WORKING_DIRECTORY "@TCL_SRC_DIR@/win"
8+
OUTPUT_VARIABLE MSG
9+
ERROR_VARIABLE MSG
10+
)
2111

2212
if (TCL_RET)
2313
message(FATAL_ERROR "Tcl build failed: ${MSG}\n")

tk/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (TK_DO_BUILD)
4949
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/tk_disable_docs.patch
5050
CONFIGURE_COMMAND LD_LIBRARY_PATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR} CPPFLAGS=-I${CMAKE_BUNDLE_INSTALL_PREFIX}/${INCLUDE_DIR} LDFLAGS=-L${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR} TK_SHLIB_LD_EXTRAS=-L${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR} ${TK_SRC_DIR}/unix/configure --prefix=${CMAKE_BUNDLE_INSTALL_PREFIX} --with-tcl=$<IF:$<BOOL:${TCL_TARGET}>,${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR},${TCLCONF_DIR}>
5151
BUILD_COMMAND make -j${pcnt}
52-
INSTALL_COMMAND make install
52+
INSTALL_COMMAND make -j1 install
5353
# Note - LOG_CONFIGURE doesn't seem to be compatible with complex CONFIGURE_COMMAND setups
5454
LOG_BUILD ${EXT_BUILD_QUIET}
5555
LOG_INSTALL ${EXT_BUILD_QUIET}

0 commit comments

Comments
 (0)