Page 1 of 1

[Fixed] 1.18.155 update breaks builds

Posted: Thu Feb 24, 2022 3:18 pm
by hippy
I am having a problem with building my cloned and tweaked port of the 'rp2' port since the recent update to 1.18.155; don't know whether that relates to the mpy-cross changes or something else. It built yesterday but now doesn't ...

Code: Select all

[ 74%] Building C object CMakeFiles/picopython.dir/frozen_content.c.obj
/home/pi/pico/micropython/ports/picopython/build/frozen_content.c:7661:16: error: multi-line comment [-Werror=comment]
     0x10,0x61, // LOAD_CONST_STRING \
Looking in 'build/frozen_content.c' -

Code: Select all

    0x10,0x60, // LOAD_CONST_STRING -=[]
    0x10,0x61, // LOAD_CONST_STRING \
    0xf2, // BINARY_OP 27 __add__
It seems that '\' is interpreted as a line continuation.

If I edit that out in 'build/frozen_content.c', I can run 'make' again and it all compiles okay, but a clean build puts it back in.

Presumably it's an issue with whatever creates 'build/frozen_content.c' ?

Re: 1.18.155 update breaks builds

Posted: Thu Feb 24, 2022 3:59 pm
by hippy
Seems the bug is in line ~867 of 'tools/mpy-tool.py' -

Code: Select all

print(
    "    %s, // %s" % (",".join("0x%02x" % b for b in bc[ip : ip + sz]), opcode_name)
)
My kludged fix ...

Code: Select all

print(
   "    %s, /* %s */" % (",".join("0x%02x" % b for b in bc[ip : ip + sz]), opcode_name)
)
Someone else will have to figure out what a better solution would be.

Re: 1.18.155 update breaks builds

Posted: Thu Feb 24, 2022 4:31 pm
by hippy
And, for completeness, and perhaps useful for testing a fix - it seems the issue comes down to a self-created '.py' module placed in my './ports/picopython/modules' directory, which contains -

Code: Select all

  SetKeyCode(0x2D, "-=[]" + "\\" + "#;'`,./")
It's that "\\", which becomes "\" later on and when emitted, which leads to 'mpy-tool' breaking the build.

Re: 1.18.155 update breaks builds

Posted: Fri Feb 25, 2022 3:12 pm
by yjchun
Similar problem is on github issue now.
https://github.com/micropython/micropython/issues/8356

Re: 1.18.155 update breaks builds

Posted: Fri Feb 25, 2022 6:15 pm
by hippy
Thanks to robert-hh and yourself for pursuing the issue. Unfortunately I'm in a position where it is not possible for me to file issues or contribute on GitHub. So the best I can do is report issues I encounter here along with any "what I have done" to fix things. That's not the best it could be but that's how it is.

BTW : %r is probably a better fix than mine because that probably fails on /* or */ or anything else GCC doesn't like embedded within comments. I was really only concerned about getting it to build at the time rather than fixing things.

Re: [Fixed] 1.18.155 update breaks builds

Posted: Mon Feb 28, 2022 1:04 pm
by hippy
Thanks. All seems to have been fixed and it passed all tests I threw at it.