janmojzis / tinyssh

TinySSH is small server (less than 100000 words of code)
Creative Commons Zero v1.0 Universal
1.43k stars 78 forks source link

aarch64 build #57

Closed MisteryX closed 2 years ago

MisteryX commented 3 years ago

Hi guys. I'm trying to build tinyssh from source (apt source tinysshd) in Ubuntu 20.04.2 (amd64) using crosscompiler CC=aarch64-linux-gnu-gcc make for ARMv8

before make I did sudo apt-get build-dep tinyssh, but It did not help much.

Build fails on libtinynacl.a failed ... see the log /home/user/tinyssh-20190101/build/log First it wanted libutil.h, so I installed sudo apt install libutil-freebsd-dev But it wants a lot of other includes...

Are there any build images? How could I find nessesary libs and headers for build?

In file included from haslibutilh.h-yes.c:2: /usr/include/libutil.h:43:10: fatal error: sys/_types.h: No such file or directory 43 | #include <sys/_types.h> | ^~~~~~ compilation terminated. hasutilh.h-yes.c:2:10: fatal error: util.h: No such file or directory 2 | #include | ^~~~ compilation terminated. hasutmpxupdwtmpx.h-yes.c: In function 'foo': hasutmpxupdwtmpx.h-yes.c:6:5: warning: implicit declaration of function 'updwtmpx' [-Wimplicit-function-declaration] 6 | updwtmpx("/nonexistent", &ut); | ^~~~ hasutmpxsyslen.h-yes.c: In function 'main': hasutmpxsyslen.h-yes.c:7:14: error: 'struct utmpx' has no member named 'ut_syslen' 7 | return ut.ut_syslen; | ^ hasutmpxsyslen.h-yes.c:6:18: warning: variable 'ut' set but not used [-Wunused-but-set-variable] 6 | struct utmpx ut = {0}; | ^~ hasutmp.h-yes.c: In function 'main': hasutmp.h-yes.c:8:17: warning: unused variable 'ut' [-Wunused-variable] 8 | struct utmp ut = {0}; | ^~ hasutmptype.h-yes.c: In function 'main': hasutmptype.h-yes.c:8:17: warning: variable 'ut' set but not used [-Wunused-but-set-variable] 8 | struct utmp ut; | ^~ === Wed May 26 16:08:35 2021 === finishing === Wed May 26 16:08:35 2021 === starting crypto lib cleanup.c:2:10: fatal error: hasasmvolatilememory.h: No such file or directory 2 | #include "hasasmvolatilememory.h" | ^~~~~~~~ compilation terminated. === Wed May 26 16:08:36 2021 === libtinynacl.a failed ... see the log /home/user/tinyssh-20190101/build/log

alexmyczko commented 3 years ago

i'm able to build it with debian 11 on arm64 raspberry pi 3 or 4 hardware.

-rw-r--r-- 1 root root  55644 Sep 14 13:29 tinysshd_20190101-1_arm64.deb
-rw-r--r-- 1 root root 122448 Sep 14 13:29 tinysshd-dbgsym_20190101-1_arm64.deb
janmojzis commented 2 years ago

debian 11 e.g.:

apt-get install gcc-10-aarch64-linux-gnu
echo /usr/bin/aarch64-linux-gnu-gcc-10 > conf-cc
echo /usr/bin/aarch64-linux-gnu-ar > conf-ar
./make-tinysshcc.sh
janmojzis commented 2 years ago

Is it still a problem ?

windoozatnick commented 10 months ago

I'm getting a similar error.

I am using cross-compiling from ubuntu 22.04.3 arm64 for armv7l busybox platform, and using the gcc-arm-linux-gnueabihf compiler

I passed the parameter export CC=arm-linux-gnueabihf-gcc, and specified in the conf-cc and conf-ar files the paths to /usr/bin/arm-linux-gnueabihf-gcc and /usr/bin/arm-linux-gnueabihf-ar, respectively.

And I still get this error:

cleanup.c:2:10: fatal error: hasasmvolatilememory.h: No such file or directory
    2 | #include "hasasmvolatilememory.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

What am I doing wrong?

Could it be a problem that my Ubuntu is running in a UTM virtual machine on an ARM M1 macbook?

It looks like it's not a problem to me, but maybe I don't fully understand the compilation process.