Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 391011 - net-misc/openssh fails to compile on Gentoo/FBSD 9.0
Summary: net-misc/openssh fails to compile on Gentoo/FBSD 9.0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-19 12:42 UTC by Yuta SATOH
Modified: 2013-01-18 16:42 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
openssh-5.9p1 patch for freebsd9 (openssh-5.9p1-fbsd90.patch,1.21 KB, patch)
2011-12-03 01:41 UTC, Tibor Vago
Details | Diff
sample patch for openssh-5.9_p1-r4.ebuild (391011.patch,1.17 KB, patch)
2012-03-19 12:53 UTC, Yuta SATOH
Details | Diff
autoconf patch to disable utmp and wtmp (openssh-6.0_p1-freebsd.patch,546 bytes, patch)
2012-05-14 21:23 UTC, Naohiro Aota
Details | Diff
simpe patch to fix non POSIX test construction (openssh-6.0_p1-configure.patch,600 bytes, patch)
2012-05-14 21:32 UTC, Naohiro Aota
Details | Diff
A patch for the openssh-6.0_p1.ebuild to solve this problem (openssh-6.0_p1-fix-freebsd-builds.patch,906 bytes, patch)
2012-05-29 02:58 UTC, Richard Yao (RETIRED)
Details | Diff
Configure script patch to unconditionally disable utmp and wtmp on FreeBSD (openssh-6.0_p1-fix-freebsd-builds.patch,602 bytes, patch)
2012-05-29 03:49 UTC, Richard Yao (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuta SATOH 2011-11-19 12:42:54 UTC
The following message is displayed and fails to compile on Gentoo/FBSD 9.0_rc1.

>>> Emerging (1 of 1) net-misc/openssh-5.9_p1-r3
 * openssh-5.9p1.tar.gz RMD160 SHA1 SHA256 size ;-) ...                  [ ok ]
 * openssh-5.9p1-hpn13v11.diff.gz RMD160 SHA1 SHA256 size ;-) ...        [ ok ]
>>> Unpacking source...
>>> Unpacking openssh-5.9p1.tar.gz to /var/tmp/portage/net-misc/openssh-5.9_p1-r3/work
>>> Unpacking openssh-5.9p1-hpn13v11.diff.gz to /var/tmp/portage/net-misc/openssh-5.9_p1-r3/work
>>> Source unpacked in /var/tmp/portage/net-misc/openssh-5.9_p1-r3/work
>>> Preparing source in /var/tmp/portage/net-misc/openssh-5.9_p1-r3/work/openssh-5.9p1 ...
 * Applying openssh-5.9_p1-sshd-gssapi-multihomed.patch ...              [ ok ]
 * Applying openssh-4.7_p1-GSSAPI-dns.patch ...                          [ ok ]
 * Applying openssh-5.9p1-hpn13v11.diff ...                              [ ok ]
 * Applying openssh-5.6_p1-hpn-progressmeter.patch ...                   [ ok ]
 * Running eautoreconf in '/var/tmp/portage/net-misc/openssh-5.9_p1-r3/work/openssh-5.9p1' ...
 * Running autoconf ...                                                  [ ok ]
 * Running autoheader ...                                                [ ok ]
>>> Source prepared.

<snip>

