Bug 8732 - Compile error on Solaris 9/SunStudio 11
Summary: Compile error on Solaris 9/SunStudio 11
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.6.3
Hardware: Sparc Solaris
: P5 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
: 9291 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-31 21:59 UTC by Warren
Modified: 2012-10-18 07:12 UTC (History)
3 users (show)

See Also:
metze: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Warren 2012-01-31 21:59:02 UTC
I am attempting to compile Samba on Solaris 9 using the Sun Studio 11 compiler.

My configure is a bit on the ugly side:
CPPFLAGS="-I/usr/local/ssl/include/ -I/usr/local/include/ -I/usr/local/openldap/include/" LDFLAGS="-L/usr/local/ssl/lib/ -L/usr/local/lib/ -L/usr/local/openldap/lib/ -R/usr/local/openldap/lib/ -R/usr/local/samba/lib" ./configure --with-included-popt --with-krb5=/usr/local --disable-swat --disable-cups

Make (on the second run) generates the following output:


Using CFLAGS     = -I../lib/zlib -I/usr/local/include -O -I.  -I/export/home/pkgbuild/pkgs/samba-3.6.3/source3  -I/export/home/pkgbuild/pkgs/samba-3.6.3/source3/../lib/popt -I/export/home/pkgbuild/pkgs/samba-3.6.3/source3/../lib/iniparser/src  -Iinclude -I./include  -I. -I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/talloc -I../lib/tdb/include  -DHAVE_CONFIG_H  -I/usr/local/include -I/usr/local/ssl/include/ -I/usr/local/include/ -I/usr/local/openldap/include/ -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DLDAP_DEPRECATED -DSUNOS5    -I/export/home/pkgbuild/pkgs/samba-3.6.3/source3/lib  -I..  -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3
      PICFLAG    = -KPIC
      LIBS       = -lsendfile -lresolv -lrt -ldl -lnsl -lsocket -lrt
      LDFLAGS    = -L/usr/local/lib -R/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/ssl/lib/ -L/usr/local/lib/ -L/usr/local/openldap/lib/ -R/usr/local/openldap/lib/ -R/usr/local/samba/lib -lthread -L./bin
      DYNEXP     = 
      LDSHFLAGS  = -KPIC -G  -L/usr/local/lib -R/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/ssl/lib/ -L/usr/local/lib/ -L/usr/local/openldap/lib/ -R/usr/local/openldap/lib/ -R/usr/local/samba/lib -lthread -L./bin -lc -Wl,-z,defs
      SHLIBEXT   = so
      SONAMEFLAG = -Wl,-h,
Linking bin/winbind_krb5_locator.so
Undefined                       first referenced
 symbol                             in file
socket                              ./../lib/replace/getifaddrs.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
getaddrinfo                         ../nsswitch/winbind_krb5_locator.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
freeaddrinfo                        ../nsswitch/winbind_krb5_locator.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
inet_pton                           ./../lib/replace/inet_aton.o  (symbol belongs to implicit dependency /lib/libnsl.so.1)
ld: fatal: Symbol referencing errors. No output written to bin/winbind_krb5_locator.so
*** Error code 1



Samba then builds cleanly if I edit the Makefile and add $(LIBS) in the following definition as follows:

bin/winbind_krb5_locator.so: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBWBCLIENT) 
        @echo "Linking $@" 
        @$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBWBCLIENT_LIBS) $(KRB5LIBS) $(LIBS) \ 
                -Wl,-h,`basename $@`
Comment 1 Björn Jacke 2012-05-04 12:11:21 UTC
adding LIBREPLACE_LIBS on that system solves the issue, too? This issue is not reproducible on one of our systems. Can you please verify that adding $LIBREPLACE_LIBS works?
Comment 2 Cory Zito 2012-05-27 03:15:40 UTC
I hit this bug tonight.
  
Samba 3.6.5 / Solaris 9 / Sun Studio 12 compiler

Compiling ../nsswitch/winbind_krb5_locator.c
Linking bin/winbind_krb5_locator.so
Undefined                       first referenced
 symbol                             in file
socket                              ./../lib/replace/getifaddrs.o  (symbol belon
gs to implicit dependency /usr/lib/libsocket.so.1)
getaddrinfo                         ../nsswitch/winbind_krb5_locator.o  (symbol 
belongs to implicit dependency /usr/lib/libsocket.so.1)
freeaddrinfo                        ../nsswitch/winbind_krb5_locator.o  (symbol 
belongs to implicit dependency /usr/lib/libsocket.so.1)
inet_pton                           ./../lib/replace/inet_aton.o  (symbol belong
s to implicit dependency /usr/lib/libnsl.so.1)
ld: fatal: Symbol referencing errors. No output written to bin/winbind_krb5_loca
tor.so
*** Error code 1
make: Fatal error: Command failed for target `bin/winbind_krb5_locator.so'

I added LIBREPLACE_LIBS, as it included the missing -lsocket and -lnsl libraries to the makefile and it allowed me to finish compiling.

I suppose I could have saved 10 minutes if I'd googled first.  Anyway, I'll confirm that just adding in LIBREPLACE_LIBS (-lsocket -lnsl) appears to work just fine.

Here's what my Makefile looks like:

bin/winbind_krb5_locator.so: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) $(LIB
WBCLIENT)
        @echo "Linking $@"
        @$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBWBCLIENT_LI
BS) $(KRB5LIBS) $(LIBREPLACE_LIBS) \
                -Wl,-h,`basename $@`
Comment 3 Björn Jacke 2012-05-29 16:00:53 UTC
Thanks Cory for verifying!

3085225e72c75abf84d7740334459cd971ee4c56 in master fixes this now. Metze, can you please ACK this and reassign to Karo for cherry-picking to 3.6 ?
Comment 4 Stefan Metzmacher 2012-05-29 18:28:26 UTC
(In reply to comment #3)
> Thanks Cory for verifying!
> 
> 3085225e72c75abf84d7740334459cd971ee4c56 in master fixes this now. Metze, can
> you please ACK this and reassign to Karo for cherry-picking to 3.6 ?

Yes, looks good.

Karolin, please cherry-pick -x it applies to v3-6-test fine for me.
Comment 5 Karolin Seeger 2012-05-31 19:24:49 UTC
Pushed to v3-6-test.
Closing out bug report.

Thanks!
Comment 6 Björn Jacke 2012-10-16 06:48:25 UTC
*** Bug 9291 has been marked as a duplicate of this bug. ***
Comment 7 Björn Jacke 2012-10-16 07:14:01 UTC
reopening for the fix in 3.5
Comment 8 Karolin Seeger 2012-10-18 07:12:37 UTC
(In reply to comment #7)
> reopening for the fix in 3.5

Pushed to v3-5-test.
Closing out bug report.

Thanks!