bugGNU gettext - Bugs: bug #30060, messed up LDFLAGS and LIBADD for...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #30060: messed up LDFLAGS and LIBADD for libgettextpo and libgettextsrc

Submitter:  Funda Wang <fundawang>
Submitted:  Mon 07 Jun 2010 02:51:35 AM UTC
   
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Mon 13 Feb 2023 12:22:02 PM UTC, comment #4: 


> The correct command when linking libraries should be:
> $(CC) $(LDFLAGS) $(OBJECTS) $(LIBADD)
> Putting some LIBS into LDFLAGS will lead to the fact that LIBS appearing prior to OBJECTS.


No one puts static libraries into $(LDFLAGS). If they are needed by all programs, they belong in $(LIBS).

When the target is a non-libtool library, library.a, there is no $(library_a_LDFLAGS) variable; the link dependencies simply get ignored when creating a .a file.

When the target is a libtool library, library.la, the value of $(library_la_LDFLAGS) gets used in a libtool command line, before the objects. This is OK, because as Ralf Wildenhues wrote in https://lists.gnu.org/archive/html/bug-gnulib/2006-09/msg00146.html: "libtool will reorder the command line so that `-l' flags appear after all encountered objects."

And the objects appear before $(library_la_LIBADD) and $(LIBS); this is necessary for static linking.

Bruno Haible <haible>
Group administrator
Sun 12 Dec 2010 03:12:48 PM UTC, comment #3: 


> The correct command when linking libraries should be:
> $(CC) $(LDFLAGS) $(OBJECTS) $(LIBADD)
> Putting some LIBS into LDFLAGS will lead to the fact that LIBS appearing prior to OBJECTS.


Thanks for providing these details.

The use of LDFLAGS goes back to this thread:
http://lists.gnu.org/archive/html/bug-gnulib/2006-09/msg00132.html

I have transformed your complaint into an Automake bug report:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7621

Bruno Haible <haible>
Group administrator
Mon 07 Jun 2010 10:16:17 AM UTC, comment #2: 

./configure --build=x86_64-mandriva-linux-gnu --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib64 --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --x-includes=/usr/include --x-libraries=/usr/lib64 --enable-shared --with-included-gettext --disable-csharp --disable-java

There is no error messages when building with Mandriva's default buildtools (mainly libtool). But it will confuse Makefile.

The correct command when linking libraries should be:

$(CC) $(LDFLAGS) $(OBJECTS) ($LIBADD)

Putting some LIBS into LDFLAGS will lead to the fact that LIBS appearing prior to OBJECTS.

http://wiki.mandriva.com/en/Overlinking#Wrong_linking_order

Funda Wang <fundawang>
Mon 07 Jun 2010 09:34:00 AM UTC, comment #1: 

Can you tell me what problem you had with the definitions as
they are?

What error message did you get? On which platform? With
--disable-shared or --enable-shared?

Bruno Haible <haible>
Group administrator
Mon 07 Jun 2010 02:51:35 AM UTC, original submission:  

libgettextpo_la_LIBADD = libgnu.la $(WOE32_LIBADD) $(LTLIBUNISTRING)
libgettextpo_la_LDFLAGS = \
  -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
  -rpath $(libdir) \
  @LTLIBINTL@ @LTLIBICONV@ -lc @LTNOUNDEF@

But "@LTLIBINTL@ @LTLIBICONV@ -lc" is linked libraries, rather than LDFLAGS. They should be put into LIBADD. i.e.,

libgettextpo_la_LIBADD = libgnu.la $(WOE32_LIBADD) $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ -lc
libgettextpo_la_LDFLAGS = \
  -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
  -rpath $(libdir) \
  @LTNOUNDEF@

libgettextpo_la_LDFLAGS = \
  -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
  -rpath $(libdir) @LTNOUNDEF@

The same applies to libgettextsrc, it should read:
libgettextsrc_la_LDFLAGS = \
  -release @VERSION@ @LTNOUNDEF@

libgettextsrc_la_LIBADD = \
  ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ -lc

Funda Wang <fundawang>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #20700:  a.patch added by fundawang (1KiB - application/octet-stream - Propsed patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by fundawang (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-13 haible StatusIn Progress Not a Bug
        Open/ClosedOpen Closed
    2016-11-27 haible CategoryNone Build
    2010-12-12 haible StatusNeed Info In Progress
    2010-06-07 haible Assigned toNone haible
    2010-06-07 haible StatusNone Need Info
    2010-06-07 fundawang Attached File- Added a.patch, #20700

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code