x86_64-gentoo-freebsd9.0-gcc -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -fstack-protector-all  -I. -I.. -I. -I./..  -DHAVE_CONFIG_H -c bsd-openpty.c
bsd-openpty.c: In function 'openpty':
bsd-openpty.c:128:17: error: 'I_PUSH' undeclared (first use in this function)
bsd-openpty.c:128:17: note: each undeclared identifier is reported only once for each function it appears in
gmake[1]: *** [bsd-openpty.o] Error 1
gmake[1]: Leaving directory `/var/tmp/portage/net-misc/openssh-5.9_p1-r3/work/openssh-5.9p1/openbsd-compat'
gmake: *** [openbsd-compat/libopenbsd-compat.a] Error 2
emake failed
 * ERROR: net-misc/openssh-5.9_p1-r3 failed (compile phase):
 *   emake failed
 *
 * Call stack:
 *     ebuild.sh, line   56:  Called src_compile
 *   environment, line 3325:  Called _eapi2_src_compile
 *     ebuild.sh, line  669:  Called die
 * The specific snippet of code:
 *              emake || die "emake failed"
 *
 * If you need support, post the output of 'emerge --info =net-misc/openssh-5.9_p1-r3',
 * the complete build log and the output of 'emerge -pqv =net-misc/openssh-5.9_p1-r3'.
 * The complete build log is located at '/var/tmp/portage/net-misc/openssh-5.9_p1-r3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/net-misc/openssh-5.9_p1-r3/temp/environment'.
 * S: '/var/tmp/portage/net-misc/openssh-5.9_p1-r3/work/openssh-5.9p1'

>>> Failed to emerge net-misc/openssh-5.9_p1-r3, Log file:

>>>  '/var/tmp/portage/net-misc/openssh-5.9_p1-r3/temp/build.log'


Reproducible: Always

Steps to Reproduce:
1. ACCEPT_KEYWORDS=~x86-fbsd emerge net-misc/openssh
Comment 1 Tibor Vago 2011-11-30 12:54:35 UTC
Same problem here.
Comment 2 Tibor Vago 2011-12-03 01:41:55 UTC
Created attachment 294555 [details, diff]
openssh-5.9p1 patch for freebsd9

This is a possible patch for freebsd9. I've tested and sshd compiles and works fine. The ebuild dependency check could be:
[[ ${CHOST} == *-freebsd9* ]] && epatch "${FILESDIR}/openssh-5.9p1-fbsd90.patch"
Comment 3 Tibor Vago 2011-12-05 19:40:31 UTC
Attached patch must be applied after eautoreconf and before configure.
Comment 4 Yuta SATOH 2011-12-17 10:06:13 UTC
FYI, ports/160389: [patch] security/openssh-portable: fix build on 9.x
http://www.freebsd.org/cgi/query-pr.cgi?pr=160389
Comment 5 Alexis Ballier gentoo-dev 2011-12-21 18:10:19 UTC
Comment on attachment 294555 [details, diff]
openssh-5.9p1 patch for freebsd9

this patch is wrong, openssh fails to properly detect libutil, that's all iirc.

configure.ac contains:
dnl    Checks for libutil functions
AC_CHECK_HEADERS([libutil.h])
AC_SEARCH_LIBS([login], [util bsd], [AC_DEFINE([HAVE_LOGIN], [1],
        [Define if your libraries define login()])])
AC_CHECK_FUNCS([fmt_scaled logout updwtmp logwtmp])


but, in freebsd 9, this commit removed the 'login' function:
http://svnweb.freebsd.org/base/stable/9/lib/libutil/libutil.h?r1=200035&r2=202216


we should check for another function in libutil (openpty for example)
Comment 6 Alexis Ballier gentoo-dev 2011-12-21 18:11:21 UTC
ccing maintainer but i guess some patch should be sent upstream first
Comment 7 Yuta SATOH 2012-03-19 12:53:58 UTC
Created attachment 305875 [details, diff]
sample patch for openssh-5.9_p1-r4.ebuild

This patch is added to the ebuild to fix comment #4 + Makefile from FreeBSD ports.

http://www.freebsd.org/cgi/cvsweb.cgi/ports/security/openssh-portable/Makefile?rev=1.157;content-type=text%2Fplain

> .if ${OSVERSION} >= 900007
> CONFIGURE_ARGS+=	--disable-utmp --disable-wtmp --disable-wtmpx --without-lastlog
> .endif
Comment 8 Alexis Ballier gentoo-dev 2012-03-19 17:52:20 UTC
might want to have a look at:
https://lists.mindrot.org/pipermail/openssh-unix-dev/2012-March/030313.html
and follow-ups
Comment 9 Richard Yao (RETIRED) gentoo-dev 2012-03-21 16:38:10 UTC
(In reply to comment #7)
> Created attachment 305875 [details, diff] [details, diff]
> sample patch for openssh-5.9_p1-r4.ebuild
> 
> This patch is added to the ebuild to fix comment #4 + Makefile from FreeBSD
> ports.
> 
> http://www.freebsd.org/cgi/cvsweb.cgi/ports/security/openssh-portable/
> Makefile?rev=1.157;content-type=text%2Fplain
> 
> > .if ${OSVERSION} >= 900007
> > CONFIGURE_ARGS+=	--disable-utmp --disable-wtmp --disable-wtmpx --without-lastlog
> > .endif

OpenSSH suffers from an --as-needed failure with this patch, but removing -Wl,--as-needed from your LDFLAGS is a viable workaround. Despite that, this patch is an improvement.

If base-system has no objections, this should be committed to portage. The --as-needed failure can be fixed separately.
Comment 10 Alexis Ballier gentoo-dev 2012-04-23 12:58:00 UTC
this should help but is apparently not enough (needs some EXTRA_ECONF to disable utmp, wtmp & friends):
http://hg.mindrot.org/openssh/raw-rev/37678d290982

@base-system, mind if I apply this or do you prefer to wait for openssh-6 ?
(this version should be fine)
Comment 11 Alexis Ballier gentoo-dev 2012-04-23 13:02:15 UTC
(In reply to comment #10)
> this should help but is apparently not enough (needs some EXTRA_ECONF to
> disable utmp, wtmp & friends):
> http://hg.mindrot.org/openssh/raw-rev/37678d290982
> 
> @base-system, mind if I apply this or do you prefer to wait for openssh-6 ?
> (this version should be fine)

actually:
http://openbsd.org.ar/pub/OpenBSD/OpenSSH/portable/openssh-6.0p1.tar.gz

so i'll just wait for you to update it :=)
Comment 12 Richard Yao (RETIRED) gentoo-dev 2012-05-03 03:03:02 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > this should help but is apparently not enough (needs some EXTRA_ECONF to
> > disable utmp, wtmp & friends):
> > http://hg.mindrot.org/openssh/raw-rev/37678d290982
> > 
> > @base-system, mind if I apply this or do you prefer to wait for openssh-6 ?
> > (this version should be fine)
> 
> actually:
> http://openbsd.org.ar/pub/OpenBSD/OpenSSH/portable/openssh-6.0p1.tar.gz
> 
> so i'll just wait for you to update it :=)

OpenSSH 6.0 is now in the tree.
Comment 13 Naohiro Aota gentoo-dev 2012-05-03 09:02:27 UTC
EXTRA_ECONF='--disable-utmp --disable-wtmp --disable-wtmpx --without-lastlog' emerge -1 openssh passed.
I'm thinking how to deal with these utmp and wtmp things.
Comment 14 Richard Yao (RETIRED) gentoo-dev 2012-05-06 19:18:14 UTC
Something broke pkg-config in Gentoo/FreeBSD. `pkg-config --libs openssl` returns the following, which causes a configure failure in dev-libs/openssl:

Package pÀ was not found in the pkg-config search path.
Perhaps you should add the directory containing `pÀ.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pÀ' found

