Hi, I'm trying to compile OpenSSH 6.7p1 on AIX 7.1 TL2 SP3 with IBM XL C/C++ 12.1.0.9, OpenSSL 1.0.1j and zlib 1.2.8 This is my compile procedure: export PATH=$PATH:/usr/vac/bin /usr/bin/gzip -cd openssh-6.7p1.tar.gz |/usr/bin/tar xf - cd openssh-6.7p1 ./configure --prefix=/usr/local/openssh-6.7p1 --sysconfdir=/etc/ssh --without-shadow --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib /usr/bin/make And I get the following error: 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/ -L/usr/local/openssl/lib -L/usr/local/zlib/lib -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: 1254-004 The error code from the last command is 8. Same error on AIX 5.3 TL12 SP9 with IBM XL C/C++ 11.1.0.19 and AIX 6.1 TL8 SP3 with IBM XL C/C++ 10.1.0.20 I was able to compile OpenSSH 6.6p1 with OpenSSL 1.0.1i and zlib 1.2.8 with this procedure without issue. I've found that by adding this in sshbuf-getput-basic.c and by replacing every occurence of va_copy by VA_COPY, I'm now able to compile it. #ifndef VA_COPY # ifdef HAVE_VA_COPY # define VA_COPY(dest, src) va_copy(dest, src) # else # ifdef HAVE___VA_COPY # define VA_COPY(dest, src) __va_copy(dest, src) # else # define VA_COPY(dest, src) (dest) = (src) # endif # endif #endif This fix/workaround is inspired by openbsd-compat/bsd-snprintf.c Do you believe it would be the right fix to apply? If so, could it be done in master so that next release include it? If it's not the right fix, anyone willing to look at this issue and suggest another fix? Best regards, Yannick Bergeron
The much easier way is to set CC=xlc before running configure. By default cc is much closer to c89 (or even pre-c89?) whereas xlc is much closer to c99. The key difference, as far as va_copy is concerned is that xlc and it's derivatives redefine va_copy into a builtin function. Test program: va_copy_test.c: === #include <stdarg.h> /* * test va_copy changes by changing XL C compiler name (cc, c89, c99, xlc) * and the -E flag */ va_copy_test(void *a, void *b) { #ifdef _ANSI_C_SOURCE #ifdef _ISOC99_SOURCE va_copy(a,b); #else fake_ansi_copy(a,b); #endif #endif #ifndef _ANSI_C_SOURCE fake_noansi_copy(a,b); #endif } === CC=cc root@x064:[/data/prj/openbsd/openssh]cc -E va_copy_test.c #line 62 "/usr/include/va_list.h" typedef char *va_list; #line 8 "va_copy_test.c" va_copy_test(void *a, void *b) { #line 13 va_copy(a,b); #line 21 } CC=c89 root@x064:[/data/prj/openbsd/openssh]c89 -E va_copy_test.c #line 62 "/usr/include/va_list.h" typedef char *va_list; #line 8 "va_copy_test.c" va_copy_test(void *a, void *b) { #line 15 fake_ansi_copy(a,b); #line 21 } CC=c99 root@x064:[/data/prj/openbsd/openssh]c99 -E va_copy_test.c #line 62 "/usr/include/va_list.h" typedef char *va_list; #line 8 "va_copy_test.c" va_copy_test(void *a, void *b) { #line 13 __builtin_va_copy(a,b); #line 21 } CC=xlc root@x064:[/data/prj/openbsd/openssh]xlc -E va_copy_test.c #line 62 "/usr/include/va_list.h" typedef char *va_list; #line 8 "va_copy_test.c" va_copy_test(void *a, void *b) { #line 13 __builtin_va_copy(a,b); #line 21 } Although c99 and xlc give the same results - for this - my preference is to use xlc. Review /etc/vac.cfg.?? and compare c99 with xlc and make your choice. Saves you a lot of code changes!
At to list to look at for 6.9p1
Does this still need fixing? Darren committed this last year: Author: Darren Tucker <dtucker@zip.com.au> Date: Thu Jun 12 05:22:49 2014 +1000 - (dtucker) [defines.h] Add va_copy if we don't already have it, taken from openbsd-compat/bsd-asprintf.c --- a/defines.h +++ b/defines.h ... +#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
No, not a bug imho - just use the right compiler option - either c99 or xlc. The key differences in what the different compiler options are - when started by a different can be found in /etc/vac.cfg.NN where NN is 53, 61, or 71 depending your current version of AIX. For your convenience the key differences are the default options triggered: * -qlanglvl=extc99 C compiler with common extensions, UNIX headers xlc: use = DEFLT_C crt = /lib/crt0.o mcrt = /lib/mcrt0.o gcrt = /lib/gcrt0.o libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc proflibs = -L/lib/profiled,-L/usr/lib/profiled options = -qlanglvl=extc99,-qcpluscmt,-qkeyword=inline,-qalias=ansi * C compiler, extended mode cc: use = DEFLT_C crt = /lib/crt0.o mcrt = /lib/mcrt0.o gcrt = /lib/gcrt0.o libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc proflibs = -L/lib/profiled,-L/usr/lib/profiled options = -qlanglvl=extended,-qnoro,-qnoroconst * Strict ANSI compiler, ANSI headers c89: use = DEFLT_C crt = /lib/crt0.o mcrt = /lib/mcrt0.o gcrt = /lib/gcrt0.o libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc proflibs = -L/lib/profiled,-L/usr/lib/profiled options = -D_ANSI_C_SOURCE,-qalias=ansi,-qnolonglong,-qstrict_induction * Strict ANSI compiler, ANSI headers c99: use = DEFLT_C crt = /lib/crt0.o mcrt = /lib/mcrt0.o gcrt = /lib/gcrt0.o libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc proflibs = -L/lib/profiled,-L/usr/lib/profiled options = -qlanglvl=stdc99,-D_ANSI_C_SOURCE,-D_ISOC99_SOURCE,-qalias=ansi,-qstrict_induction If you wanted to be nice you could default cc=xlc (my recommendation) when running ./configure on AIX rather than cc when CC is not defined as an environment variable. This assumes gcc is also not available. From my examples above showing the result of different ${CC} results both c99 and xlc do va_copy as a built-in - no external reference needed. No new define needed either. Michael
Move unfinished bugs from 6.9 (how did I miss these?) to 7.1
I've added comment to README.platform with this. I would consider applying a diff to select xlc where $CC is not set however I do not have access to a system with xlc to test it myself.
Close all resolved bugs after 7.3p1 release