patriciogonzalezvivo / thebookofshaders

Step-by-step guide through the abstract and complex universe of Fragment Shaders.
http://TheBookOfShaders.com
Other
6.08k stars 690 forks source link

Fails to build on windows outside of cygwin or msys/mingw64 #422

Open ghost opened 1 month ago

ghost commented 1 month ago

Two different errors I encountered. The first one is that I get the following terminal output:

Traceback (most recent call last):
  File "D:\Users\Matthew\downloads\thebookofshaders\src\parseBook.py", line 73, in <module>
    fileString = originalChapter.read()
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\msys64\mingw64\lib\python3.11\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 4870: character maps to <undefined>
make: *** [Makefile:17: pdf] Error 1

I fixed this by setting encoding='utf-8' in the open functions.

My second issue is something I cannot figure out why because it works with mingw64 shell.

Traceback (most recent call last):
  File "D:\Users\Matthew\downloads\thebookofshaders\src\parseBook.py", line 78, in <module>
    modifiedChapterString = re.sub(imgPattern, subPattern, fileString)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\msys64\mingw64\lib\python3.11\re\__init__.py", line 185, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\msys64\mingw64\lib\python3.11\re\__init__.py", line 317, in _subx
    template = _compile_repl(template, pattern)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\msys64\mingw64\lib\python3.11\re\__init__.py", line 308, in _compile_repl
    return _parser.parse_template(repl, pattern)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\msys64\mingw64\lib\python3.11\re\_parser.py", line 1081, in parse_template
    addgroup(int(this[1:]), len(this) - 1)
  File "D:\msys64\mingw64\lib\python3.11\re\_parser.py", line 1017, in addgroup
    raise s.error("invalid group reference %d" % index, pos)
re.error: invalid group reference 10 at position 4
make: *** [Makefile:17: pdf] Error 1

I don't know if windows was ever intended for being built on, but just wanted to file a bug report it fails to build on windows outside of some sort of POSIX emulation.