Bug 2589 - errors show when build openssh 6.7p1 on AIX 5.3
Summary: errors show when build openssh 6.7p1 on AIX 5.3
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 6.7p1
Hardware: PPC AIX
: P5 minor
Assignee: Darren Tucker
URL:
Keywords:
Depends on:
Blocks: V_7_3
  Show dependency treegraph
 
Reported: 2016-06-16 11:40 AEST by Mason
Modified: 2016-12-09 12:21 AEDT (History)
2 users (show)

See Also:


Attachments
the output of ./configure (128.54 KB, text/plain)
2016-06-16 12:35 AEST, Mason
no flags Details
config.log (915.47 KB, text/plain)
2016-06-16 13:47 AEST, Mason
no flags Details
stdarg.h (3.27 KB, text/plain)
2016-06-16 15:27 AEST, Mason
no flags Details
config.h (46.98 KB, text/plain)
2016-06-17 10:49 AEST, Mason
no flags Details
move VA_COPY into openbsd-compat.h and use in sshbuf-getput-basic.c (2.57 KB, patch)
2016-06-20 13:53 AEST, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mason 2016-06-16 11:40:52 AEST
root@:/openssh-6.7p1>oslevel
5.3.0.0
root@:/openssh-6.7p1>./configure --prefix=/usr --sysconfdir=/etc/ssh
	...
	OpenSSH has been configured with the following options:
                     User binaries: /usr/bin
                   System binaries: /usr/sbin
               Configuration files: /etc/ssh
                   Askpass program: /usr/libexec/ssh-askpass
                      Manual pages: /usr/share/man/manX
                          PID file: /etc/ssh
  Privilege separation chroot path: /var/empty
            sshd default user PATH: /usr/bin:/bin:/usr/sbin:/sbin
                    Manpage format: man
                       PAM support: no
                   OSF SIA support: no
                 KerberosV support: no
                   SELinux support: no
                 Smartcard support:
                     S/KEY support: no
              MD5 password support: no
                   libedit support: no
  Solaris process contract support: no
           Solaris project support: no
       IP address in $DISPLAY hack: no
           Translate v4 in v6 hack: no
                  BSD Auth support: no
              Random number source: OpenSSL internal ONLY
             Privsep sandbox style: rlimit

              Host: powerpc-ibm-aix5.3.0.0
	Compiler: cc -qlanglvl=extc89
    Compiler flags: -g
Preprocessor flags:
      Linker flags:  -blibpath:/usr/lib:/lib
         Libraries: -lcrypto -lz


root@:/openssh-6.7p1>make
        ...

	"/usr/include/stdarg.h", line 89.9: 1506-236 (W) Macro name va_copy has been redefined.
	"/usr/include/stdarg.h", line 89.9: 1506-358 (I) "va_copy" is defined on line 829 of defines.h.
        cc -qlanglvl=extc89 -g  -I. -I.  -DSSHDIR=\"/etc/ssh\"  -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\"  -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/libexec/ssh-askpass\"  -D_PATH_SFTP_SERVER=\"/usr/libexec/sftp-server\"  -D_PATH_SSH_KEY_SIGN=\"/usr/libexec/ssh-keysign\"  -D_PATH_SSH_PKCS11_HELPER=\"/usr/libexec/ssh-pkcs11-helper\"  -D_PATH_SSH_PIDDIR=\"/etc/ssh\"  -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c misc.c -o misc.o

	...

        cc -qlanglvl=extc89 -o ssh ssh.o readconf.o clientloop.o sshtty.o  sshconnect.o sshconnect1.o sshconnect2.o mux.o  roaming_common.o roaming_client.o -L. -Lopenbsd-compat/  -blibpath:/usr/lib:/lib -lssh -lopenbsd-compat  -lcrypto -lz  
ld: 0711-317 ERROR: Undefined symbol: .va_copy
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: The error code from the last command is 8.


Stop.
root@:/openssh-6.7p1>
Comment 1 Darren Tucker 2016-06-16 11:58:15 AEST
See also bug#2315.

I thought this was fixed in https://anongit.mindrot.org/openssh.git/commit/?id=cf5392c2db2bb1dbef9818511d34056404436109

