Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110278 - Samba binaries fail to execute because they get compiled as shared objects.
Summary: Samba binaries fail to execute because they get compiled as shared objects.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Other (show other bugs)
Hardware: x86 FreeBSD
: High blocker (vote)
Assignee: Gentoo's SAMBA Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-23 16:09 UTC by Javier Villavicencio (RETIRED)
Modified: 2006-04-12 10:50 UTC (History)
1 user (show)

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


Attachments
samba-nopie.patch (samba-nopie.patch,401 bytes, patch)
2005-10-28 02:14 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Villavicencio (RETIRED) gentoo-dev 2005-10-23 16:09:35 UTC
On FreeBSD it seems that the compiler flag -pie used when linking some of the
executables, creates a shared object binary:

[/ #] file /usr/bin/smbclient
/usr/bin/smbclient: ELF 32-bit LSB shared object, Intel 80386, version 1
(FreeBSD), for FreeBSD 5.4, stripped

which should be something like:
[/ #] file /usr/sbin/smbd
/usr/sbin/smbd: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for
FreeBSD 5.4, dynamically linked (uses shared libs), for FreeBSD 5.4, not stripped


Reproducible: Always
Steps to Reproduce:
1.emerge net-fs/samba
2.try to run one of the distribution programs, ie: /usr/bin/smbclient


Actual Results:  
[/ #] smbclient
-/bin/bash: /usr/bin/smbclient: cannot execute binary file


Expected Results:  
Show the list of options since i didn't pass any.

Portage 2.0.53_rc6
(!/usr/local/portage/gentoo-freebsd/profiles/default-bsd/fbsd/5.4/x86, gcc-,
freebsd-lib-5.4-r2, 5.4-RELEASE i386)
=================================================================
System uname: 5.4-RELEASE i386 i386
Gentoo/FreeBSD: FreeBSD version 5.4-RELEASE; Gentoo base version 0.7
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.13
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.15
sys-devel/libtool:   1.5.20
virtual/os-headers:  5.4
ACCEPT_KEYWORDS="x86 x86-fbsd ~x86 ~x86-fbsd"
AUTOCLEAN="yes"
CBUILD="i686-gentoo-freebsd5.4"
CFLAGS="-O2 -march=pentium3 -maccumulate-outgoing-args -momit-leaf-frame-pointer
-fomit-frame-pointer -fweb -frename-registers -fpeel-loops -fmove-all-movables
-pipe"
CHOST="i686-gentoo-freebsd5.4"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium3 -frename-registers -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages sandbox"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://distfiles.gentoo.org
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/usr/local/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/gentoo-freebsd"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86-fbsd acpi apache2 berkdb bitmap-fonts bzip2 gd gdbm gif htdocs imlib
insecure-drivers ipsec ithreads jpeg mmx mpm-worker nat ncurses netgraph opengl
pcre perl pf php png postgres python readline ruby silvercity sqlite sse ssl
symlink threads tiff truetype truetype-fonts type1-fonts urandom vhosts winbind
xv zlib userland_BSD kernel_FreeBSD elibc_FreeBSD"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-24 21:45:27 UTC
I've added a simple check to gentoo-alt overlay's ebuild that tests the CHOST used.
Can you give that a try and see if that works?
Comment 2 Javier Villavicencio (RETIRED) gentoo-dev 2005-10-25 06:34:22 UTC
Still links the binaries with -pie as 

[/usr/local/portage #] file /usr/sbin/smbd
/usr/sbin/smbd: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
for FreeBSD 5.4, stripped

And, because of that:
[09:44:11]
[/usr/local/portage #] smbclient -L //192.168.0.1/
-su: /usr/bin/smbclient: cannot execute binary file
Comment 3 Javier Villavicencio (RETIRED) gentoo-dev 2005-10-25 06:41:49 UTC
Just trying again to see the error:

/usr/local/portage/gentoo-freebsd/net-fs/samba/samba-3.0.20b.ebuild: line 106:
--with-expsam=pgsql, --with-manpages-langs=en --without-ldapsam --with-winbind
--with-shared-modules=idmap_rid --disable-pie: command not found

in that line:
[[ ${CHOST} == *-*bsd* ]] && "${myconf} --disable-pie"

and it should be
[[ ${CHOST} == *-*bsd* ]] && myconf="${myconf} --disable-pie"
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-25 07:05:33 UTC
Okay, I should *not* try to get things done without sleep, does it work after 
fixing the ebuild? 
Comment 5 Javier Villavicencio (RETIRED) gentoo-dev 2005-10-25 10:21:12 UTC
Emerges fine, works fine:

[14:18:47]
[/root #] smbclient -L //192.168.0.1 -U javier
Password: 
Domain=[STRONGHOLD] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       IPC remota
        ADMIN$          Disk      Admin remota
        C$              Disk      Recurso predeterminado
        D$              Disk      Recurso predeterminado
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-28 02:13:35 UTC
Moving that to samba team :) 
Comment 7 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-28 02:14:34 UTC
Created attachment 71618 [details, diff]
samba-nopie.patch

Here is the patch that works (currently on gentoo-alt overlay). Is okay if I
commit it?
Comment 8 Christian Andreetta (RETIRED) gentoo-dev 2005-10-28 06:03:51 UTC
good work doesn't need permission: go ahead :-)
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-29 04:10:30 UTC
Thanks, I've committed it now.