Setting PKG_CONFIG_PATH=/usr/lib64/pkgconfig in the environment before attempting to merge it will permit configure to pass. Then there are further build errors that need to be addressed.

The following will permit net-misc/openssh-6.0_p1 to install without any build failures:

env EXTRA_ECONF='--disable-utmp --disable-wtmp' PKG_CONFIG_PATH=/usr/lib64/pkgconfig emerge openssh

emerge will print the following warning at the end of an emerge:

 * Found a non POSIX test construction in a configure script
 * The configure checks of this package may not function properly
 * Please report this on Gentoo Bugzilla in Gentoo/Alt product for component FreeBSD.
 * http://bugs.gentoo.org/enter_bug.cgi?product=Gentoo%2FAlt&component=FreeBSD&op_sys=FreeBSD

Lastly, with regard to utmp and wtmp, Wikipedia claims the following:

1. utmp and wtmp are extensions to UNIX that are not implemented on FreeBSD.
2. utmpx is an extension of the extension by Sun Microsystems.
3. utmpx was included in the POSIX standard.
4. FreeBSD 9 added support for utmpx

http://en.wikipedia.org/wiki/Utmp

It looks like the right thing to do will be to disable utmp and wtmp unconditionally on FreeBSD and disable utmpx on FreeBSD 8 and earlier.
Comment 15 Naohiro Aota gentoo-dev 2012-05-14 21:19:16 UTC
(In reply to comment #14)
> Something broke pkg-config in Gentoo/FreeBSD. `pkg-config --libs openssl`
> returns the following, which causes a configure failure in dev-libs/openssl:
> 
> Package pÀ was not found in the pkg-config search path.
> Perhaps you should add the directory containing `pÀ.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'pÀ' found
> 
> Setting PKG_CONFIG_PATH=/usr/lib64/pkgconfig in the environment before
> attempting to merge it will permit configure to pass. Then there are further
> build errors that need to be addressed.

Didn't have that error here on x86-fbsd. May be another issue? Anyone has this on amd64-fbsd?
Comment 16 Naohiro Aota gentoo-dev 2012-05-14 21:23:19 UTC
Created attachment 311795 [details, diff]
autoconf patch to disable utmp and wtmp

(In reply to comment #14)
> Lastly, with regard to utmp and wtmp, Wikipedia claims the following:
> 
> 1. utmp and wtmp are extensions to UNIX that are not implemented on FreeBSD.
> 2. utmpx is an extension of the extension by Sun Microsystems.
> 3. utmpx was included in the POSIX standard.
> 4. FreeBSD 9 added support for utmpx
> 
> http://en.wikipedia.org/wiki/Utmp
> 
> It looks like the right thing to do will be to disable utmp and wtmp
> unconditionally on FreeBSD and disable utmpx on FreeBSD 8 and earlier.

utmp and wtmp are not auto-enabled/auto-disabled in the autoconf script. They are disabled one by one according to CHOST value. We can add these lines to the autoconf script to disable them.
Comment 17 Richard Yao (RETIRED) gentoo-dev 2012-05-14 21:31:52 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > Something broke pkg-config in Gentoo/FreeBSD. `pkg-config --libs openssl`
> > returns the following, which causes a configure failure in dev-libs/openssl:
> > 
> > Package pÀ was not found in the pkg-config search path.
> > Perhaps you should add the directory containing `pÀ.pc'
> > to the PKG_CONFIG_PATH environment variable
> > No package 'pÀ' found
> > 
> > Setting PKG_CONFIG_PATH=/usr/lib64/pkgconfig in the environment before
> > attempting to merge it will permit configure to pass. Then there are further
> > build errors that need to be addressed.
> 
> Didn't have that error here on x86-fbsd. May be another issue? Anyone has
> this on amd64-fbsd?

It was a bug in pkgconf 0.4. nenolod fixed it a few hours after I provided him with traces from truss. Strangely, switching from pkgconf to pkg-config did not appear to remove the bug when I was debugging my install, but I assume that was due to some error on my part.
Comment 18 Naohiro Aota gentoo-dev 2012-05-14 21:32:29 UTC
Created attachment 311797 [details, diff]
simpe patch to fix non POSIX test construction

(In reply to comment #14)
> emerge will print the following warning at the end of an emerge:
> 
>  * Found a non POSIX test construction in a configure script
>  * The configure checks of this package may not function properly
>  * Please report this on Gentoo Bugzilla in Gentoo/Alt product for component
> FreeBSD.
>  *
> http://bugs.gentoo.org/enter_bug.
> cgi?product=Gentoo%2FAlt&component=FreeBSD&op_sys=FreeBSD

# cd /var/tmp/portage/net-misc/openssh-6.0_p1/work/openssh-6.0p1
# grep test configure|grep ==
       test "x$have_seccomp_filter" == "x1" && \
Comment 19 SpanKY gentoo-dev 2012-05-17 04:32:20 UTC
Comment on attachment 311797 [details, diff]
simpe patch to fix non POSIX test construction

i had sent this patch upstream some time ago, but i guess it hasn't been applied.  i added it to the 6.0_p1 ebuild now.
Comment 20 Richard Yao (RETIRED) gentoo-dev 2012-05-29 01:58:44 UTC
Running `mkdir -p /etc/portage/env/net-misc && echo "EXTRA_ECONF='--disable-utmp --disable-wtmp'" > /etc/portage/env/net-misc/openssh` is sufficent to workaround this problem in net-misc/openssh-6.0_p1 on Gentoo FreeBSD 9.
Comment 21 Richard Yao (RETIRED) gentoo-dev 2012-05-29 02:58:22 UTC
Created attachment 313463 [details, diff]
A patch for the openssh-6.0_p1.ebuild to solve this problem

I have attached a patch for the ebuild that addresses this problem on Gentoo FreeBSD 9. Gentoo FreeBSD 8 is still affected, but I am undecided on whether or not it is a good idea to fix it given the need to either turn off utmpx on Gentoo FreeBSD 9 or implement more complicated logic to make this decision. I will let others decide that.
Comment 22 Richard Yao (RETIRED) gentoo-dev 2012-05-29 03:49:50 UTC
Created attachment 313473 [details, diff]
Configure script patch to unconditionally disable utmp and wtmp on FreeBSD

After conferring with naota on this, both of us agreed that it would be best to do this inside the configure script, so I have rewritten my patch as a patch to the ./configure script.
Comment 23 Richard Yao (RETIRED) gentoo-dev 2012-05-29 08:10:41 UTC
Comment on attachment 313473 [details, diff]
Configure script patch to unconditionally disable utmp and wtmp on FreeBSD

It seems that naota beat me to writing this and I did not notice. I am marking my patch obsolete.
Comment 24 Richard Yao (RETIRED) gentoo-dev 2012-05-29 08:13:15 UTC
Comment on attachment 305875 [details, diff]
sample patch for openssh-5.9_p1-r4.ebuild

I am also marking nigoro's patch as obsolete because naota's ./configure script patch takes care of this.
Comment 25 Richard Yao (RETIRED) gentoo-dev 2012-05-29 08:36:12 UTC
Fix committed to CVS with Chainsaw's approval.
Comment 26 SpanKY gentoo-dev 2012-05-31 00:46:36 UTC
(In reply to comment #25)

did you send this upstream ?  there's a bugzilla for openssh ...
Comment 27 Richard Yao (RETIRED) gentoo-dev 2012-05-31 01:20:02 UTC
(In reply to comment #26)
> (In reply to comment #25)
> 
> did you send this upstream ?  there's a bugzilla for openssh ...

I did not send this upstream. naota wrote this patch, but I do not know if he sent it upstream.
Comment 28 Naohiro Aota gentoo-dev 2012-05-31 11:17:39 UTC
Sorry, my patch was totally wrong. Upstream won't accept it. We should revert it and apply proper fix.

In configure.ac:
> if test -z "$conf_utmp_location"; then
> 	if test x"$system_utmp_path" = x"no" ; then
> 		for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
> 			if test -f $f ; then
> 				conf_utmp_location=$f
> 			fi
> 		done
> 		if test -z "$conf_utmp_location"; then
> 			AC_DEFINE([DISABLE_UTMP])
> 		fi
> 	fi
> fi
> if test -n "$conf_utmp_location"; then
> 	AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
> 		[Define if you want to specify the path to your utmp file])
> fi

This code try to detect system utmp path and set detected path to CONF_UTMP_FILE. 

In defines.h:
> #ifndef UTMP_FILE
> #  ifdef _PATH_UTMP
> #    define UTMP_FILE _PATH_UTMP
> #  else
> #    ifdef CONF_UTMP_FILE
> #      define UTMP_FILE CONF_UTMP_FILE
> #    endif
> #  endif
> #endif
...
> #if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN)
> #  define USE_LOGIN
> 
> #else
...
> #  if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
> #    define USE_UTMP
> #  endif

When CONF_UTMP_FILE is set, this code defines USE_UTMP and causes utmp error. wtmp is also detected and set USE_WTMP in the same manner.

FreeBSD-9.0 obsolete utmp and wtmp, however utmp file and wtmp file still exist after updating from -8.x. These obsoleted files confuse the configure script to use utmp and wtmp.

ok, we should do

- disable utmp and wtmp by adding configure parameter
or
- detect these old files and remove them in pkg_setup() phase

Removing /var/run/utmp and /var/log/wtmp resolved the compilation error here.
Comment 29 Yuta SATOH 2012-12-29 17:06:14 UTC
(In reply to comment #28)
> FreeBSD-9.0 obsolete utmp and wtmp, however utmp file and wtmp file still
> exist after updating from -8.x. These obsoleted files confuse the configure
> script to use utmp and wtmp.
> 
> ok, we should do
> 
> - disable utmp and wtmp by adding configure parameter
> or
> - detect these old files and remove them in pkg_setup() phase
> 
> Removing /var/run/utmp and /var/log/wtmp resolved the compilation error here.

I've updated the Upgrade Guide on wiki.
added the steps to delete old files related to utmp.

http://wiki.gentoo.org/wiki/Gentoo_FreeBSD#Updating_FreeBSD_userland

FYI,
http://svnweb.freebsd.org/base/releng/9.1/UPDATING?r1=201879&r2=202219
Comment 30 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-18 01:14:54 UTC
patch merged to 6.1_p1-r1
Comment 31 Yuta SATOH 2013-01-18 16:42:48 UTC
@robbat2
I've checked openssh-6.1_p1-r1.ebuild.
And I have noticed that attachment 305875 [details, diff] patch has been applied.

This problem has been fixed in openssh-6.0 (please see comment #11).
So, I believe that FreeBSD-specific settings are not required.

Please remove it.