AIX compile error
tjoepies opened this issue Β· comments
I tried compiling passh on AIX 7.2.0.0 with gcc-8.3.0 on ppc64le
It fails with the following:
$ diff -u Makefile Makefile.new
--- Makefile 2020-03-20 05:37:40.000000000 +0200
+++ Makefile.new 2020-05-19 10:55:45.000000000 +0200
@@ -1,5 +1,6 @@
.PHONY: all clean
+ CC = gcc
all: passh
$ make
gcc -O passh.c -o passh
passh.c:359:18: warning: 'struct winsize' declared inside parameter list will not be visible outside of this definition or declaration
const struct winsize *slave_winsize)
^~~~~~~
passh.c: In function 'pty_fork':
passh.c:410:17: warning: implicit declaration of function 'ioctl' [-Wimplicit-function-declaration]
if (ioctl(fds, TIOCSWINSZ, slave_winsize) < 0)
^~~~~
In file included from passh.c:46:
passh.c:410:28: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
if (ioctl(fds, TIOCSWINSZ, slave_winsize) < 0)
^~~~~~~~~~
passh.c: In function 'big_loop':
passh.c:727:28: error: storage size of 'ttysize' isn't known
struct winsize ttysize;
^~~~~~~
In file included from passh.c:46:
passh.c:739:31: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
if (ioctl(ourtty, TIOCGWINSZ, &ttysize) == 0) {
^~~~~~~~~~
passh.c:740:34: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
ioctl(g.fd_ptym, TIOCSWINSZ, &ttysize);
^~~~~~~~~~
passh.c: In function 'main':
passh.c:928:20: error: storage size of 'size' isn't known
struct winsize size;
^~~~
In file included from passh.c:46:
passh.c:941:33: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
if (ioctl(STDIN_FILENO, TIOCGWINSZ, (char *) &size) < 0)
^~~~~~~~~~
make: 1254-004 The error code from the last command is 1.
Stop.
$ grep -Hnr winsize /usr/include/
/usr/include/netiso/tp_pcb.h:226:#define tp_winsize _tp_param.p_winsize
/usr/include/netiso/tp_user.h:75: short p_winsize;
/usr/include/sys/ioctl.h:96:struct winsize {
/usr/include/sys/ioctl.h:356:#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
/usr/include/sys/ioctl.h:357:#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
sshpass-1.06 does compile when I add #undefine malloc
to config.h
.
As mentioned in README.md
, sshpass
is broken, and I experience it on AIX. sshpass
only works intermittently. I'm hoping to give passh
a try, but both sexpect
and passh
does not compile unfortunately, and is not available on AIX Toolbox for Linux Applications. passh
does work and compile perfectly on a x86_64 Linux instance.
Thank you
According to AIX 7.2 ioctl manual, it requires one more include:
#include <stropts.h>
Could you help try if that can fix the issue?
I added the line:
$ diff -u passh.c.original passh.c
--- passh.c.original 2020-03-20 05:37:40.000000000 +0200
+++ passh.c 2020-05-20 09:19:04.000000000 +0200
@@ -43,6 +43,7 @@
#include <regex.h>
#include <time.h>
#include <fcntl.h>
+ #include <stropts.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/types.h>
then when I run make, a new error line shows:
$ make
gcc -O passh.c -o passh
passh.c:360:18: warning: 'struct winsize' declared inside parameter list will not be visible outside of this definition or declaration
const struct winsize *slave_winsize)
^~~~~~~
In file included from /usr/include/stropts.h:30,
from passh.c:46:
passh.c: In function 'pty_fork':
passh.c:411:28: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
if (ioctl(fds, TIOCSWINSZ, slave_winsize) < 0)
^~~~~~~~~~
passh.c: In function 'big_loop':
passh.c:728:28: error: storage size of 'ttysize' isn't known
struct winsize ttysize;
^~~~~~~
In file included from /usr/include/stropts.h:30,
from passh.c:46:
passh.c:740:31: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
if (ioctl(ourtty, TIOCGWINSZ, &ttysize) == 0) {
^~~~~~~~~~
passh.c:741:34: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
ioctl(g.fd_ptym, TIOCSWINSZ, &ttysize);
^~~~~~~~~~
passh.c: In function 'main':
passh.c:929:20: error: storage size of 'size' isn't known
struct winsize size;
^~~~
In file included from /usr/include/stropts.h:30,
from passh.c:46:
passh.c:942:33: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
if (ioctl(STDIN_FILENO, TIOCGWINSZ, (char *) &size) < 0)
^~~~~~~~~~
make: 1254-004 The error code from the last command is 1.
Stop.
would anything from ./configure
that runs for sshpass
assist us?
Just checked sshpass code. It does not include stropts.h
so that may be not an issue. The only .h which is in sshpass but not in passh is sys/stat.h
though it does not seem to relate to struct winsize
. Anyway, you can try:
-
Include
sys/stat.h
and see if it helps; -
If it does not, try removing the following lines from passh.c:
#if !defined(__APPLE__) && !defined(__FreeBSD__) #define _XOPEN_SOURCE 600 /* for posix_openpt() */ #endif
This worked for me, I restored the original passh.c
and commented the lines out:
- If it does not, try removing the following lines from passh.c:
#if !defined(__APPLE__) && !defined(__FreeBSD__) #define _XOPEN_SOURCE 600 /* for posix_openpt() */ #endif
There is a small problem with the Makefile on AIX:
$ make
gcc -O passh.c -o passh
rm passh
Target ".PHONY" is up to date.
it seems to run clean too
So I ran: gcc passh.c -o passh
All is well. Thank you
Just committed a fix (one line change). Could you help verify?
Oh. Did not notice your last update. My commit only fixed the gcc error. Will see how I can deal with the makefile.
Makefile also updated. Please try (make clean; make
).
$ make clean; make
rm passh
rm: passh: A file or directory in the path name does not exist.
make: 1254-004 The error code from the last command is 2.
Stop.
cc -O passh.c -o passh
cc: not found
make: 1254-004 The error code from the last command is 1.
Stop.
I added the following:
$ echo "CC = gcc" >> Makefile
then ran:
$ make
gcc -O passh.c -o passh
Target "all" is up to date.
and the passh
file exists. Thank you
$ ./passh -h
Usage: passh [OPTION]... COMMAND...
-c <N> Send at most <N> passwords (0 means infinite. Default: 0)
-C Exit if prompted for the <N+1>th password
-h Help
-i Case insensitive for password prompt matching
-n Nohup the child (e.g. used for `ssh -f')
-p <password> The password (Default: `password')
-p env:<var> Read password from env var
-p file:<file> Read password from file
-P <prompt> Regexp (BRE) for the password prompt
(Default: `[Pp]assword: \{0,1\}$')
-l <file> Save data written to the pty
-L <file> Save data read from the pty
-t <timeout> Timeout waiting for next password prompt
(0 means no timeout. Default: 0)
-T Exit if timed out waiting for password prompt
-y Auto answer `(yes/no)?' questions
Report bugs to Clark Wang <dearvoid@gmail.com>
Thanks for helping verify. For the cc part you can CC=gcc make
.
Thanks for helping verify. For the cc part you can
CC=gcc make
.
yes that did the trick.
$ CC=gcc make
gcc -O passh.c -o passh
Target "all" is up to date.
Thank you. I think this issue is closed now.