Languages and Scripting
Showing results for 
Search instead for 
Did you mean: 

linking error /usr/ccs/bin/ld: Unsatisfied symbols: altzone (data)

David Lyons_2
Occasional Visitor

linking error /usr/ccs/bin/ld: Unsatisfied symbols: altzone (data)

I am trying to compile bash on a HPUX 11.0 server.

It compiles all the modules and the final linking is as follows:

cc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde -L./lib/malloc -L./lib/sh -g -o bash shell.o eval.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o braces.o bracecomp.o bashhist.o bashline.o siglist.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o -lbuiltins -lsh -lreadline -lhistory -ltermcap -lglob -ltilde -lmalloc lib/intl/libintl.a
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (shell.o) was detected. The linked output may not run on a PA 1.x system.
/usr/ccs/bin/ld: Unsatisfied symbols:
altzone (data)
make: *** [bash] Error 1

Now atlzone is in lib/sh/strftime.c
It's defined as...

extern int altzone;

Used here:

* Systems with tzname[] probably have timezone as
* secs west of GMT. Convert to mins east of GMT.
off = -(daylight ? timezone : altzone) / 60;
#else /* !HAVE_TZNAME */
off = -zone.tz_minuteswest;
#endif /* !HAVE_TZNAME */

Now I can undefine HAVE_TZNAME but that results in more errors.

Anyway, I searched the include files for altzone and it's not there.

Have any of you tried building bash on HPUX and if so, did you encounter this build error? If so, how did you resolve it?

A. Clay Stephenson
Acclaimed Contributor

Re: linking error /usr/ccs/bin/ld: Unsatisfied symbols: altzone (data)

In almost all cases, problems like yours result from improper setting of #define's or a failure to download/install all of the required packages for the install.

On some flavors off UNIX, daylight, timezone, and altzone are part of ctime but not under HP-UX.

The external time_t variable altzone contains the difference, in seconds, between UTC and the alternate time zone. The external variable timezone contains the difference, in seconds, between UTC and local standard time. The external variable daylight indicates whether time should reflect daylight savings time. Both timezone and altzone default to 0 (UTC). The external variable daylight is non-zero if an alternate time zone exists.

You could, of course, examine TZ and do this yourself (write a small routine) that defines these variables to satisfy the link but it's much easier to download and install all the required packages and properly set the define's. Most of the source code packages have a configure script to do this for you.

Finally, don't never ever set root's shell to bash on account of root needs a statically linked shell to operate in single-user mode before them there other filesystems like /usr is mounted.

If it ain't broke, I can fix that.