cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3648
Views
47
Helpful
6
Replies

Python VM not starting from Darwin NCS install on M1 Macbook

The NSO Darwin install of NSO for my M1 Macbook works fine for ncs and java, however the python vm fails to load. Looking in the ncs-python-vm.log, it states that the mach-o file is of type x86_64.

 

ImportError: dlopen(/Users/sam/Documents/ncs/install-5.5.2.12/src/ncs/pyapi/_ncs/_ncs_py3.abi3.so, 0x0002): tried: '/Users/sam/Documents/ncs/install-5.3.5.1/src/ncs/pyapi/_ncs/_ncs_py3.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

 

I tried going into the src/ncs/pyapi/ directory to try to remake the files, however the make of the pyapi fails with the following error.

 

~/Documents/ncs/install-5.5.2.12/src/ncs/pyapi
❯ make confd-py3
make: *** No rule to make target `_confd/_confd.c', needed by `_confd/_confd_py3.abi3.so'.  Stop.

~/Documents/ncs/install-5.5.2.12/src/ncs/pyapi
❯ make ncs-py3
make: *** No rule to make target `../ncs/dm/tailf-ncs.yang', needed by `tmp_fxs/tailf-ncs.fxs'.  Stop.

Which I'm guessing is because I don't have a local install of the ConfD library. 

Requirements
============

The build requires gcc and GNU make and the development libraries
for Python 3.5 or greater.

It's also necessary to have access to a built libconfd library.

When I go to the tailf site, ConfD basic installs are no longer available (currently).

https://developer.cisco.com/site/confD/downloads/

 

 

1 Accepted Solution

Accepted Solutions

Update: NSO for Darwin ARM64 is supported for NSO 6.1.1 and later releases, recommended for Apple Silicon M1, M2, etc.

When using the NSO for Darwin x86_64 version, make sure you use the Python version that comes with MacOS on M1. That works. No recompiling is necessary. I.e. use the following settings:

 

 

$ arch -x86_64 bash -l
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
$ arch
i386
$ which python3
/usr/bin/python3
$ python3 --version
Python 3.9.6
$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

 

 

 

View solution in original post

6 Replies 6

Alex Stevenson
Cisco Employee
Cisco Employee

Hi samuel.coome@secunetics.com,

 

Yes, the download page has downloads temporarily disabled. Did you email confdbasicinfo@cisco.com and ask for help? I looked around the Cisco mailing lists and that is the best place to ask directly.

 

Best,

       Alex S.

EugenSerban
Level 1
Level 1

Hello,

I'm having the same issue:

From logs/ncs-python-vm.log I can see:

<INFO> 2-Nov-2022::14:07:03.970 MAC ncs[30773]: l2vpn :: Starting python3 -u /Users/user/nso-5.8/src/ncs/pyapi/ncs_pyvm/startup.py -l info -f ./logs/ncs-python-vm -i l2vpn
Traceback (most recent call last):
 File "/Users/user/nso-5.8/src/ncs/pyapi/ncs_pyvm/startup.py", line 6, in <module>
 import ncsctlsock
 File "/Users/user/nso-5.8/src/ncs/pyapi/ncs_pyvm/ncsctlsock.py", line 5, in <module>
 import _ncs
 File "/Users/user/nso-5.8/src/ncs/pyapi/_ncs/__init__.py", line 12, in <module>
 from ._ncs_py3 import cdb

I installed confd and compiled it. I then tried to compile ncs, but I get this error:

❰user❙~/n/s/n/pyapi❱✘≻ make ncs-py3
PROD=NCS /Library/Developer/CommandLineTools/usr/bin/make src/gen_add_lib_const.c
# Clean all Python 3 so files, including possible leftovers. Possibly built
# with a previous Python 3 version, which might make them differ in naming.
Building NCS Python 3.x bindings
running build_ext
building '_ncs._ncs_py3' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DCONFD_PY_PRODUCT_NCS=1 -DCONFD_C_PRODUCT_NCS=1 -D_TM=\"_ncs\" -UNDEBUG -I/Users/user/confd/include -Iinclude -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c _ncs/_ncs.c -o build/_ncs/_ncs_py3.abi3.so/_ncs/_ncs.o -std=c99
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DCONFD_PY_PRODUCT_NCS=1 -DCONFD_C_PRODUCT_NCS=1 -D_TM=\"_ncs\" -UNDEBUG -I/Users/user/confd/include -Iinclude -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_cdb.c -o build/_ncs/_ncs_py3.abi3.so/src/_cdb.o -std=c99
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DCONFD_PY_PRODUCT_NCS=1 -DCONFD_C_PRODUCT_NCS=1 -D_TM=\"_ncs\" -UNDEBUG -I/Users/user/confd/include -Iinclude -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_dp.c -o build/_ncs/_ncs_py3.abi3.so/src/_dp.o -std=c99
src/_dp.c:6200:26: error: use of undeclared identifier 'CONFD_ERRTYPE_NCS'
if (errinfo->type == CONFD_ERRTYPE_NCS) {
 ^
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
make: *** [_ncs/_ncs_py3.abi3.so] Error 1
❰user❙~/n/s/n/pyapi❱✘≻

Is this a known issue?

Update: NSO for Darwin ARM64 is supported for NSO 6.1.1 and later releases, recommended for Apple Silicon M1, M2, etc.

When using the NSO for Darwin x86_64 version, make sure you use the Python version that comes with MacOS on M1. That works. No recompiling is necessary. I.e. use the following settings:

 

 

$ arch -x86_64 bash -l
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
$ arch
i386
$ which python3
/usr/bin/python3
$ python3 --version
Python 3.9.6
$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

 

 

 

That did the trick! Thanks!

Can you maybe update the documentation to cover this? It would help other avoid the traditional google-fu.

cohult
Cisco Employee
Cisco Employee

Agree those steps could be added to the installation guide. Generic M1 Mac Rosetta 2 dependant commands however that may be different tomorrow. And the need for them will be obsoleted when NSO for Darwin ARM64 is supported (not only x86_64) in the not-so-distant future.

cohult
Cisco Employee
Cisco Employee

Update: NSO for Darwin ARM64 is supported for NSO 6.1.1 and later releases, recommended for Apple Silicon M1, M2, etc.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: