Back in January/March of 2017, it was the case that building openssh with the latest openssl on MacOS 10.12.x (Sierra) was a bit of a bother. I could build everything with Xcode, but the resulting sshd segfaulted upon invocation (see the archives). So I built gcc 6.3 and used that to build openssh 7.x on Sierra. As long as machines stayed on 10.12.x, all was fine. Under High Sierra, the Xcode behavior is the same, but the old gcc 6.3 compiler or a newly-built-under-High-Sierra gcc 6.4 fails to build openssh 7.6p1 (or the latest SNAP) with: /usr/local/gcc-6.3.0/bin/gcc -g -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-strong -I. -I. -I/usr/local/sshssl102n/include -DSSHDIR=\"/usr/local/ssh/etc\" -D_PATH_SSH_PROGRAM=\"/usr/local/ssh/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/local/ssh/libexec/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/local/ssh/libexec/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/local/ssh/libexec/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/local/ssh/libexec/ssh-pkcs11-helper\" -D_PATH_SSH_PIDDIR=\"/var/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c log.c -o log.o In file included from /usr/include/sys/cdefs.h:587:0, from /usr/include/sys/types.h:75, from includes.h:25, from log.c:37: /usr/include/sys/syslog.h:227:124: error: expected ',' or ';' before '__asm' void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, __DARWIN_EXTSN(syslog)); The corresponding bits from syslog.h are [lines wrapped] #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, __DARWIN_EXTSN(syslog)); #else void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called; #endif Any help is greatly appreciated. Cheers, Zube
On Fri, 19 Jan 2018, Zube wrote:> Back in January/March of 2017, it was the case that building openssh > with the latest openssl on MacOS 10.12.x (Sierra) was a bit of > a bother. > > I could build everything with Xcode, but the resulting sshd segfaulted > upon invocation (see the archives). So I built gcc 6.3 and used that > to build openssh 7.x on Sierra. As long as machines stayed on 10.12.x, > all was fine. > > Under High Sierra, the Xcode behavior is the same, but the old gcc > 6.3 compiler or a newly-built-under-High-Sierra gcc 6.4 fails to > build openssh 7.6p1 (or the latest SNAP) with: > > /usr/local/gcc-6.3.0/bin/gcc -g -O2 -pipe -Wall > -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security > -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result > -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset > -fstack-protector-strong -I. -I. -I/usr/local/sshssl102n/include > -DSSHDIR=\"/usr/local/ssh/etc\" > -D_PATH_SSH_PROGRAM=\"/usr/local/ssh/bin/ssh\" > -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/local/ssh/libexec/ssh-askpass\" > -D_PATH_SFTP_SERVER=\"/usr/local/ssh/libexec/sftp-server\" > -D_PATH_SSH_KEY_SIGN=\"/usr/local/ssh/libexec/ssh-keysign\" > -D_PATH_SSH_PKCS11_HELPER=\"/usr/local/ssh/libexec/ssh-pkcs11-helper\" > -D_PATH_SSH_PIDDIR=\"/var/run\" > -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c log.c > -o log.o In file included from /usr/include/sys/cdefs.h:587:0, > from /usr/include/sys/types.h:75, from includes.h:25, > from log.c:37: > /usr/include/sys/syslog.h:227:124: error: expected ',' or ';' before > '__asm' > void syslog(int, const char *, ...) __printflike(2, 3) > __not_tail_called __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, > __DARWIN_EXTSN(syslog)); > > The corresponding bits from syslog.h are [lines wrapped] > > #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && > __DARWIN_C_LEVEL >= __DARWIN_C_FULL > > void syslog(int, const char *, ...) __printflike(2, 3) > __not_tail_called __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, > __DARWIN_EXTSN(syslog)); > > #else > void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called; > #endifIt looks like sys/types.h isn't pulling in some Apple-private preprocessor defines that it expects and is consequently choking. This could be a bad installation of the build tools or a bug in Apple's headers themselves. You could try grepping /usr/include for the definition of __DARWIN_ALIAS_STARTING to see where that is and seeing if including the file where it lives near the top on includes.h fixes it. (I don't have a High Sierra host, so can't help directly - sorry) -d
On Tue Jan 23 01:58:47 PM, Damien Miller wrote:> > /usr/include/sys/syslog.h:227:124: error: expected ',' or ';' before > > '__asm' > > void syslog(int, const char *, ...) __printflike(2, 3) > > __not_tail_called __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, > > __DARWIN_EXTSN(syslog)); > > You could try grepping /usr/include for the definition of > __DARWIN_ALIAS_STARTING to see where that is and seeing if including > the file where it lives near the top on includes.h fixes it. > > (I don't have a High Sierra host, so can't help directly - sorry)No worries. Thank you for taking the time to reply. This page: https://discussions.apple.com/thread/8127677 suggests two workarounds: Adding gcc option -U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ or Adding gcc option -mmacosx-version-min=10.12 (from gcc6) I chose the latter and added it to CFLAGS. It compiled cleanly. Cheers, Zube