Skip to content

Commit e5cd3ca

Browse files
committed
[tools] Fix compiler test to work on macOS.
1 parent 53a32c7 commit e5cd3ca

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tools/build

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,22 @@ cmake --build . -- -j "${NCPU}"
128128
# TODO: cmake --install ...
129129

130130
# Verify that the compiler works.
131-
cat <<CPP > ${tempfile:=$(mktemp -t XXXXXX.cpp)}
131+
tempdir=$(mktemp -d)
132+
tempfile="${tempdir}/tmp.cpp"
133+
cat > ${tempfile} <<CPP
132134
#include <cstdio>
133135
int main() {
134136
printf("Hello, world\n");
135137
return 0;
136138
}
137139
CPP
138-
if ! ${BUILD_DIR}/bin/clang++ ${tempfile} -o temp ; then
140+
if ! ${BUILD_DIR}/bin/clang++ ${tempfile} -o ${tempdir}/tmp ; then
139141
echo -e "Failed to compile test program with OpenCilk compiler.\nThere might be a problem with your system configuration.\nOutput of '${BUILD_DIR}/bin/clang++ -v':"
140142
${BUILD_DIR}/bin/clang++ -v
141-
rm -rf ${tempfile} temp
143+
rm -rf ${tempdir}
142144
exit 1
143145
fi
144-
rm -rf ${tempfile} temp
146+
rm -rf ${tempdir}
145147

146148
case "${OS}" in
147149
# Darwin is a special case. The version is not embedded in the path.

0 commit comments

Comments
 (0)