Last Updated: February 25, 2016
·
1.199K
· kjellski

Mac OSX 10.7.5. and libssh Error : Server specified invalid channel 43 44 45 ...

Ever had trouble in using libssh on Mac OSX 10.7.5.? And somehow it exits with the last error beeing like this: ** "Error : Server specified invalid channel 43" **

If you've installed a libssh for development with ports and used to have it arround in your deployed packages, be aware that this version is probably very old, or at least too old to contain the fix for libssh bug #39( https://red.libssh.org/issues/39 ). That bug is fixed in the latest version of libssh-0.4.8 in the series of 0.4

Unfortunately, this version is not usable on OSX 10.7.5. when not built with the correct pointer to environ; the problem is that in libssh-0.4.8/libssh/socket.c, this is not buildable:

extern char **environ;

and you have to replace that with this:

#ifdef __APPLE__
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#else
extern char **environ;
#endif

afterwards, build the thing and create your working libssh for 10.7.5.

$ mkdir libssh-0.4.8/build/
$ cd libssh-0.4.8/build/
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ..
$ make

The result is your working libssh:

libssh-0.4.8/build/libssh/libssh.4.1.4.dylib.

Use that library in your deployments and it at least works in 10.7.5. and 10.8.4 as far as I can say...

Thanks to Oleksandr Shneyder of the http://x2go.org and http://www.phoca-gmbh.com for finding this out! Also, if you need a real Linux Professional, hire him!

Have a good one,
@Kjellski