Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] The Shell Game

hi,
 
 I've just come across a problem that sounds like it may be related to the recent discussion about spaces in filenames. Its occured with a non-Cygwin Windows toolchain (MinGW gcc 3.4), however my filenames don't have spaces. I'm currently playing with CDT HEAD, and am trying to compile a project which lives under path:
    C:\eclipseWork\workspaces\runtime-workspace\baddeps\src\hello.c
 
The managed make system is generating make files containing rules of the form
 
    # Each subdirectory must supply rules for building sources it contributes
    src/%.o: ../src/%.c
     @echo 'Building file: $<'
     @echo 'Invoking: GCC C Compiler'
     @echo gcc -O0 -g3 -Wall -c -fmessage-length=0 -o'$@' '$<'
     @gcc -O0 -g3 -Wall -c -fmessage-length=0 -o'$@' '$<' && \
     echo -n '$(@:%.o=%.d)' $(dir $@) > '$(@:%.o=%.d)' && \
     gcc -MM -MG -P -w -O0 -g3 -Wall -c -fmessage-length=0  '$<' >> '$(@:%.o=%.d)'
     @echo 'Finished building: $<'
     @echo ' '
 
(note that the input macro $< is now enclosed in single quotes). Upon running this gives output:

    **** Full rebuild of configuration Debug for project baddeps ****
   
    make -k clean all 
    rm -rf  ./src/hello.o  ./src//hello.d  baddeps.exe
    ' '
    'Building file: ../src/hello.c'
    'Invoking: GCC C Compiler'
    gcc -O0 -g3 -Wall -c -fmessage-length=0 -o'src/hello.o' '../src/hello.c'
    gcc: '../src/hello.c': No such file or directory
    gcc: no input files
    make: *** [src/hello.o] Error 1
    make: Target `all' not remade because of errors.
    Build complete for project baddeps
 
because the underlying shell is Windows XP CMD.exe, which (from experiments) treats single quotes the same as any alphanumeric character. Running the same gcc command from the shell, without single quotes, compiles as expected.
 
I've tracked this down to the code below from org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator (originating in rev 1.3)
 
    // if the input resource isn't a variable then quote it
    if(inputResources[k].indexOf("$(") != 0) //$NON-NLS-1$
         tempBuffer.append(SINGLE_QUOTE + inputResources[k] + SINGLE_QUOTE + WHITESPACE); //$NON-NLS-1$ //$NON-NLS-2$
        else
         tempBuffer.append(inputResources[k] + WHITESPACE);
 
This isn't in bugzilla, but thought I'd run it past the list first :) (in future, do you prefer this sort of discussion to happen under bugzilla reports even if ultimately there is no bug?)
 
thanks,
Andrew
 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Recoskie, Chris
Sent: 22 November 2005 21:20
To: CDT General developers list.
Subject: [cdt-dev] The Shell Game

So I’ve been working for the past week or so on getting MBS to build files and folders with spaces in them.  I’ve been largely successful thus far, but along the way I ran into some issues which I thought would be good to bring up.

 

...

...

 

So, I ask:

a)       Does anyone else think that this issue is going to affect them when using their own toolchains?

b)      Does anyone else think that this might be an issue that affects other parts of CDT? (Launching/Debugging comes to mind… e.g. will launching a debug session fail if you try to debug an executable with spaces in the name?)

c)       Do we need to do anything about this right now?

___________________________________________

Chris Recoskie

Software Designer

Texas Instruments, Toronto

http://eclipse.org/cdt

 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.


Back to the top