Created attachment 169642 [details] Fix net/mosh build with libc++ 3.8.0 During the exp-run in bug 208158, it was found that net/mosh gives errors with libc++ 3.8.0 [1]: ocb.cc:111:26: error: expected ')' static inline uint64_t bswap64(uint64_t x) { ^ /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' #define bswap64(x) __bswap64(x) ^ /usr/include/x86/endian.h:80:27: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ I'm not completely sure why this is suddenly a problem when building with a newer libc++, other than maybe a different include order. In any case, mosh tries to redefine its own flavor of bswap64() here, and its configure script fails to properly detect __builtin_bswap64(), which should really be used. Therefore, add ac_cv_have_decl___builtin_bswap64=yes (and ac_cv_have_decl___builtin_ctz=yes) to the configure arguments, and also add #include "config.h" to ocb.cc, since it didn't include that file yet. [1] http://package18.nyi.freebsd.org/data/headamd64PR208158-default/2016-03-22_18h30m05s/logs/errors/mosh-1.2.5.log
Upstream committed a fix: https://github.com/mobile-shell/mosh/issues/745#event-653938921
A commit references this bug: Author: zi Date: Mon May 9 12:23:00 UTC 2016 New revision: 414841 URL: https://svnweb.freebsd.org/changeset/ports/414841 Log: - Fix build with libc++ 3.8.0 PR: 209019 Submitted by: dim@ Obtained from: upstream commit 9073983df3ff23f2230f941e525aa167ece50ddd Changes: head/net/mosh/files/ head/net/mosh/files/patch-9073983df3ff23f2230f941e525aa167ece50ddd
Hm, I still get the same errors after r414841: --- ocb.o --- ocb.cc:118:10: warning: 'bswap32' macro redefined [-Wmacro-redefined] #define bswap32(x) \ ^ /usr/include/sys/endian.h:60:9: note: previous definition is here #define bswap32(x) __bswap32(x) ^ ocb.cc:122:26: error: expected ')' static inline uint64_t bswap64(uint64_t x) { ^ /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' #define bswap64(x) __bswap64(x) ^ /usr/include/x86/endian.h:80:27: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ ocb.cc:122:26: note: to match this '(' /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' #define bswap64(x) __bswap64(x) ^ /usr/include/x86/endian.h:80:2: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ ocb.cc:122:26: error: static declaration of '__builtin_constant_p' follows non-static declaration static inline uint64_t bswap64(uint64_t x) { ^ /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' #define bswap64(x) __bswap64(x) ^ /usr/include/x86/endian.h:80:3: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ /usr/include/x86/endian.h:122:10: note: previous implicit declaration is here return (__bswap64_gen(_x)); ^ /usr/include/x86/endian.h:70:16: note: expanded from macro '__bswap64_gen' (((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32)) ^ /usr/include/x86/endian.h:77:3: note: expanded from macro '__bswap32' (__builtin_constant_p(x) ? \ ^ 1 warning and 2 errors generated.
Created attachment 170155 [details] Revised upstream patch, adding #include "config.h" Ok, so the problem is that in ocb.cc, config.h was *still* not included, so while HAVE_DECL_BSWAP64 was properly detected by configure, the define didn't arrive in the right place... Here's a revised upstream patch, adding #include "config.h" at the top of the file.
Dimitry thanks I confirm this latest patch works for 10.3R and 11.0-CURRENT. https://github.com/skunkwerks/ports/commit/a9ec56f448f07d425b69031d6ddbd55d8b320220.patch
This also works for me, it compiles without error and mosh is running fine on my 11-CURRENT machine now. Thanks for the patch!
The patch from #4 also worked for me on stable/11 (r302977). Thanks!
This short diff silences the USES_OPENSSL deprecation warning from ports framework: diff --git a/net/mosh/Makefile b/net/mosh/Makefile index 969e31b..1153b7d 100644 --- a/net/mosh/Makefile +++ b/net/mosh/Makefile @@ -20,8 +20,7 @@ CONFIGURE_ARGS= --with-utempter --without-ncurses CONFIGURE_ENV+= OPENSSL_CFLAGS="-I${OPENSSLINC}" OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \ TINFO_CFLAGS="-I/usr/include" INSTALL_TARGET= install-strip -USE_OPENSSL= yes -USES= autoreconf:autoconf ncurses perl5 pkgconfig +USES= autoreconf:autoconf ncurses perl5 pkgconfig ssl CONFLICTS_INSTALL= mosh-0.[2-9].* diff --git a/net/mosh/distinfo b/net/mosh/distinfo index 146d26f..0c8a350 100644 --- a/net/mosh/distinfo +++ b/net/mosh/distinfo @@ -1,2 +1,3 @@ +TIMESTAMP = 1470643539 SHA256 (mosh-1.2.5.tar.gz) = 1af809e5d747c333a852fbf7acdbf4d354dc4bbc2839e3afe5cf798190074be3 SIZE (mosh-1.2.5.tar.gz) = 308857 zi@ AFAICT this BZ could be closed now, since r419315
Closing as it builds fine on FreeBSD 11.0 which ships libc++ 3.8. http://beefy9.nyi.freebsd.org/data/110amd64-default/425183/logs/mosh-1.2.6_1.log http://beefy10.nyi.freebsd.org/data/110i386-default/425183/logs/mosh-1.2.6_1.log