M1上面一堆brew不能裝的東西, nng也會遇到問題.
要裝到機器上可以照nng上面的方法:
$ mkdir build
$ cd build
$ cmake -G Ninja ..
$ ninja
$ ninja test
$ ninja install
這邊到了ninja install
會出錯, 因為非Apple Silicon的會裝到/usr/local
, 但是Apple Silicon / M1就要裝到 /opt/homebrew
下面.
所以請把build
目錄下的cmake_install.cmake
改成
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/opt/homebrew")
endif()
然後跑ninja install
就可以搞定
Now nng installation is not working on brew or manually install.
The error message as following when doing manually installation:
[0/1] Install the project...
-- Install configuration: ""
CMake Error at src/cmake_install.cmake:41 (file):
file cannot create directory: /usr/local/lib. Maybe need administrative
privileges.
Call Stack (most recent call first):
cmake_install.cmake:42 (include)
FAILED: CMakeFiles/install.util
cd /xxx/nng/build && /opt/homebrew/Cellar/cmake/3.19.4/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
But here is a way to fix the manual installation.
Change CMAKE_INSTALL_PREFIX
in cmake_install.cmake
of build
folder from /usr/local
to be /opt/homebrew
, then run ninja install
.
Hope this help
Comments
comments powered by Disqus