Re: What should the default value of CC be?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Tim S
Tim Stahlhut wrote:

> <div class="moz-text-flowed" style="font-family: -moz-fixed">I am
> having issues compiling wxWidgets trunk since there build system
> went to Bakefile 0.2.4.
>
> The wxWidgets build seems to now only define CC if it is undefined, but
> mingw32-make.exe defines it to cc so I had to copy gcc.exe to cc.exe.
>
> Do you think that is the best solution or should mingw32-make be changed
> to define CC as gcc ?
>
> Note: I at first thought it was an Bakefile Bug, but was told otherwise
> here: http://www.bakefile.org/ticket/231
>
> Tim Stahlhut
>
> </div>
>


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Greg Chicares
On 2008-10-15 07:11Z, Tim Stahlhut wrote:

> Tim Stahlhut wrote:
>> <div class="moz-text-flowed" style="font-family: -moz-fixed">I am
>> having issues compiling wxWidgets trunk since there build system
>> went to Bakefile 0.2.4.
>>
>> The wxWidgets build seems to now only define CC if it is undefined, but
>> mingw32-make.exe defines it to cc so I had to copy gcc.exe to cc.exe.
>>
>> Do you think that is the best solution or should mingw32-make be changed
>> to define CC as gcc ?

The second paragraph of section 10.3 of the gnu 'make' manual here
  http://www.gnu.org/software/make/manual/make.html
says that $(CC) has the default value 'cc'. I don't see why it would
be good to patch a local version so that it contradicts the manual.

It also seems awkward to make a renamed copy of the compiler driver.
Can you give a minimal, self-contained testcase that demonstrates
the problem you're experiencing?

Consider:

$cat cc_defn.make
.PHONY: all
all:
        @echo CC is '$(CC)'
$make -f cc_defn.make
CC is cc
$export CC=gcc
$make -f cc_defn.make
CC is gcc

Is that the behavior you see?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Earnie Boyd

Quoting Greg Chicares <[hidden email]>:

>
> It also seems awkward to make a renamed copy of the compiler driver.
> Can you give a minimal, self-contained testcase that demonstrates
> the problem you're experiencing?
>
> Consider:
>
> $cat cc_defn.make
> .PHONY: all
> all:
>        @echo CC is '$(CC)'
> $make -f cc_defn.make
> CC is cc
> $export CC=gcc
> $make -f cc_defn.make
> CC is gcc

You can even do ``make CC=gcc -f cc_defn.make'' all in one line.

If you're using MSYS or Cygwin you can also create an alias and put
that in your $HOME/.profile file.

alias cc=/bin/gcc

Earnie

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Keith Marshall
On Wednesday 15 October 2008 15:14:04 Earnie Boyd wrote:
> If you're using MSYS or Cygwin you can also create an alias and put
> that in your $HOME/.profile file.
>
> alias cc=/bin/gcc

However, this will not help the OP -- shell aliases don't propagate to
subprocesses, so `make' will not know of this mapping.

Regards,
Keith.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Keith Marshall
In reply to this post by Tim S
On Wednesday 15 October 2008 08:11:17 Tim Stahlhut wrote:
> > The wxWidgets build seems to now only define CC if it is
> > undefined, but mingw32-make.exe defines it to cc so I had to copy
> > gcc.exe to cc.exe.

Every `make' I've ever used predefined a default for `CC'; in most
cases that was, (or is), `cc', (although Microsoft's `nmake' likely
sets it to `cl', but I can't say that authoritatively).

> > Do you think that is the best solution or should mingw32-make be
> > changed to define CC as gcc ?

Hacking `make' in this way would be absolutely the wrong thing to do.

Most *nixes, (including GNU/Linux), normally solve this by providing
`/bin/cc' or `/usr/bin/cc' as a link, (most often symbolic, but
occasionally hard), to the real compiler.  On NTFS, you can do the
same, (in MSYS, `(cd /mingw/bin && ln gcc.exe cc.exe)' will create a
hard link).  By making the copy, you have effectively produced the
same effect.

> > Note: I at first thought it was an Bakefile Bug, but was told
> > otherwise here: http://www.bakefile.org/ticket/231

It may not be a bakefile bug, but it is a bug somewhere in the build
system, if it is relying on the built-in default setting for `CC' in
`make'.  The actual compiler should be properly identified when you
run the `configure' script, (but, since you are using mingw32-make, I
assume you are a masochist, and not using MSYS, so you aren't running
a `configure' script).  In this case, Earnie's suggestion of running
`mingw32-make CC=gcc ...' is likely to be your most effective remedy,
short of getting the actual build system bug fixed, if you aren't
happy with cloning gcc.exe as cc.exe.

Regards,
Keith.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Earnie Boyd
In reply to this post by Keith Marshall

Quoting Keith Marshall <[hidden email]>:

> On Wednesday 15 October 2008 15:14:04 Earnie Boyd wrote:
>> If you're using MSYS or Cygwin you can also create an alias and put
>> that in your $HOME/.profile file.
>>
>> alias cc=/bin/gcc
>
> However, this will not help the OP -- shell aliases don't propagate to
> subprocesses, so `make' will not know of this mapping.
>

Oh, yes of course.  Instead

cat <<!EOF>/bin/cc
#!/bin/gcc
!EOF

Earnie

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Keith Marshall
On Thursday 16 October 2008 12:36:49 Earnie Boyd wrote:

> Quoting Keith Marshall <[hidden email]>:
> > On Wednesday 15 October 2008 15:14:04 Earnie Boyd wrote:
> >> If you're using MSYS or Cygwin you can also create an alias and
> >> put that in your $HOME/.profile file.
> >>
> >> alias cc=/bin/gcc
> >
> > However, this will not help the OP -- shell aliases don't
> > propagate to subprocesses, so `make' will not know of this
> > mapping.
>
> Oh, yes of course.  Instead
>
> cat <<!EOF>/bin/cc
> #!/bin/gcc
> !EOF

Nope.  Sorry to disappoint, but this won't work either.  The shebang
mechanism, in a script such as this, causes the process dispatcher to
invoke the nominated program as an interpreter for the script itself,
with any specified arguments.  Thus, this script results in

  exec /bin/gcc /bin/cc <arguments ...>

which isn't what you want, (notwithstanding that Earnie most likely
meant /mingw/bin/gcc, and not /bin/gcc).  To demonstrate

  $ rm -rf emptydir
  $ mkdir emptydir
  $ cd emptydir
  $ touch foo.c