That's dependent on configure correctly detecting va_copy, though.  Could you please attach (using "Add an attachment") the output of ./configure, and the config.log file it generated?
Comment 2 Darren Tucker 2016-06-16 11:59:08 AEST
Also, 6.7 is several years old.  Do you have the problem using a current version?
Comment 3 Mason 2016-06-16 12:35:58 AEST
Created attachment 2830 [details]
the output of ./configure
Comment 4 Mason 2016-06-16 13:02:51 AEST
(In reply to Darren Tucker from comment #2)
> Also, 6.7 is several years old.  Do you have the problem using a
> current version?

Yes, I tried to build 7.2p2 also, it showed the same error messages.
Comment 5 Darren Tucker 2016-06-16 13:26:37 AEST
(In reply to Mason from comment #3)
> Created attachment 2830 [details]
> the output of ./configure

checking whether va_copy exists... no
checking whether __va_copy exists... no

so it's not detecting va_copy.  The reason would be in config.log which you haven't attached yet.
Comment 6 Mason 2016-06-16 13:47:32 AEST
Created attachment 2831 [details]
config.log
Comment 7 Mason 2016-06-16 13:48:22 AEST
(In reply to Darren Tucker from comment #5)
> (In reply to Mason from comment #3)
> > Created attachment 2830 [details]
> > the output of ./configure
> 
> checking whether va_copy exists... no
> checking whether __va_copy exists... no
> 
> so it's not detecting va_copy.  The reason would be in config.log
> which you haven't attached yet.

Just uploaded config.log.

Thanks!
Comment 8 Darren Tucker 2016-06-16 14:56:51 AEST
(In reply to Mason from comment #7)
[...]
> Just uploaded config.log.

Thanks.  The log has:

configure:15964: checking whether va_copy exists
configure:15984: cc -qlanglvl=extc89 -o conftest -g   conftest.c -lcrypto -lz  >&5
ld: 0711-317 ERROR: Undefined symbol: .va_copy
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
configure:15984: $? = 8
configure: failed program was:
[...]
| #include <stdarg.h>
| va_list x,y;
| 
| int
| main ()
| {
|  va_copy(x,y);

however the compiler error indicates that stdarg.h has va_copy, at least under some conditions.  In stdarg.h, is the definition of va_copy inside an ifdef or something?

From bug#2315: maybe try "CC=xlc ./configure [other opts]"
Comment 9 Mason 2016-06-16 15:26:09 AEST
(In reply to Darren Tucker from comment #8)
> (In reply to Mason from comment #7)
> [...]
> > Just uploaded config.log.
> 
> Thanks.  The log has:
> 
> configure:15964: checking whether va_copy exists
> configure:15984: cc -qlanglvl=extc89 -o conftest -g   conftest.c
> -lcrypto -lz  >&5
> ld: 0711-317 ERROR: Undefined symbol: .va_copy
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
> information.
> configure:15984: $? = 8
> configure: failed program was:
> [...]
> | #include <stdarg.h>
> | va_list x,y;
> | 
> | int
> | main ()
> | {
> |  va_copy(x,y);
> 
> however the compiler error indicates that stdarg.h has va_copy, at
> least under some conditions.  In stdarg.h, is the definition of
> va_copy inside an ifdef or something?
> 
> From bug#2315: maybe try "CC=xlc ./configure [other opts]"

I tried "CC=xlc ./configure [other opts]", it's not work for me. It ended up with the same error.

stdarg.h has the definition of va_copy inside an ifdef.

#ifdef _ISOC99_SOURCE
#define va_copy(__list1,__list2) ((void)(__list1 = __list2))
#endif


Also, I uploaded stdarg.h
Comment 10 Mason 2016-06-16 15:27:27 AEST
Created attachment 2833 [details]
stdarg.h
Comment 11 Darren Tucker 2016-06-16 15:52:13 AEST
Ah, I think the warning from stdarg.h is a red herring.  Both stdarg.h and defines.h will define a va_copy and either should work.

Instead, I think there's a source file that includes neither but still uses va_copy.  If you run "nm" on all of the .o files, you should find one that reports "U va_copy" or similar.  Failing that, "grep va_copy `find . -type f`" should find it.
Comment 12 Darren Tucker 2016-06-16 15:54:43 AEST
(In reply to Darren Tucker from comment #11)
>  Failing that, "grep va_copy `find . -type f`" should find it.

make that

grep va_cpy `find . -type f -a -name \*.o`
Comment 13 Mason 2016-06-16 16:02:37 AEST
(In reply to Darren Tucker from comment #12)
> (In reply to Darren Tucker from comment #11)
> >  Failing that, "grep va_copy `find . -type f`" should find it.
> 
> make that
> 
> grep va_cpy `find . -type f -a -name \*.o`

root@:/openssh-6.7p1>nm *.o | grep va_copy
.va_copy             U           -

root@:/openssh-6.7p1>grep va_copy `find . -type f`
./ChangeLog: - (dtucker) [defines.h] Add va_copy if we don't already have it, taken from
./configure.ac:AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
./configure.ac:         ]], [[ va_copy(x,y); ]])],
./configure.ac: [ ac_cv_have_va_copy="yes" ],
./configure.ac: [ ac_cv_have_va_copy="no" 
./configure.ac:if test "x$ac_cv_have_va_copy" = "xyes" ; then
./configure.ac: AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
./configure.ac:AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
./configure.ac:         ]], [[ __va_copy(x,y); ]])],
./configure.ac: [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no" 
./configure.ac:if test "x$ac_cv_have___va_copy" = "xyes" ; then
./configure.ac: AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
./defines.h:#  define va_copy(dest, src) __va_copy(dest, src)
./defines.h:#  define va_copy(dest, src) (dest) = (src)
./config.h.in:/* Define if va_copy exists */
./config.h.in:/* Define if __va_copy exists */
./configure:{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether va_copy exists" >&5
./configure:$as_echo_n "checking whether va_copy exists... " >&6; }
./configure:if ${ac_cv_have_va_copy+:} false; then :
./configure: va_copy(x,y);
./configure:   ac_cv_have_va_copy="yes"
./configure:   ac_cv_have_va_copy="no"
./configure:{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_va_copy" >&5
./configure:$as_echo "$ac_cv_have_va_copy" >&6; }
./configure:if test "x$ac_cv_have_va_copy" = "xyes" ; then
./configure:{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __va_copy exists" >&5
./configure:$as_echo_n "checking whether __va_copy exists... " >&6; }
./configure:if ${ac_cv_have___va_copy+:} false; then :
./configure: __va_copy(x,y);
./configure:   ac_cv_have___va_copy="yes"
./configure:   ac_cv_have___va_copy="no"
./configure:{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___va_copy" >&5
./configure:$as_echo "$ac_cv_have___va_copy" >&6; }
./configure:if test "x$ac_cv_have___va_copy" = "xyes" ; then
./config.log:configure:15964: checking whether va_copy exists
./config.log:ld: 0711-317 ERROR: Undefined symbol: .va_copy
./config.log:|  va_copy(x,y);
./config.log:configure:16002: checking whether __va_copy exists
./config.log:ld: 0711-317 ERROR: Undefined symbol: .__va_copy
./config.log:|  __va_copy(x,y);
./config.log:ac_cv_have___va_copy=no
./config.log:ac_cv_have_va_copy=no
./config.h:/* Define if va_copy exists */
./config.h:/* Define if __va_copy exists */
./libssh.a:
./openbsd-compat/bsd-asprintf.c:#  define VA_COPY(dest, src) va_copy(dest, src)
./openbsd-compat/bsd-asprintf.c:#   define VA_COPY(dest, src) __va_copy(dest, src)
./openbsd-compat/bsd-snprintf.c: * Fix usage of va_list passed as an arg.  Use __va_copy before using it
./openbsd-compat/bsd-snprintf.c:#  define VA_COPY(dest, src) va_copy(dest, src)
./openbsd-compat/bsd-snprintf.c:#   define VA_COPY(dest, src) __va_copy(dest, src)
./sshbuf-getput-basic.c:        va_copy(ap2, ap);
./sshbuf-getput-basic.c:        va_copy(ap2, ap);
./sshbuf-getput-basic.o:
root@:/openssh-6.7p1>


root@:/openssh-6.7p1> grep va_cpy `find . -type f -a -name \*.o`
./sshbuf-getput-basic.o:
Comment 14 Darren Tucker 2016-06-16 16:16:50 AEST
(In reply to Mason from comment #13)
> root@:/openssh-6.7p1> grep va_cpy `find . -type f -a -name \*.o`
> ./sshbuf-getput-basic.o:

I assume "va_cpy" is a transcription error?  Assuming so, it looks like sshbuf-getput-basic.c is the culprit.  Next question is: why?

Even in 6.7p1, sshbuf-getput-basic.c includes "includes.h" which includes "defines.h".  defines.h has:

#ifndef HAVE_VA_COPY
# ifdef HAVE___VA_COPY
#  define va_copy(dest, src) __va_copy(dest, src)
# else
#  define va_copy(dest, src) (dest) = (src)
# endif
#endif

which should have taken care of it.

The other thing of note is that sshbuf-getput-basic.c uses va_copy without including stdarg.h although it probably should.

Maybe try adding

#include <stdarg.h>

with the rest of the includes at the start of sshbuf-getput-basic.c ?
Comment 15 Mason 2016-06-16 16:35:05 AEST
(In reply to Darren Tucker from comment #14)
> (In reply to Mason from comment #13)
> > root@:/openssh-6.7p1> grep va_cpy `find . -type f -a -name \*.o`
> > ./sshbuf-getput-basic.o:
> 
> I assume "va_cpy" is a transcription error?  Assuming so, it looks
> like sshbuf-getput-basic.c is the culprit.  Next question is: why?
> 
> Even in 6.7p1, sshbuf-getput-basic.c includes "includes.h" which
> includes "defines.h".  defines.h has:
> 
> #ifndef HAVE_VA_COPY
> # ifdef HAVE___VA_COPY
> #  define va_copy(dest, src) __va_copy(dest, src)
> # else
> #  define va_copy(dest, src) (dest) = (src)
> # endif
> #endif
> 
> which should have taken care of it.
> 
> The other thing of note is that sshbuf-getput-basic.c uses va_copy
> without including stdarg.h although it probably should.
> 
> Maybe try adding
> 
> #include <stdarg.h>
> 
> with the rest of the includes at the start of sshbuf-getput-basic.c ?

I tried, it ended with exactly the same error messages.
Comment 16 Darren Tucker 2016-06-16 16:40:02 AEST
(In reply to Mason from comment #15)
> I tried, it ended with exactly the same error messages.

I'm kinda stumped.

Does anything in the system headers do "#undef va_copy" ?
Comment 17 Darren Tucker 2016-06-16 16:41:56 AEST
maybe worth a try:

CC="xlc -qlanglvl=extc99" ./configure && make clean && make
Comment 18 Mason 2016-06-16 18:59:02 AEST
(In reply to Darren Tucker from comment #17)
> maybe worth a try:
> 
> CC="xlc -qlanglvl=extc99" ./configure && make clean && make

still same error messages.
Comment 19 Darren Tucker 2016-06-16 19:38:08 AEST
(In reply to Mason from comment #18)
> (In reply to Darren Tucker from comment #17)
> > maybe worth a try:
> > 
> > CC="xlc -qlanglvl=extc99" ./configure && make clean && make
> 
> still same error messages.

OK, now I'm stumped.  Could you please attach the config.h file generated by configure?

Just to check: you are doing these tests in a cleanly extracted copy of the source tarball?  If the compiler can find a config.h somewhere in its path (eg if you've run ./configure in the top-level directory then tried re-running configure in another directory) then it'll use the wrong config.h file.
Comment 20 Mason 2016-06-17 10:46:50 AEST
(In reply to Darren Tucker from comment #19)
> (In reply to Mason from comment #18)
> > (In reply to Darren Tucker from comment #17)
> > > maybe worth a try:
> > > 
> > > CC="xlc -qlanglvl=extc99" ./configure && make clean && make
> > 
> > still same error messages.
> 
> OK, now I'm stumped.  Could you please attach the config.h file
> generated by configure?
> 
> Just to check: you are doing these tests in a cleanly extracted copy
> of the source tarball?  If the compiler can find a config.h
> somewhere in its path (eg if you've run ./configure in the top-level
> directory then tried re-running configure in another directory) then
> it'll use the wrong config.h file.


root@:/openssh-6.7p1>./configure --prefix=/usr --sysconfdir=/etc/ssh
root@:/openssh-6.7p1>make

As you can see, I run all the commands in the same path.

uploaded config.h.

Thank you!
Comment 21 Mason 2016-06-17 10:49:41 AEST
Created attachment 2835 [details]
config.h
Comment 22 Darren Tucker 2016-06-17 10:50:23 AEST
(In reply to Mason from comment #21)
> Created attachment 2835 [details]
> config.log

config.h instead please.
Comment 23 Darren Tucker 2016-06-17 10:52:50 AEST
(In reply to Mason from comment #20)
> root@:/openssh-6.7p1>./configure --prefix=/usr --sysconfdir=/etc/ssh
> root@:/openssh-6.7p1>make

You should also "make clean" before "make", the dependencies don't always catch everything (they should, but I'm always suspicious).
Comment 24 Mason 2016-06-17 10:54:57 AEST
(In reply to Darren Tucker from comment #23)
> (In reply to Mason from comment #20)
> > root@:/openssh-6.7p1>./configure --prefix=/usr --sysconfdir=/etc/ssh
> > root@:/openssh-6.7p1>make
> 
> You should also "make clean" before "make", the dependencies don't
> always catch everything (they should, but I'm always suspicious).

Actually, I run the "make clean" every time, it didn't change anything.
Comment 25 Darren Tucker 2016-06-17 11:00:43 AEST
Comment on attachment 2835 [details]
config.h

Oh, right file, wrong description.
Comment 26 Mason 2016-06-20 11:03:14 AEST
(In reply to Darren Tucker from comment #25)
> Comment on attachment 2835 [details]
> config.h
> 
> Oh, right file, wrong description.

Any suggestions?
Comment 27 Darren Tucker 2016-06-20 13:21:59 AEST
(In reply to Mason from comment #26)
> Any suggestions?

I don't understand why it doesn't work.  I do have access to an AIX box however it doesn't have xlc.  I was hoping to use the config.h you supplied to figure out why it doesn't work, but I haven't done that yet.

If you need to get it built right now, I'd suggest using 7.2p2 and adding this line to sshbuf-getput-basic.c after all the #defines and #includes:

#define va_copy(dest, src) (dest) = (src)
Comment 28 Darren Tucker 2016-06-20 13:40:27 AEST
(In reply to Darren Tucker from comment #27)
> I don't understand why it doesn't work.

There might be a hint here:
https://lists.gnu.org/archive/html/bug-gnulib/2008-02/msg00139.html

"""
Turns out that even though config.h correctly has '#define va_copy
gl_va_copy', xlc's stddef.h #undefs va_copy and does not define it to
the builtin.

xlc's stdarg.h also does not have any include guards, so you can not
#include <stdarg.h> then #define va_copy, as the next time stdarg.h
gets included it will get undefined all over again.
"""

which sounds a lot like what we're seeing.  Is there another stdarg.h file somewhere that xlc picks up instead of the system one, or does one of the files included by stdarg.h contain "#undef va_copy" ?
Comment 29 Darren Tucker 2016-06-20 13:53:08 AEST
Created attachment 2842 [details]
move VA_COPY into openbsd-compat.h and use in sshbuf-getput-basic.c

If comment#27 checks out, please try this patch.
Comment 30 Darren Tucker 2016-06-22 14:25:44 AEST
Did the patch help?  if so I'd like to include it in the next release.
Comment 31 Mason 2016-06-27 17:47:25 AEST
(In reply to Darren Tucker from comment #30)
> Did the patch help?  if so I'd like to include it in the next
> release.

Sorry, my test server was removed, I can't continue the testing.

I would like to put it on hold, and will continue the testing once I get another server.

Thanks!
Comment 32 Darren Tucker 2016-07-15 14:55:25 AEST
I'm pretty sure this is the right thing to do so I've committed it for the next release.  (if there are still problems when you are able to test it please reopen this bug)
Comment 33 Damien Miller 2016-12-09 12:21:21 AEDT
Bulk mark issues CLOSED in 7.3 release