Operating System - HP-UX
1846080 Members
3240 Online
110253 Solutions
New Discussion

Re: Creating binary distribution after build Apache source???

 
John Wolf
Occasional Contributor

Creating binary distribution after build Apache source???

All,

I am trying to build a self contained Apache 2.0.43 binary
distribution by building the 2.0.43 source on HPUX 11.11. I have run
configure with a prefix parameter pointing to where the binaries
should be installed when the installer is run, if I understand
correctly this parameter only affects the make install command and not
necessarily the binaries that result from the binbuild.sh command. In
addition, I also enable DSO and compile a handful of modules. Anyhow,
after I run configure command, I run make to make the executables.
For whatever reason, if I do a configure, a make, then a make install,
the resulting installation is appropriately setup and the static paths
point to the libraries underneath the target directory

The problem arises when I make the binary distribution(using
binbuild.sh) in that there are static embedded paths in the httpd
file, pointing to libaprutil.sl.9, libexpat.sl.1, and libapr.sl.9,
they can be viewed via executing 'chatr httpd' from the /bin, and they are pointing back to the
directory from which I built the binaries. This configuration will
not work if I need to install the binary distribution on other
machines as they are dependent on these library files being in
particular directories on the machine that is to run the web server.

Does anyone know what file(s) I need to edit before doing binbuild.sh
to get the correct(/lib) static linkings embedded into the httpd exe?

Thanks,

-John
6 REPLIES 6
Tom Jackson
Valued Contributor

Re: Creating binary distribution after build Apache source???

John:

Here's an already built version 2.0.35 for 11.11 -> http://hpux.cs.utah.edu/hppd/hpux/Networking/WWW/apache2-2.0.35/

It may be easier that building your own.

Tom
Christopher Caldwell
Honored Contributor

Re: Creating binary distribution after build Apache source???

You can change the arguments to the linker so that the libraries get generated with appropriate flags. Pay particular attention to
+b Specify a colon-separated list of directories 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).

and

+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).


and/or you can use chatr to edit the existing library files (again see +s and +b).

Generally, you set LDFLAGS during configure - you can also pass flags to the linker through CFLAGS.
John Wolf
Occasional Contributor

Re: Creating binary distribution after build Apache source???

Tom:

Thanks for the link, I've actually already grabbed the HP distribution of the 2.0.43 version of Apache and it runs fine. My dilemma is that our QA Process requires that we put the Apache installation in an /apps folder, and all DSO's and static libraries need to run out of their respective folders underneath the installed directory. With the HP distributions, you are required to jump through too many hoops to get a 'custom' installation/configuration. My goal here is to simplify installation so that the user can get to the task at hand.

I have tried the 2.0.43 binary distribution from Apache.org and it seems to have the same issue I am dealing with. It looks for the library files in the home directory of the individual who made the binary distribution.

Christopher :

How do I go about changing the arguments to the linker? Specifically, in what config file can they be found? Forgive my lack of knowledge but I am a 2+ month newbie to the unix/linux world and this is the very first time I've ever built something on a unix box.

I have dug around enough to learn about SHLIB_PATH and have used chatr to disable the embedded path's in httpd and enable the dynamic path, I have then exported SHLIB_PATH and pointed it to the lib folder containt the library files that htppd is trying to load, however it all seems to be ignored and complains that it can't find the library files in . I also read somewhere that even if these items are changed in the executable that the static linkings will supersede the dynamic shared linkings and the dynamic configurations will be ignored.

Thanks,

-John
Christopher Caldwell
Honored Contributor

Re: Creating binary distribution after build Apache source???

==>How do I go about changing the arguments to the linker? Specifically, in what config file can they be found? Forgive my lack of knowledge but I am a 2+ month newbie to the unix/linux world and this is the very first time I've ever built something on a unix box.

There's many ways; here's a few; YMMV.

Set LDFLAGS in your environment:
LDFLAGS=+b
export LDFLAGS

Find the link line in the Makefile, add your flags there.

See if ./configure supports coercion of LDFLAGS



==>I have dug around enough to learn about SHLIB_PATH and have used chatr to disable the embedded path's in httpd and enable the dynamic path, I have then exported SHLIB_PATH and pointed it to the lib folder containt the library files that htppd is trying to load, however it all seems to be ignored and complains that it can't find the library files in . I also read somewhere that even if these items are changed in the executable that the static linkings will supersede the dynamic shared linkings and the dynamic configurations will be ignored.

Don't forget to look at the executable and all of the dependents for library path information (e.g. chatr httpd, get a list of all dependent .sls - make sure httpd and all dependent .sl have the correct path information).
John Wolf
Occasional Contributor

Re: Creating binary distribution after build Apache source???

Ok, I have found that configure will take an environment variable (LDFLAGS) previous to the configure command. I have created a script that adds this environment variable, and calls configure with the --enable-mods-shared flag with a list of shared modules. I am still unsure whether I am passing the appropriate flag to LDFLAGS though. I tried the +b that you suggested and the configure script complained. Can you tell me what +b does? I did some googling of LDFLAGS and noticed that some people use the -L flag. I did that and passed the desired target directory in quotes, i.e. "/apps/apache2" and the configure script completed without errors. However my problems are still not solved, read on...

I run this script, run the make, then the make install. When I do this, the httpd executable gets linked appropriately in that it looks for the static library files in the directory that I am passing to the configure script. However I was able to achieve this before I used the LDFLAGS environment variable.

From what I can tell though, the linker puts the library path references based on the value of prefix and not necessarily on the value of LDFLAGS.

The point is that when I do the make install, everything goes fine. The problem is that when I run build/binbuild.sh to create the *.tar.gz binary distribution. When I do this, the resulting binary distribution in the *.tar.gz file that is created is not configured properly in that when I run install-bindist.sh , the static links to the library files in httpd still point where the files were originally linked from.

What I am still failing to understand is how the binary distribution is differing from what I am getting when I run the make install command.

There is an error that I see during the build phase that has me suspicious as a possible cause of the problem. It says something to the effect that the system doesn't like uninstalled shared libraries and that httpd will be relinked at install time. I am not sure what this means...

Christopher Caldwell
Honored Contributor

Re: Creating binary distribution after build Apache source???

It'll help you a bit if you read the man page for the linker (man ld) - there's a bunch of options that will help your problem - but the options are somewhat dependent on what you're trying to do.

You wouldn't want to specify +b by itself ... +b requires a path_list:

+b Specify a colon-separated list of directories 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).