onnx-mlir
onnx-mlir copied to clipboard
cmake build broken on Mac
The latest version of onnx-mlir
can no longer build cleanly on Mac using ninja
. This is the error:
CMake Error:
Running
'/usr/local/bin/ninja' '-C' '/Users/[email protected]/Source/onnx/onnx-mlir/build' '-t' 'recompact'
failed with:
ninja: error: build.ninja:3419: bad $-escape (literal $ must be written as $$)
I believe the error stems from the following line in zdnn.cmake
:
BUILD_COMMAND sh -c "MAKEFLAGS=--no-print-directory \
make -j$(nproc) -C zdnn lib/libzdnn.so && \
ar -rc ${ZDNN_LIBDIR}/libzdnn.a ${ZDNN_OBJDIR}/*.o"
@gongsu832 should -j$(nproc)
be -j${nproc}
?
nproc
is not a command on Mac. -j${nproc}
needs variable nproc
to be set. Not sure why you are trying to build zdnn on Mac. It's not meant to be built on anything other than zLinux and z/OS.
@gongsu832 I am aware that the ZDNN library isn't meant to be built on Mac and I wasn't intentionally attempting to build it. What I did was to pull the latest code, configure the project as I usually do (with NNPA support given I want to run the lit tests for the accelerator):
$CMAKE -GNinja -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=$C_COMPILER \
-DCMAKE_CXX_COMPILER=$CXX_COMPILER \
-DCMAKE_VERBOSE_MAKEFILE=true \
-DACCELERATORS_TO_BUILD="NNPA" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
cmake
failed with:
-- Accelerators : NNPAAccel
-- Parallel backend tests : ON
-- JNI backend tests : ON
-- JSONITER_JAR : /Users/[email protected]/Source/onnx/onnx-mlir/build/src/Runtime/jni/jsoniter/jsoniter-0.9.23.jar
-- Configuring done
-- Generating done
CMake Error:
Running
'/usr/local/bin/ninja' '-C' '/Users/[email protected]/Source/onnx/onnx-mlir/build' '-t' 'recompact'
failed with:
ninja: error: build.ninja:3419: bad $-escape (literal $ must be written as $$)
CMake Generate step failed. Build files cannot be regenerated correctly.
I built on Mac natively with cmake. For the new onnx, I need to specify where my python is:
cmake -DPYTHON_EXECUTABLE:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -DPYTHON_LIBRARIES=/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib ..
Not sure whether this is related to your issue.