I tried to compile openssh with the following flags: [ebuild R ] net-misc/openssh-4.3_p2-r2 USE="-X* -X509 -chroot hpn -ipv6 -kerberos -ldap -libedit pam (-selinux) -sftplogging -skey -smartcard static tcpd" 0 kB This failed: ./libssh.a(canohost.o): In function `get_canonical_hostname': canohost.c:(.text+0x654): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func': (.text+0x328): undefined reference to `dlsym' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func': (.text+0x413): undefined reference to `dlerror' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var': (.text+0x4a2): undefined reference to `dlsym' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var': (.text+0x58a): undefined reference to `dlerror' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload': (.text+0x5fc): undefined reference to `dlclose' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_load': (.text+0x6e1): undefined reference to `dlopen' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_load': (.text+0x74e): undefined reference to `dlclose' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libcrypto.a(dso_dlfcn.o): In function `dlfcn_load': (.text+0x78b): undefined reference to `dlerror' collect2: ld gab 1 als Ende-Status zurck make: *** [sshd] Fehler 1 I tried re-compiling glibc and upgraded to dev-libs/openssl-0.9.8b. After the upgrade to openssl-0.9.8b, I ran # revdep-rebuild --library libssl.so.0.9.7 # revdep-rebuild --library libcrypto.so.0.9.7 I still get this error. (chroot1) dewup-ww02 lib # emerge --info Portage 2.1.1_rc1-r4 (default-linux/x86/2006.1, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.17-gentoo-r3.05 i686) ================================================================= System uname: 2.6.17-gentoo-r3.05 i686 Intel(R) Xeon(TM) CPU 2.40GHz Gentoo Base System version 1.12.4 Last Sync: Tue, 05 Sep 2006 07:20:01 +0000 ccache version 2.4 [enabled] app-admin/eselect-compiler: 2.0.0_rc2-r1 dev-lang/python: 2.4.3-r3 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.4-r2 dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.18.1 sys-devel/autoconf: 2.13, 2.60 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.17 sys-devel/gcc-config: 1.3.13-r3 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.17 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=pentium4 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -march=pentium4 -pipe" DISTDIR="/Gentoo/portage/distfiles" EMERGE_DEFAULT_OPTS="--alphabetical" FEATURES="autoconfig buildpkg ccache collision-protect distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS=" http://localhost/~vz6tml/gentoo-files http://dewup-ww02.dewup.europe.delphiauto.net/~vz6tml/gentoo-files http://localhost/gentoo-files/ http://dewup-ww02.dewup.europe.delphiauto.net/gentoo-files/ http://localhost/~vz6tml/gentoo-files/ http://cifs-srvr1.europe.delphiauto.net/~vz6tml/Misc._Software/Gentoo/ http://alexander.skwar.name/~askwar/stuff/gentoo/ http://localhost:60081/pub/Mirrors/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://localhost:60080/pub/gentoo/ http://pandemonium.tiscali.de/pub/gentoo/ http://localhost:60082/mirror/rsync.gentoo.org/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ ftp://pandemonium.tiscali.de/pub/gentoo/ http://localhost:60083/pub/linux/distributions/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://localhost:60084/ http://distfiles.gentoo.org/ " LANG="de_DE.utf8" LINGUAS="de" MAKEOPTS="-j3" PKGDIR="/Gentoo/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/Gentoo/portage/tmp" PORTDIR="/Gentoo/portage/tree" PORTDIR_OVERLAY="/Gentoo/portage/local-tree/misc" SYNC="rsync://localhost:10873/gentoo-portage" USE="x86 acl bash-completion berkdb bitmap-fonts cli crypt cups dbus dlloader dri elibc_glibc fam firefox gdbm gnome gpm hal input_devices_evdev input_devices_keyboard input_devices_mouse input_devices_void isdnlog jikes kdeenablefinal kdehiddenvisibility kernel_linux libg++ linguas_de mmx ncurses nis nls noaudio nptl nptlonly offensive pam pcre perl ppds pppd python readline reflection samba session spl sse sse2 ssl tcpd tiff truetype-fonts type1-fonts udev unicode userland_GNU video_cards_ati video_cards_none video_cards_vesa video_cards_vga xorg zlib" Unset: CTARGET, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
I upgraded to openssl-0.9.8c - no change, still the same error.
With USE=-static, I could compile openssh.
fixed in cvs
I don't think using pkg-config to figure out paths and libs is really the right approach for this situation. Consider when ROOT is something other than "/". In that case the linking will either fail, or happen with the wrong libraries. Not sure what the right approach is. ${ROOT}/usr/bin/pkg-config would be nice but that assumes that pkg-config understand non-default ROOT=/somethingelse builds. Perhaps we should test if ROOT="/" and if so use pkg-config, otherwise go with sane defaults (such as linking with -ldl if use static).
you've got a choice ... pkg-config or libtool or nothing pkg-config/libtool not working with ROOT/cross-compiling is a larger issue and not openssh specific in any way