Problem Description
demo guide: https://github.com/EdVince/Stable-Diffusion-NCNN When using compiled files
on the Linux side ,cmake
cd x86/linux
mkdir -p build && cd build
cmake ..
make -j$(nproc)
Execute cmake ..
the command and report an error:
CMake Error at CMakeLists.txt:14 (FIND_PACKAGE):
By not providing "Findncnn.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ncnn", but
CMake did not find one.
Could not find a package configuration file provided by "ncnn" with any of
the following names:
ncnnConfig.cmake
ncnn-config.cmake
Add the installation prefix of "ncnn" to CMAKE_PREFIX_PATH or set
"ncnn_DIR" to a directory containing one of the above files. If "ncnn"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/home/gaoyi/ldm-ncnn/Stable-Diffusion-NCNN/x86/linux/CMakeFiles/CMakeOutput.log".
problem causes
The pulled ncnn
code library (including submodule) is not there build and Install
, so cmake
the corresponding package cannot be found sometimes, just let it find the corresponding package, which is divided into 2 steps:
- Generate the corresponding cmake file (
ncnnConfig.cmake
,ncnn-config.cmake
) - Set the environment variable (
CMAKE_PREFIX_PATH
orncnn_DIR
)
Solution
build and Install
ncnn
The following commands need to be executed:
cd ncnn
mkdir -p build
cd build
cmake ..
cmake
Then continue in the build directory and execute:
make install
It is found that the pop-up information includes:
This ncnnConfig.cmake、ncnn.cmake
is the package we need to find, find the upper level directory, right click to copy the path
- set environment variables
export ncnn_DIR=/home/gaoyi/ldm-ncnn/Stable-Diffusion-NCNN/ncnn/build/install/lib/cmake/ncnn
This environment variable is the path copied in the previous step
- rerun
cmake
cmake ..
See:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gaoyi/ldm-ncnn/Stable-Diffusion-NCNN/x86/linux
success!