Problem compiling Samba 3.5.1 on Solaris 10 with gcc (3.4.6)

I'm getting this error when 'Linking shared library bin/libtalloc.so.2'... anyone know what's up here?

Using CFLAGS     = -O -I. -I/source/samba-3.5.1/source3 -I/source/samba-3.5.1/source3/../lib/popt -I/source/samba-3.5.1/source3/iniparser/src -Iinclude -I./include  -I. -I. -I./../lib/replace -I./../lib/tevent -I./libaddns -I./librpc -I./.. -I./../lib/talloc -I../lib/tdb/include -DHAVE_CONFIG_H  -I/usr/local/include -I/usr/local/ssl/include -I/usr/sfw/include -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLDAP_DEPRECATED -DSUNOS5  -I/source/samba-3.5.1/source3/lib -I.. -I../source4 -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3
      PICFLAG    = -fPIC
      LIBS       = -lsendfile -lresolv -lrt -lnsl -lsocket -liconv
      LDFLAGS    = -pie  -Wl,-z,ignore -R/usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/sfw/lib -lthread -L./bin
      DYNEXP     = 
      LDSHFLAGS  = -G  -Wl,-z,ignore -R/usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/sfw/lib -lthread -L./bin -lc -Wl,-z,defs
      SHLIBEXT   = so
      SONAMEFLAG = -Wl,-soname=

Compiling ../lib/talloc/talloc.c
Linking non-shared library bin/libtalloc.a
Compiling ../lib/replace/replace.c
Compiling ../lib/replace/snprintf.c
Compiling ../lib/replace/getpass.c
Compiling ../lib/replace/strptime.c
Compiling ../lib/replace/timegm.c
Compiling ../lib/replace/getifaddrs.c
creating /source/samba-3.5.1/source3/exports/libtalloc.syms
Linking shared library bin/libtalloc.so.2
ld: warning: option -o appears more than once, first setting taken
Undefined                       first referenced
 symbol                             in file
main                                /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/crt1.o
ld: fatal: Symbol referencing errors. No output written to bin/libtalloc.so.2
collect2: ld returned 1 exit status
gmake: *** [bin/libtalloc.so.2] Error 1

EDIT: Samba v3.4.7 compiles just fine, so looks like they've broken it moving to v3.5.x!!!

Same problem here, same error. :frowning:
Please update if you find a solution.

Thx.

I see no errors in the 3.4.7 log, just warnings.

With 3.5.1, it seems libtalloc contains a main function which is probably not expected from a library.

To make a shared object, the GCC option is "-shared". It looks like the compilation is using "-G", which is the Sun Studio option to link a shared object.

Anything new? Any workaround?

THX

Regards

Meg

After changing

-G

to

-fPIC -shared

, it compiles, but if i want start the nmbd:

ld.so.1: nmbd: fatal: relocation error: file nmbd: symbol _talloc_free: referenced symbol not found
Killed

Edit: Fixed... nmbd was linked with the false lib

I've not tried the -G option, but I've gone to the 3.4.7 version which does compile, and solves my immediate problems...

However, I'm having these errors in the client log files:

[2010/03/31 14:28:04,  0] lib/util_sock.c:1491(get_peer_addr_internal)
  read_fd_with_timeout: client 0.0.0.0 read error = Transport endpoint is not connected.
  getpeername failed. Error was Transport endpoint is not connected
  read_fd_with_timeout: client 0.0.0.0 read error = Transport endpoint is not connected.

A google, advises to block port 445, but I'm not sure this is a good idea... Does anyone know if I need port 445 for SAMBA to work or not?