chc08 on the commandline - whitespace in -I paths

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

chc08 on the commandline - whitespace in -I paths

Jump to solution
2,587 Views
vegie_stu
Contributor I
Hi,

I need to use the chc08 compiler in a makefile. The default installation (c:\program files\...) has spaces in it which the compiler doesn't like when specifying include paths. For example:

"C:/Program Files/Freescale/CodeWarrior for HC08 V5.1/prog/chc08.exe"   -WStdout
On -Ansi -Isrc/CSP/908ey16 -Isrc -IC:/Program Files/Freescale/CodeWarrior for HC
08 V5.1/lib/hc08c/include src/main.c -ObjN=%n.o
make: *** [src/main.o] Error 1

D:\freescale\Devel_with_makefile>type EDOUT
FATAL C50: Input file 'Files/Freescale/CodeWarrior' not found

That was predictable, but trying to escape the spaces with backslashes or enclosing the path with quotes (double and single) fail too:

D:\freescale\Devel_with_makefile>make src/main.o
"C:/Program Files/Freescale/CodeWarrior for HC08 V5.1/prog/chc08.exe"   -WStdout
On -Ansi -Isrc/CSP/908ey16 -Isrc -I"c:/Program Files/Freescale/CodeWarrior for H
C08V5.1/lib/hc08c/include" src/main.c -ObjN=%n.o
make: *** [src/main.o] Error 1

D:\freescale\Devel_with_makefile>type EDOUT
FATAL C50: Input file '-Ic:/Program Files/Freescale/CodeWarrior for HC08V5.1/lib
/hc08c/include' not found

Does anyone know how to use include pathes with spaces in directory names?

I know the easiest solution is to install CodeWarrior in a directory without spaces, however this software will be built by a lot of different people and having people reinstall their toolchain is a pain for them.

Thanks,
Stuart
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
965 Views
CompilerGuru
NXP Employee
NXP Employee
Hi Stuart,

I guess some of the problems you actually see are because of the make tool you use too.
A simple cmd.exe for example just refuses to take the forward slashes you use in your samples.
With cmd.exe, I'm able to use this command line:
"C:\Programme\Freescale\CodeWarrior for HC08 V5.1\prog\piper.exe" "C:\Programme\Freescale\CodeWarrior for HC08 V5.1\prog\chc08.exe"   -WStdoutOn -Ansi -Isrc/CSP/908ey16 -Isrc -I"c:/Program Files/Freescale/CodeWarrior for HC08V5.1/lib/hc08c/include" src/main.c -ObjN=%n.o

Note that I first places piper.exe, its only purpose is to see the stdout directly as result of the cmd.exe. If it is necessary for you depends on the make tool you use. It's not with the delivered maker.exe.

To pass in paths with spaces your syntax is actually fine.
-I"c:/Program files/...."

Given the output you see I guess that the compiler is not actually called by the make tool with exactly this command line, but instead the make tool tried be smart.
For example I get this error message when the quotes are before the complete option:
chc08.exe "-i:/Program....."

So which make tool do you use?

Note that CW internally is passing all the options to the compiler with a command line too, you can enable to display the actually used options in the ide in the compiler settings, so you see how the space handling is done there. In the normal setup, the include paths are passed with -env option and not via -i, but in the end it does not matter much. With via -env, different paths can be given for #include <>'s and #include ""'s,
-i aplies to both kind of include types.


View solution in original post

0 Kudos
Reply
3 Replies
965 Views
vegie_stu
Contributor I
Hi CompilerGuru,

Your idea about make changing -I"..." to "-I..." is right.  I am using GNU make 3.80.  The solution to the problem was to keep sh.exe out of my path (distributed with a lot of gcc-based toolchains).  Here's what I found...

Now I'm using piper.exe, it's a lot easier to debug what's going on:

D:\freescale\Devel_with_makefile>make -d test
Must remake target `test'.
"c:/Program Files/Freescale/CodeWarrior for HC08 V5.1/prog/piper.exe" "c:/Progra
m Files/Freescale/CodeWarrior for HC08 V5.1/prog/chc08.exe" -WStdoutOn -Ansi -Is
rc/CSP/908ey16 -Isrc -I"c:/Program Files/Freescale/CodeWarrior for HC08 V5.1/lib
/hc08c/include" src/main.c -ObjN=%n.o
CreateProcess(c:\winavr\utils\bin\sh.exe,c:/winavr/utils/bin/sh.exe -c "\"c:/Pro
gram Files/Freescale/CodeWarrior for HC08 V5.1/prog/piper.exe\" \"c:/Program Fil
es/Freescale/CodeWarrior for HC08 V5.1/prog/chc08.exe\" -WStdoutOn -Ansi -Isrc/C
SP/908ey16 -Isrc -I\"c:/Program Files/Freescale/CodeWarrior for HC08 V5.1/lib/hc
08c/include\" src/main.c -ObjN=%n.o",...)
Putting child 0x00993d88 (test) PID 10054448 on the chain.
Live child 0x00993d88 (test) PID 10054448
FATAL C50: Input file '-Ic:/Program Files/Freescale/CodeWarrior for HC08 V5.1/li
b/hc08c/include' not found
*** command line: '-WStdoutOn -Ansi -Isrc/CSP/908ey16 -Isrc "-Ic:/Program Files/
Freescale/CodeWarrior for HC08 V5.1/lib/hc08c/include" src/main.c -ObjN=%n.o' **
*
HC08 Compiler: *** Error occurred while processing! ***
Reaping losing child 0x00993d88 PID 10054448
make: *** [test] Error 1
Removing child 0x00993d88 PID 10054448 from chain.

Notice that the include path in CreateProcess(...) is fine, so it doesn't look to be a GNU make problem, however the command line that chc08 complains about now has the " before the -I.

I cleaned up my Path environment so I wasn't pulling in utilities from other chains and made sure sh.exe was no longer available to GNU make.  That fixed the problem.

Thanks CompilerGuru.

Regards,
vegie_stu

0 Kudos
Reply
965 Views
CompilerGuru
NXP Employee
NXP Employee
I did have troubles with GNU's make and backward slashes in the past, so I'm not really surprised it special handles double quotes too.
However is not supporting "sh.exe" in the path really a solution? You stated before:

>however this software will be built by a lot of different people and having people reinstall
>their toolchain is a pain for them.

So I think while the space thing is a pain, to have non trivial error messages about "-" files is not that good either :smileysad:

When using a stock GNU make, I think on Windows you have to make sure it find sh.exe, with all the odd behavior this causes. Only this way you have a defined behavior, otherwise you will always have some users with sh.exe and some without, and it will work for just one group or the other.
Alternatives
- use another make
- patch gnu's make(I dont think there is a way to get GNU's make not to use sh.exe out of the box)

Daniel
966 Views
CompilerGuru
NXP Employee
NXP Employee
Hi Stuart,

I guess some of the problems you actually see are because of the make tool you use too.
A simple cmd.exe for example just refuses to take the forward slashes you use in your samples.
With cmd.exe, I'm able to use this command line:
"C:\Programme\Freescale\CodeWarrior for HC08 V5.1\prog\piper.exe" "C:\Programme\Freescale\CodeWarrior for HC08 V5.1\prog\chc08.exe"   -WStdoutOn -Ansi -Isrc/CSP/908ey16 -Isrc -I"c:/Program Files/Freescale/CodeWarrior for HC08V5.1/lib/hc08c/include" src/main.c -ObjN=%n.o

Note that I first places piper.exe, its only purpose is to see the stdout directly as result of the cmd.exe. If it is necessary for you depends on the make tool you use. It's not with the delivered maker.exe.

To pass in paths with spaces your syntax is actually fine.
-I"c:/Program files/...."

Given the output you see I guess that the compiler is not actually called by the make tool with exactly this command line, but instead the make tool tried be smart.
For example I get this error message when the quotes are before the complete option:
chc08.exe "-i:/Program....."

So which make tool do you use?

Note that CW internally is passing all the options to the compiler with a command line too, you can enable to display the actually used options in the ide in the compiler settings, so you see how the space handling is done there. In the normal setup, the include paths are passed with -env option and not via -i, but in the end it does not matter much. With via -env, different paths can be given for #include <>'s and #include ""'s,
-i aplies to both kind of include types.


0 Kudos
Reply