Compiling OpenSSL and libssh2 with emscripten – notes

Make sure emscripten is setup and on the path. First, get openssl and libssh2 configured:

export CC=emcc
wget https://www.openssl.org/source/openssl-1.0.1j.tar.gz
tar xvzf openssl-1.0.1j.tar.gz
cd openssl-1.0.1j
./Configure -no-asm -no-apps android
make
git clone git://git.libssh2.org/libssh2.git 
cd libssh2
export CFLAGS="-I/home/new/gitcode/jterm/openssl-1.0.1j/include"
./configure --with-libssl-prefix=home/new/gitcode/jterm/openssl-1.0.1j
make

Compile some code!

cd examples
emcc ssh2.c -I../include -I../../openssl-1.0.1j/include -lssh2 -lssl -lcrypto  -L../../openssl-1.0.1j -L../src/.libs -static

Which results in a.out.js, but who knows if it does anything useful! I assume not! But it does run:

me@laptop:~/gitcode/jterm/libssh2/example$ nodejs ./a.out.js 127.0.0.1 user password
failed to connect!

Comments are closed.