Now, with no attempt to provide `cc'

  $ make foo.o
  cc    -c -o foo.o foo.c
  make: cc: Command not found
  make: *** [foo.o] Error 127

With Earnie's suggested script

  $ echo '#!/mingw/bin/gcc' > /bin/cc
  $ make foo.o
  cc    -c -o foo.o foo.c
  gcc.exe: D:/usr/MSYS-1.0.11/bin/cc: linker input file unused because
   linking not done
  D:/usr/MSYS-1.0.11/bin/cc:1:2: invalid preprocessing directive #!
  make: *** [foo.o] Error 1

This alternative script *will* work

  $ echo '#!/bin/sh
  > gcc "$@"' > /bin/cc
  $ make foo.o
  cc    -c -o foo.o foo.c
  $

Revert to initial state

  $ rm *.o /bin/cc
  $ make foo.o
  cc    -c -o foo.o foo.c
  make: cc: Command not found
  make: *** [foo.o] Error 127

This alternative will also work; (I would favour this on an NTFS file
system, but the former on FAT)

  $ (cd /mingw/bin && ln gcc.exe cc.exe)
  $ make foo.o
  cc    -c -o foo.o foo.c
  $

Regards,
Keith.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: What should the default value of CC be?

Earnie Boyd

Quoting Keith Marshall <[hidden email]>:

>
> Nope.  Sorry to disappoint, but this won't work either.  The shebang
> mechanism, in a script such as this, causes the process dispatcher to
> invoke the nominated program as an interpreter for the script itself,
> with any specified arguments.  Thus, this script results in
>

Apologies.  Yes, as you've shown.  I was having a very bad day
yesterday.  Really, the kid started off the day before by tearing off a
piece of his new hearing aid and losing it.  That piece is the custom
made piece that fits in the ear - cha-ching.  He ended yesterday by
tearing of the same piece for the other ear; at least he didn't lose it
this time and I could fit it back together.

I tested the script before I sent the mail.  But I had an alias cc
sitting in the environment and I didn't do ./ before the script name.

>  exec /bin/gcc /bin/cc <arguments ...>
>
> which isn't what you want, (notwithstanding that Earnie most likely
> meant /mingw/bin/gcc, and not /bin/gcc).  To demonstrate
>
>  $ rm -rf emptydir
>  $ mkdir emptydir
>  $ cd emptydir
>  $ touch foo.c
>
> Now, with no attempt to provide `cc'
>
>  $ make foo.o
>  cc    -c -o foo.o foo.c
>  make: cc: Command not found
>  make: *** [foo.o] Error 127
>
> With Earnie's suggested script
>
>  $ echo '#!/mingw/bin/gcc' > /bin/cc
>  $ make foo.o
>  cc    -c -o foo.o foo.c
>  gcc.exe: D:/usr/MSYS-1.0.11/bin/cc: linker input file unused because
>   linking not done
>  D:/usr/MSYS-1.0.11/bin/cc:1:2: invalid preprocessing directive #!
>  make: *** [foo.o] Error 1
>
> This alternative script *will* work
>
>  $ echo '#!/bin/sh
>  > gcc "$@"' > /bin/cc
>  $ make foo.o
>  cc    -c -o foo.o foo.c
>  $
>
> Revert to initial state
>
>  $ rm *.o /bin/cc
>  $ make foo.o
>  cc    -c -o foo.o foo.c
>  make: cc: Command not found
>  make: *** [foo.o] Error 127
>
> This alternative will also work; (I would favour this on an NTFS file
> system, but the former on FAT)
>
>  $ (cd /mingw/bin && ln gcc.exe cc.exe)
>  $ make foo.o
>  cc    -c -o foo.o foo.c
>  $
>

Thanks for cleaning up Keith.

Earnie

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users