with 3.4.x versions of samba and same config options and environment - normal compilation. but in 3.5.x versions: ===> build samba for 64-bit cd /big1/home/devel/build/net/samba/64/samba-3.5.2/source3; /bin/env CONFIG_SHELL="/bin/bash" SHELL="/bin/sh" PATH="/bin:/usr/bin:/usr/ccs/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/gcc/bin:/big1/home/devel/ports/Tools:/opt/SUNWspro/bin" TMP="/big1/home/devel/tmp" CC="gcc -m64 -mcpu=v9" CXX="g++ -m64 -mcpu=v9" LD_RUN_PATH="/usr/local/lib/64" CPPFLAGS="-D_LARGEFILE64_SOURCE -D_REENTRANT -I/usr/local/include -I/usr/X/include -DLDAP_DEPRECATED" CFLAGS="-m64 -mcpu=v9 -D_LARGEFILE64_SOURCE -D_REENTRANT -I/usr/local/include -I/usr/X/include -DLDAP_DEPRECATED -Os -pipe " CXXFLAGS="-m64 -mcpu=v9 -D_LARGEFILE64_SOURCE -D_REENTRANT -I/usr/local/include -I/usr/X/include -DLDAP_DEPRECATED -Os -pipe " LDFLAGS="-L/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/local/lib/sparcv9" LDEMULATION="elf64_sparc" /usr/local/bin/gmake Using CFLAGS = -I/usr/local/include -lldap_r -I/usr/local/include -I. -I/big1/home/devel/build/net/samba/64/samba-3.5.2/source3 -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 -D_LARGEFILE64_SOURCE -D_REENTRANT -I/usr/local/include -I/usr/X/include -DLDAP_DEPRECATED -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLDAP_DEPRECATED -DSUNOS5 -I/big1/home/devel/build/net/samba/64/samba-3.5.2/source3/lib -I.. -I../source4 -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3 PICFLAG = -fPIC LIBS = -lsendfile -lresolv -lrt -lnsl -lsocket -liconv -laio LDFLAGS = -pie -L/usr/local/lib/sparcv9 -Wl,-z,ignore -L/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/local/lib/sparcv9 -lthread -R/usr/local/lib/sparcv9 -L/usr/local/lib/sparcv9 -L./bin DYNEXP = LDSHFLAGS = -G -L/usr/local/lib/sparcv9 -Wl,-z,ignore -L/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/local/lib/sparcv9 -lthread -R/usr/local/lib/sparcv9 -L/usr/local/lib/sparcv9 -L./bin -lc -Wl,-z,defs SHLIBEXT = so SONAMEFLAG = -Wl,-soname= mkdir bin 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 /big1/home/devel/build/net/samba/64/samba-3.5.2/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/4.4.3/sparcv9/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 *** Error code 2 Stop. =================== with dirty workaround void main(void) {} in ../lib/talloc/talloc.c ..lib/tdb/common/tdb.c compilation continues, but stumble on libnetapi =============================================== creating /big1/home/devel/build/net/samba/64/samba-3.5.2/source3/exports/libnetapi.syms Linking shared library bin/libnetapi.so.0 ld: warning: option -o appears more than once, first setting taken ld: fatal: symbol `main' is multiply-defined: (file bin/libtalloc.a(talloc.o) type=FUNC; file bin/libtdb.a(tdb.o) type=FUNC); ld: fatal: File processing errors. No output written to bin/libnetapi.so.0 collect2: ld returned 1 exit status gmake: *** [bin/libnetapi.so.0] Error 1 *** Error code 2
this is a braindead gcc library on Solaris. If you can't get a sane gcc version on Solaris which does not have an unresolved main symbol, you can export LDFLAGS=-Wl,-z,nodefs and then run configure/make again. On Solaris you're better advised to use the Sun Studio compiler anyway.
actually, while looking into what kind of problem gcc has on Solaris, I notived that on Solaris the compiler flags are screwed up quite a bit. The shared libs are linked like binaries - so finally gcc is not so wrong to expect a main symbol. The composition of C- and LDFLAGS really needs some cleanups.
fixed in master by 1969b4acc3fd7c124e288d0495b9b4665d4b42db This needs to get in to 3.5.
to fix numerous "multiple -o option" warnings on gcc on Solaris also this one should be picked to 3.5: 358a3855c20153d7fe742ca2e6b9bd8a9c92e525
Björn, can you add git format-patch output for the backports?
git cherry-pick the two mentioned commits without further twaeks should work without a problem.
Ok
Pushed to v3-5-test. Closing out bug report. Thanks!
Compiling libads/ldap_utils.c Compiling libads/ldap_schema.c Compiling libads/util.c Compiling libads/ndr.c Compiling lib/privileges_basic.c Compiling auth/token_util.c creating /big1/home/devel/build/net/samba/64/samba-3.5.3/source3/exports/libnetapi.syms Linking shared library bin/libnetapi.so.0 Undefined first referenced symbol in file main /usr/local/lib/sparcv9/libwbclient.so ld: fatal: Symbol referencing errors. No output written to bin/libnetapi.so.0 collect2: ld returned 1 exit status gmake: *** [bin/libnetapi.so.0] Error 1 *** Error code 2
is the /usr/local/lib/sparcv9/libwbclient.so from a previously old broken build your problem? Can you please try the build in a "cleaned up" environment?
http://build.samba.org/?function=View+Build;host=sunX;tree=samba_3_next;compiler=gcc as the build farm shows that it actually works, I'll close this again. Thanks for testing!