Error in building libnetconf2
Hello,
I am working on installing libnetconf2 on a docker container to effectively install the new Netopeer2GUI. According to the install instructions, the devel branches have to be used in the time being.
However, whenever I try to install libnetconf2 (after installing libyang) I get the following error:
/libnetconf2/python/rpc.c:22:31: fatal error: libyang/swigpyrun.h: No such file or directory
#include <libyang/swigpyrun.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make[2]: *** [python/CMakeFiles/pyapi] Error 1
make[1]: *** [python/CMakeFiles/pyapi.dir/all] Error 2
make: *** [all] Error 2
I have attached the Dockerfile container for your reference (remove the '.txt' extension to run in linux).
You can just run the following command inside the folder with the Dockerfile:
docker pull ubuntu:trusty
docker build -t ubuntu:trusty .
Let me know if you need any further information from my end, or if you would want to raise the issue in libyang
Thank you,
Maged
Hi Maged,
I tried it briefly but reached a conclusion that this is not for us to solve, sorry. The problem is in libyang cmake output
-- Python version 3 was selected
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3")
-- Found PythonInterp: /usr/bin/python (found version "2.7.6")
CMake Warning at swig/CMakeLists.txt:31 (message):
Did not found Python version 3.x
-- Sysrepo supports Python 2.x and Python 3.x
This means that python bindings are automatically turned off, which is why the header is then missing when building libnetconf2.
I have tried the same commands on my virtual Ubuntu 16.04.3 and it worked just fine so my guess is that some paths are wrong in the Ubuntu docker image. Just a hint, my output was
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (found suitable version "3.5.2", minimum required is "3")
which a bit non-standard so that may be the problem. I am leaving you with this, it is not a libnetconf2/libyang issue. However, if you manage to fix it, please replay and close this issue, someone else can find it useful, thanks.
Regards, Michal
Hello, I am having the same error. I have no errors when installing libyang. And I couldn't fix it
libnetconf2/python/session.c:23:10: fatal error: libyang/swigpyrun.h: No such file or directory #include <libyang/swigpyrun.h> ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 CMakeFiles/pyapi.dir/build.make:57: recipe for target 'CMakeFiles/pyapi' failed make[2]: *** [CMakeFiles/pyapi] Error 1 CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/pyapi.dir/all' failed make[1]: *** [CMakeFiles/pyapi.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2
Hi,
did you enable libyang bindings compilation (-DGEN_LANGUAGE_BINDINGS=ON)? If so, then please provide the output of libyang # make install.
Regards, Michal
Hi michalvasko, When install libnetconfig2-devel, there is the same error in centos7.5.
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -g -I/usr/include/python3.6m -c /root/libnetconf2/build/rpms/BUILD/libnetconf2-devel/python/session.c -o /root/libnetconf2/build/rpms/BUILD/libnetconf2-devel/python/build/temp.linux-x86_64-3.6/root/libnetconf2/build/rpms/BUILD/libnetconf2-devel/python/session.o -Wall -I/root/libnetconf2/build/rpms/BUILD/libnetconf2-devel/python -DNC_ENABLED_SSH -DNC_ENABLED_TLS /root/libnetconf2/build/rpms/BUILD/libnetconf2-devel/python/session.c:23:31: fatal error: libyang/swigpyrun.h: No such file or directory #include <libyang/swigpyrun.h> ^ compilation terminated. error: command 'gcc' failed with exit status 1 make[6]: *** [python/CMakeFiles/pyapi] Error 1 make[5]: *** [python/CMakeFiles/pyapi.dir/all] Error 2 make[4]: *** [all] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.jkjGEj (%build)
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.jkjGEj (%build) Built target build-rpm
BY the way, the procedure of building libyang as follow, cd libyang/build cmake -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON - DGEN_PYTHON_BINDINGS=ON .. make build-rpm
Best regard.
Hi, what SWIG version have you used?
Regards, Michal
Hi, what SWIG version have you used?
Regards, Michal
The SWIG version I using below: [root@localhost ~]# swig -version SWIG Version 3.0.12 Compiled with g++ [x86_64-redhat-linux-gnu] Configured options: +pcre
Hi,
you need to install libyang with Python bindings (cmake -DGEN_LANGUAGE_BINDINGS=ON ..).
Regards, Michal
cmake -DGEN_LANGUAGE_BINDINGS=ON ..
Got it. Thanks.
But Why install libyang with CPP and Python(cmake -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON - DGEN_PYTHON_BINDINGS=ON ..) is failed。
Hi, sorry, I have missed the last bit you saying you have installed libyang with bindings. But I see you have then build an RPM from it, which probably did not include this bindings. If you have installed it properly, you would not get that error. So, if you need the bindings, install it on the target machine directly from source.
Regards, Michal