Closed SummerSeaSun closed 4 years ago
Even with admin
user I still get:
ros_connect failed: Permission denied
@Summer88 You are compiling it wrong. Take a look how I am doing it under debian:
git clone https://github.com/octo/librouteros.git
cd librouteros
autoreconf -ivf
./configure
make -j4
The permission denied error you have indicating a problem on the mikrotik or its configuration I suppose...
Thank for your reply I've tried to reinstall with:
git clone https://github.com/octo/librouteros.git
cd librouteros
root@gigi:/home/pi/librouteros# autoreconf -ivf
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
configure.ac:36: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:37: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
However with this python library I can connect so the router is configured correctly. https://github.com/socialwifi/RouterOS-api
There's only a difference from python script to C, theres a plain_login option?
What version of libtool you have installed?
I don't know the difference - never used a python script. If you compile librouteros there is a test tool which you can use for connecting to mikrotiks. You sure you are passing proper credentials and you have enabled the api in the routeros? Also make sure that you are not using SSL which is currently not enabled in the library....
Actually libtool wasn't installed at all.
libtool/stable,now 2.4.6-9 all [installed]
Generic library support script
Now autoreconf -ivf
and install succeded.
Recompiled the script but output is the same.
I've checked on the router API port 8728 is open. Thank you
Hmmm ... no idea what is wrong in your case. I was testing it and it is working for me without any problem (I am constantly using the library for collecting statistics into collectd). Maybe they changed something in the newer RouterOS versions? No idea :(
@cirolandolfi found the issue
Please take a look at you should update your code to work with latest RouterOS.
@Summer88 This was done two years ago! :) https://github.com/octo/librouteros/commit/348e107aa5023c520604a0f67c68ce53794eb606
Well looking at Release page "Latest release" appear to be 1.1.2 and that was the starting point of the issue.
Readme is missing the steps needed to install, this is what I've done:
result in errors:
Instead this way for install success, but there are missing "*.h" at runtime:
1 ) ---- download librouteros-1.1.2.tar.bz2 from https://github.com/octo/librouteros/releases/download/librouteros-1.1.2/librouteros-1.1.2.tar.bz2 to a file /home/pi/librouteros-1.1.2.tar.bz2 ( home page: https://octo.github.io/librouteros/ examples: https://wiki.mikrotik.com/wiki/Librouteros ) 2 ) ---- extract from /home/pi/librouteros-1.1.2.tar.bz2 to /home/pi/librouteros-1.1.2 3 ) ---- cd /home/pi/librouteros-1.1.2 4 ) ---- apt install libgcrypt-dev 5 ) ---- modify the file: /home/pi/librouteros-1.1.2/src/ros.c ( example file ) --- comment out line 296: const char *host; --- comment out line 320: host = argv[optind];
5 ) ---- ./configure 6 ) ---- make 7 ) ---- make install 8 ) ---- create a symlink /usr/share/man/man1/ros.1 to /opt/librouteros/share/man/man1/ros.1 9 ) ---- create a symlink /usr/share/man/man3/librouteros.3 to /opt/librouteros/share/man/man3/librouteros.3 10 ) ---- create a symlink /usr/lib/librouteros.so.0 to /opt/librouteros/lib/librouteros.so.0
To build and run the test program: 1 ) ---- cd /home/pi/ 2 ) ---- make wifirssitest 3 ) ---- ./wifirssitest
The test program would output:
Getting down in step by step: