Menu

#3541 SDCC deletes cpp file in compiling and throw an error

closed-fixed
Felix
sdcpp (4)
other
5
2023-11-08
2023-01-30
Deqing Sun
No

Hi,

I'm tring to update my toolchain to new version but there was a problem. When I tried to compile the project it thrown me some error. I found the following bug:

When I tried to compile the cpp file with a simplified test command with SDCC snapshot build 4.2.12 #13827 (Mac OS X x86_64)

/path_to_sdcc/sdcc -MMD -c -xc ch552_serial1_debug.ino.cpp -o ch552_serial1_debug.ino.cpp.o

I got error

sdcpp: warning: '-x c' after last input file has no effect
cc1: fatal error: ch552_serial1_debug.ino.cpp.d: No such file or directory
compilation terminated.
at 1: warning 190: ISO C forbids an empty source file
subprocess error 256

And the cpp souce file disappears. I believe this is a bug? The file is attached.

1 Attachments

Related

Bugs: #3551
Wiki: SDCC 4.3.0 Release

Discussion

  • Benedikt Freisen

    Apparently, the "-x c" goes in the wrong place in the synthesized command line for the preprocessor.

     
    • Deqing Sun

      Deqing Sun - 2023-01-30

      It seems required to have the "-xc" although this comment said not needed https://sourceforge.net/p/sdcc/bugs/3489/#ddcf

      But the "-xc" triggered the bug.

       

      Last edit: Deqing Sun 2023-01-30
  • Felix

    Felix - 2023-03-21

    This bug does not seem (directly?) related to -xc or sdcpp.

    Add --verbose to see the sdcpp command. Now, cpp (from gcc) takes similar
    arguments, except --obj-ext=.rel...

    Here's a simplified version of the test cast, starting from cpp, to get the
    full picture.

    $ echo 'int main(){}' > ch552.c
    $ cpp -nostdinc -Wall -std=c11 -MMD ch552.d -MT ch552.o ch552.c
    cc1: fatal error: ch552.d: No such file or directory
    $ cat ch552.c
    cat: ch552.c: No such file or directory
    

    adjusting the invocation a bit i get

    $ echo 'int main(){}' > ch552.c
    $ cpp -nostdinc -Wall -std=c11 ch552.c -MT ch552.o -MMD -MF ch552.d
    # 0 "ch552.c"
    # 0 "<built-in>"
    # 0 "<command-line>"
    # 1 "ch552.c"
    int main(){}
    $ cat ch552.c
    int main(){}
    $ cat ch552.d
    ch552.o: ch552.c
    

    Which is looks much closer to what we want. But then

    $ echo 'int main(){}' > ch552.c
    $ sdcpp -nostdinc -Wall -std=c11 ch552.c -MT ch552.o -MMD -MF ch552.d
    $ cat ch552.c
    #line 0 "ch552.d"
    #line 0 "<built-in>"
    #line 0 "<command-line>"
    #line 1 "ch552.d"
    ch552.o: ch552.d.
    

    Issue seems to be that -MF is missing in the sdcpp invocation. -MMD does not take arguments (anymore?).

    I have fixed this in [r13911].

     

    Related

    Commit: [r13911]


    Last edit: Maarten Brock 2023-03-22
  • Felix

    Felix - 2023-05-01
    • status: open --> pending-fixed
    • assigned_to: Felix
     
  • Felix

    Felix - 2023-05-01

    Appears to be fixed with [r13911]. Please reopen if this is not the case.

     

    Related

    Commit: [r13911]

  • Felix

    Felix - 2023-11-08
    • labels: --> sdcpp
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.