Closed Bug 323188 Opened 19 years ago Closed 19 years ago

Link order is important when building executables

Categories

(Directory :: LDAP C SDK, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: richm, Assigned: mcs)

Details

Attachments

(2 files)

The order of items to link is important on some platforms when building the executables for the command line tools.  They must be in order of dependency.  Something like this:
.o files -> -lssldap -> -lprldap -> -lldap -> -lsvrcore -> nss libs -> nspr libs -> system libs

Otherwise you get weird link errors.  Also, the makefile.in for tools is kind of messy and redundant.
Attached file list of files for fix
Attached file diffs for fix
The LINK_EXE macro already has everything needed - it is not necessary to supply extra libs in the form of the LDTOOLS_LIBS.  Just specify them in the correct order in EXTRA_LIBS.  You don't need to set EXTRA_LIBS for every platform - on *nix platforms, they are all the same, so just define them in a common place in the correct order.  Use PLATFORMLIBS to specify platform dependent libs.

The one tricky thing is that LINK_EXE expects OBJS to have all of the objects.  This works if you only build one executable per makefile, but this makefile builds several, so you need to get the executable specific .obj file in the link line as well.  I suppose I could have used target specific variable assignment to OBJS, but that seemed messy to me, so I just added a $(filter ..) to the LINK_EXE command which will add all of the .obj files specified in the executable link target dependency list to the link line.  The filter is to filter out libraries and other dependencies, which are usually specified elsewhere.  This seems to work on linux x86_64 and HP IPF 64 just fine.
Checking in mozilla/directory/c-sdk/build.mk;
/cvsroot/mozilla/directory/c-sdk/build.mk,v  <--  build.mk
new revision: 5.24; previous revision: 5.23
done
Checking in mozilla/directory/c-sdk/configure;
/cvsroot/mozilla/directory/c-sdk/configure,v  <--  configure
new revision: 5.39; previous revision: 5.38
done
Checking in mozilla/directory/c-sdk/configure.in;
/cvsroot/mozilla/directory/c-sdk/configure.in,v  <--  configure.in
new revision: 5.40; previous revision: 5.39
done
Checking in mozilla/directory/c-sdk/ldap/clients/tools/Makefile.in;
/cvsroot/mozilla/directory/c-sdk/ldap/clients/tools/Makefile.in,v  <--  Makefile.in
new revision: 5.11; previous revision: 5.10
done
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: