Bug 1065 - Incorrect compiler/linker options
Summary: Incorrect compiler/linker options
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.2
Hardware: All HP-UX
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-11 19:29 UTC by Richard Allen
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 Richard Allen 2004-02-11 19:29:24 UTC
Samba 3.0.2 no longer builds out of the box on HP-UX.  In the past, various
tricks have been needed to get samba to compile with HP's ANSI C compiler, but
now those tricks are not possible.

HP's cc needs the -Aa or -Ae to be fully ANSI compliant.  From the man page:

      -Amode         Specify the compilation standard to be used by the
                     compiler.  mode can be one of the following letters:

                        a    Compile under ANSI mode (ANSI programming
                             language C standard ISO 9899:1990).  When
                             compiling under ANSI mode, the header files
                             would define only those names (macros and
                             typedefs) specified by the Standard. To access
                             macros and typedefs that are not defined by the
                             ANSI Standard but are provided by the HP-UX
                             Operating System, define the symbol
                             _HPUX_SOURCE; or use the extension option
                             described below.

                        e    Extended ANSI mode.  Same as -Aa
                             -D_HPUX_SOURCE +e.  This would define the names
                             (macros and typedefs) provided by the HP-UX
                             Operating System and, in addition, allow the
                             following extensions: $ characters in
                             identifier names, sized enums, sized bit-
                             fields, and 64-bit integral type long long.
                             Additional extensions may be added to this
                             option in the future.

There is also a -Ac (K&R mode), but it does not apply here.

I've always used -Ae.   up to 3.0.2, all thats needed for a successful Samba
compile is export CCOPTS="-Ae" (cc appends whatever is in $CCOPTS to the cc
commandline) but now that is not enough.

During link time, I get:

/usr/bin/ld: Unrecognized argument: -Wl,+s,+b,/og/HP-UX/lib

(Im compiling with --prefix=/og/HP-UX)

The -W switch is a way to send the other tools involved in compiling (cpp,
assembler and linker) arguments from the cc command line.  -Wl means that the
following comma seperated list of arguments is for the linker.

The linker switches +s and +b mean:

           +s   Indicates that at run-time, the shared library loader can
                use the environment variable SHLIB_PATH and LD_LIBRARY_PATH
                (64-bit only) to locate shared libraries needed by the
                executable output file that were specified with either the
                -l or -l: option. The environment variables should be set to
                a colon-separated list of directories. If both +s and +b are
                used, their relative order on the command line indicates
                which path list will be searched first (see the +b option).

           +b path_list   Specify a colon-separated list of directories
                          (embedded path) to be searched at program run-time
                          to locate shared libraries needed by the
                          executable output file that were specified with
                          either the -l or -l: option.  An argument
                          consisting of a single colon (:) indicates that ld
                          should build the list using all the directories
                          specified by the -L option and the LPATH
                          environment variable (see the +s option).

Ergo, +b, is an illegal path.
Under HP-UX when a binary is linked to use a shared library, the shared librarys
path/location is hardcoded into the binary.  This is a common problem when
linking binaries to a yet un installed shared library.
The +s and +b switches make it possible to specify where the binary should pick
up the needed shared libraries.

So for now I reverted the LD flags back to what 3.0.1 had and now it compiled
nicely.

One last thing.  While compiling under HP-UX with HP's ANSI C compiler in ANSI
mode, every single .c file in the samba code complains about:

cpp: "/usr/include/sys/xti.h", line 503: warning 2001: Redefinition of macro
TCP_NODELAY.
cpp: "/usr/include/sys/xti.h", line 504: warning 2001: Redefinition of macro
TCP_MAXSEG.
Comment 1 Tim Potter 2004-09-13 21:11:22 UTC
Fixed in SAMBA_3_0 branch - should be in the 3.0.8 release.
Comment 2 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:16:57 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.