[PD-dev] [ pure-data-Bugs-2021648 ] zexy: configure.ac: $LDFLAGS in wrong place

SourceForge.net noreply at sourceforge.net
Thu Aug 7 04:20:18 CEST 2008


Bugs item #2021648, was opened at 2008-07-18 17:05
Message generated for change (Comment added) made by sf-robot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2021648&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: externals
Group: None
>Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Federico Ferri (federico__)
Assigned to: IOhannes m zmlnig (zmoelnig)
Summary: zexy: configure.ac: $LDFLAGS in wrong place

Initial Comment:
line 425 of configure.ac:

LFLAGS=${LDFLAGS}

is wrong.
LDFLAGS are passed to gcc, not to ld.

I have in my LDFLAGS -Wl,-O1, which make ld fail.
ld should only see the -O1 option

make output:

i686-pc-linux-gnu-ld -shared --export-dynamic -Wl,-O1 -o zexy.pd_linux  *.o -lm -lc 
i686-pc-linux-gnu-ld: unrecognized option '-Wl,-O1'
i686-pc-linux-gnu-ld: use the --help option for usage information
make: *** [zexy] Error 1


please fix. (you can fix it by making an empty LFLAGS)

----------------------------------------------------------------------

>Comment By: SourceForge Robot (sf-robot)
Date: 2008-08-07 02:20

Message:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

----------------------------------------------------------------------

Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-23 07:10

Message:
Logged In: YES 
user_id=564396
Originator: NO

good that you have found a solution.

2 remarks:
- i kind of started to migrate the build-system from zexy/src/ to
zexy/build/autoconf/ and incorporated your changes there.
i suggest you just use this build-system from now on.

- i am not so sure whether using $(CC) as linker is truely portable; not
every compiler might be able to implicitely run a linker, like gcc.


if you feel unhappy with this solution (using build/autoconf/), just
re-open this ticket.

----------------------------------------------------------------------

Comment By: Federico Ferri (federico__)
Date: 2008-07-22 19:47

Message:
Logged In: YES 
user_id=1628983
Originator: YES

so, finally, I managed to fix your problem.
replace $(LD) with $(CC) in Makefile and you are okay, there's no need of
transforming variables or such. here's the one-liner fix I use in the
Gentoo Ebuild:

sed -i -e 's/\$(LD)/\$(CC)/g' Makefile

you can always check here [1] how do I build externals. please notify me
when you commit this little fix, so I remove the fix from the ebuild.

[1]
http://pd-overlay.svn.sourceforge.net/viewvc/pd-overlay/pd-overlay/media-plugins/zexy/
(actually Sf's ViewVC is down)

----------------------------------------------------------------------

Comment By: Federico Ferri (federico__)
Date: 2008-07-21 17:08

Message:
Logged In: YES 
user_id=1628983
Originator: YES

hi IOhannes,
I'm not sure what you should do; the 'GNU Coding Standards' document
doesn't make mention of this (I generally look-up there things when I'm in
doubt).

As I explained, the $(LDFLAGS) has to be passed to gcc, not to ld.
For example, if you have -Wl,--as-needed in $LDFLAGS, the ld program only
wants to see --as-needed.

There are two options:

1) [PROBABLY BAD] if you want to pass $LDFLAGS directly to linker, you
have to turn the "-Wl,--flag1,--flag2" option into "--flag1 --flag2".
I don't see a handy way to do it.

2) use gcc to do the linking.
please read this excerpt from `man ld`:

------------------------------------------------------------------------------
       Note---if the linker is being invoked indirectly, via a compiler
driver
       (e.g.  gcc) then all the linker command line options should be
prefixed
       by -Wl, (or whatever is appropriate for the particular compiler
driver)
       like this:

                 gcc -Wl,--startgroup foo.o bar.o -Wl,--endgroup

       This  is  important,  because otherwise the compiler driver program
may
       silently drop the linker options, resulting in a bad link.
------------------------------------------------------------------------------


also, beware that using a LFLAGS in Makefile could give you weird results,
since LFLAGS are the Lex-flags (that's not your case, since configure is
just a shell script, but just to inform you ;)


so, in my opinion, you should use $(CC) to link objects.
now I'm asking to some people on IRC but still didn't get a reply. if I'll
eventually get a better answer I'll add a comment here.

----------------------------------------------------------------------

Comment By: IOhannes m zmlnig (zmoelnig)
Date: 2008-07-21 13:29

Message:
Logged In: YES 
user_id=564396
Originator: NO

do you have any reference tpo the correct use of LFLAGS vs LDFLAGS?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2021648&group_id=55736




More information about the Pd-dev mailing list