diff options
author | Olivier Blin <olivier.blin@softathome.com> | 2012-07-29 12:44:53 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-07-29 12:45:47 -0400 |
commit | a7c17431b9fbf767235d614cfe2e4f22ee0d6771 (patch) | |
tree | 1ac5048914595dc34a4c365a560561c8c88a1ab0 | |
parent | d2051f11044290d288a4f03220f07fe9651588c9 (diff) | |
download | e2fsprogs-a7c17431b9fbf767235d614cfe2e4f22ee0d6771.tar.gz |
Link shared libraries with local libraries instead of system ones
ELF_OTHER_LIBS usually contains local search dirs (-L ../..), but it
was added in link command after system search dirs from LDFLAGS.
Libraries and executables were linked with the system libraries if
present, and possibly using static archives instead of shared
libraries.
It could also make final executable link to fail when shared libraries
are enabled: if libext2fs.so is linked with a static libcom_err.a from
system, build system would attempt to link without -lpthread.
This fixes the issue by moving ELF_OTHER_LIBS before LDFLAGS in the
link command.
Addresses-Sourceforge-Bug: #3542572
Reported-by: Olivier Blin <blino@users.sourceforge.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | lib/Makefile.elf-lib | 4 | ||||
-rw-r--r-- | lib/Makefile.solaris-lib | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Makefile.elf-lib b/lib/Makefile.elf-lib index c24636cc..c66281c8 100644 --- a/lib/Makefile.elf-lib +++ b/lib/Makefile.elf-lib @@ -24,8 +24,8 @@ image: $(ELF_LIB) $(ELF_LIB): $(OBJS) $(E) " GEN_ELF_SOLIB $(ELF_LIB)" - $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(LDFLAGS) \ - -Wl,-soname,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS)) + $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(ELF_OTHER_LIBS) \ + $(LDFLAGS) -Wl,-soname,$(ELF_SONAME) $(OBJS)) $(Q) $(MV) elfshared/$(ELF_LIB) . $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \ diff --git a/lib/Makefile.solaris-lib b/lib/Makefile.solaris-lib index 92bdbe28..66f2b4c8 100644 --- a/lib/Makefile.solaris-lib +++ b/lib/Makefile.solaris-lib @@ -24,8 +24,8 @@ image: $(ELF_LIB) $(ELF_LIB): $(OBJS) $(E) " GEN_ELF_SOLIB $(ELF_LIB)" - $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(LDFLAGS) \ - -Wl,-h,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS)) + $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(ELF_OTHER_LIBS) \ + $(LDFLAGS) -Wl,-h,$(ELF_SONAME) $(OBJS)) $(Q) $(MV) elfshared/$(ELF_LIB) . $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \ |