logo       

[ ghc-Bugs-670756 ] package cc and ld opts inconsistent: msg#00015

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-670756 ] package cc and ld opts inconsistent

Bugs item #670756, was opened at 2003-01-19 18:59
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=670756&group_id=8032

Category: Driver
Group: 5.04.2
Status: Open
>Resolution: Invalid
Priority: 5
Submitted By: Axel Simon (as49)
Assigned to: Nobody/Anonymous (nobody)
Summary: package cc and ld opts inconsistent

Initial Comment:
I try to create a package which passes
"--subsystem windows"
to the linker. As far as I understand it should be ok to have
extra_ld_opts = ["--subsystem windows"]
or, as ghc itself does it
extra_ld_opts = ["--subsystem", "windows"]
in the package description. However these flags are not
given to the linker. I tried
extra_cc_opts = ["-Wl,--subsystem", "-Wl,windows"]
but these flags are not passed to the C compiler either.
I finally succeeded with
extra_ld_opts = ["-Wl,--subsystem", "-Wl,windows"]
which I suspect fails when compiling with the native code
generator.

I am using the MSI of ghc 5.04.2.

Axel.



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

>Comment By: Axel Simon (as49)
Date: 2003-02-05 10:35

Message:
Logged In: YES
user_id=489164

Ok, so it's just a misunderstanding on my side.

I use ghc --make to build programs with my package so the
whole build is just one invocation. I then assumed that
extra_hc_flags are added to ghc's command line,
extra_cc_flags are passed to gcc's command line and
extra_ld_flags are passed to ld's command line. The latter
doesn't hold because you invoke gcc to link. When I compiled
with -v I got confused: I saw gcc when it linked the code, so I
assumed extra_cc_flags is the place to alter this command line.

Sorry about the hassle,
Axel.



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

Comment By: Simon Marlow (simonmar)
Date: 2003-02-04 12:16

Message:
Logged In: YES
user_id=48280

extra_cc_opts gets passed to gcc when doing C
compilations (either Haskell compilations via C, or
compilation of plain C files).

extra_ld_opts gets passed to gcc when doing linking.

You can use -v to see what options are being passed to
which commands.

What exactly is wrong?


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

Comment By: Axel Simon (as49)
Date: 2003-02-04 11:52

Message:
Logged In: YES
user_id=489164

I thought the linker is the linker and not the C compiler. With
this in mind I would have expected that

extra_ld_opts = ["--subsystem", "windows"]

winds up as -Wl,--subsystem -Wl,windows on the gcc
command line. Similarly, I expected

extra_cc_opts = ["-Wl,--subsystem", "-Wl,windows"]

to end up on the command line of gcc. Where do these flags
go to?

Furthermore, how am I to specify linker options if compilation
is not via C?

I find the behaviour just very confusing.
Axel.


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

Comment By: Simon Marlow (simonmar)
Date: 2003-02-04 11:26

Message:
Logged In: YES
user_id=48280

The "linker" is in fact gcc, so when you add options to
extra_ld_opts they are passed on the gcc command line. If
you want to actually pass options to ld, then you need to use
the -Wl, prefix as you mentioned.

I don't understand your comments about extra_cc_opts - as
far as I can tell these are always passed to C compilations.
Could you give a specific example?

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=670756&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise