[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

static cross-compiling


Hello!

I would like to write a program that I can cross-compile for Android
and OpenWRT devices, that uses libssh to first talk to ssh servers and
in a later development-stage to each other.

Sadly, I'm not really too experienced in programming C / C++, so
please bear with me.

I found this tutorial
http://jensd.be/800/linux/cross-compiling-for-arm-with-ubuntu-16-04-lts
which with the additional install of the package "libc6-armel-cross"
enabled me to cross-compile a program that prints "hello world" in a
shell on my android device.

Next step: After installing the package "libssh-dev" I was able to use
sample code from
http://api.libssh.org/master/libssh_tutor_guided_tour.html
to compile a dynamically linked program that works on my Linux laptop.

Now the step I have been struggling with for the last few hours is to
compile this sample program that uses libssh in a static manner (and
once that is accomplished doing so using the "arm-linux-gnueabi-gcc"
cross-compiler)

So I tried:
$ gcc sshtest.c -static -lssh
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libssh.a(misc.c.o):
In function `ssh_path_expand_tilde':
(.text+0x87d): warning: Using 'getpwnam' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libssh.a(misc.c.o):
In function `ssh_get_user_home_dir':
(.text+0x3a): warning: Using 'getpwuid_r' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
...
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libssh.a(gssapi.c.o):
In function `ssh_packet_userauth_gssapi_token_client':
(.text+0x1b36): undefined reference to `gss_init_sec_context'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libssh.a(gssapi.c.o):
In function `ssh_packet_userauth_gssapi_token_client':
(.text+0x1c20): undefined reference to `gss_get_mic'
collect2: error: ld returned 1 exit status

Then I downloaded the libssh source package and made a static build of
the library using the ccmake gui to set the static parameter to true.
With this I tried:
$ gcc sshtest.c libssh-0.7.5/build/src/libssh.a -lssh
libssh-0.7.5/build/src/libssh.a(curve25519.c.o): In function
`ssh_curve25519_build_k':
curve25519.c:(.text+0x13a): undefined reference to `BN_new'
curve25519.c:(.text+0x1e9): undefined reference to `BN_bin2bn'
libssh-0.7.5/build/src/libssh.a(dh.c.o): In function `ssh_get_random':
...
libssh-0.7.5/build/src/libssh.a(bignum.c.o): In function `ssh_print_bignum':
bignum.c:(.text+0x175): undefined reference to `BN_bn2hex'
bignum.c:(.text+0x1dc): undefined reference to `CRYPTO_free'
collect2: error: ld returned 1 exit status


Now I'm out of ideas or in other words my googling skills are not
sufficient to find new ones ;)
Please help..
Kind regards,
Thomas K.

Follow-Ups:
Re: static cross-compilingThomas Käfer <kaefert@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org