Bug 975 - Mistakes WRT shared libraries in configure/makefile
Summary: Mistakes WRT shared libraries in configure/makefile
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.4
Hardware: All HP-UX
: P2 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-15 13:25 UTC by Ryan Novosielski (mail bounces back)
Modified: 2005-08-24 10:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Novosielski (mail bounces back) 2004-01-15 13:25:10 UTC
I'm not sure where the root of these problems are -- forgive me, I'm not too
familiar with the sequence (autoconf,configure,Makefile). At present, however,
there are two mistakes in the HP-UX build of Samba 3 (and earlier versions) with
regards to compiler/linker syntax.

1) The first problem is visible in configure and results in the shared library
test reporting "building shared libraries actually works... no". It begins at
the section starting on line 18071 of samba-3.0.1/source/configure:

$CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o \
        shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c && \
        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" \
        shlib.$PICSUFFIX && \
        ac_cv_shlib_works=yes

My understanding of the variable values at this point (with the possible
exception of CFLAGS and CPPFLAGS, which would most likely be irrelevant) is the
following:

PICSUFFIX="po"
CC="cc"
CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE
-D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4
-DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
CFLAGS="-Ae" 
PICFLAGS="+z"
LDSHFLAGS="-B symbolic -b -z"
SHLIBEXT="sl"

Resulting in the following execution of commands:

cc -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1
-D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL -Ae +z -c -o
shlib.po ./tests/shlib.c
cc -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1
-D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL -Ae -B symbolic -b
-z -o shlib.sl shlib.po

As you can see above, this results in cc being run with "-B symbolic". This is
incorrect syntax, at least with my compiler. I am not certain how to correct
this problem. That particular line should read "-Wl,-B symbolic" at a bare
minimum, as "-B symbolic" is a linker command, not a compiler command. It is
possible that the others need to be passed to the linker as well, however -b and
-z are acceptable in both ld and cc (and appear to have nearly identical or
perhaps identical functions). Run as it is written, one gets the following error:

cc: warning 422: Unknown option "-B" ignored.
/usr/ccs/bin/ld: Can't open symbolic
/usr/ccs/bin/ld: No such file or directory

...an error which goes away with the change of $LDSHFLAGS to read -Wl,-B
symbolic... at the beginning.

2) The second problem is just the opposite -- a -Wl is included someplace where
it does not belong. Again, at least on HP-UX, the flag is given to the wrong
program (the linker instead of the compiler). This error is on line 1169 of the
samba-3.0.1/source/Makefile (or Makefile.in). Here is the line:

@$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_PICOOBJ) -lpam $(DYNEXP) $(LIBS) -lc
$(LDAP_LIBS) $(KRB5LIBS)

Where, as I understand it, the relevant values are as follows:

SHLD=/usr/bin/ld
LDSHFLAGS="-B symbolic -b -z"
DYNEXP=-Wl,-E

...yielding a situation where /usr/bin/ld ... -Wl,-E ... is being run. The
proper syntax for ld on HP-UX is /usr/bin/ld ... -E ..., -Wl only being used
prior to a linker command passed via the compiler. I don't know the proper fix
here either, as I have not gone through and checked where else $DYNEXP is used
and if a simple switch to "-E" would fix it -- I suspect not. The error that
occurs here is as follows:

Linking shared library bin/pam_smbpass.sl
/usr/bin/ld: Unrecognized argument: -Wl,-E
/usr/bin/ld: Usage:  /usr/bin/ld [options] [flags] files
gmake: *** [bin/pam_smbpass.sl] Error 1

...this error goes away if "-Wl,-E" is changed to "-E", but I suspect there is a
more elegant solution that the maintainers may have.

The build environment is: 
HP-UX njmsa B.11.11 U 9000/800 627349383 unlimited-user license

Thank you for your time on this problem.
Comment 1 Ryan Novosielski (mail bounces back) 2004-03-15 08:18:21 UTC
This bug is now present in 3.0.2a as well.
Comment 2 Ryan Novosielski (mail bounces back) 2005-02-07 14:06:02 UTC
This was eventually fixed. Don't remember what version. I suspect 3.0.8.
Comment 3 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:16:45 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.