Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

SDL2_image port command line parser causes an error #4

Open
ooxi opened this issue Dec 25, 2015 · 6 comments
Open

SDL2_image port command line parser causes an error #4

ooxi opened this issue Dec 25, 2015 · 6 comments

Comments

@ooxi
Copy link

ooxi commented Dec 25, 2015

When adding -s SDL2_IMAGE_FORMATS='["png"]' to the command line options, I get the following error python error

Traceback (most recent call last):
  File "C:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line 1128, in <module>
    args = get_bitcode_args([input_file]) + ['-emit-llvm', '-c', '-o', output_file]
  File "C:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line 1108, in get_bitcode_args
    args = system_libs.process_args(args, shared.Settings)
  File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\system_libs.py", line 527, in process_args
    args = port.process_args(Ports, args, settings, shared)
  File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\ports\sdl_image.py", line 55, in process_args
    get(ports, settings, shared)
  File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\ports\sdl_image.py", line 36, in get
    settings.SDL2_IMAGE_FORMATS.sort()
AttributeError: 'str' object has no attribute 'sort'

Replacing settings.SDL2_IMAGE_FORMATS.sort with settings.SDL2_IMAGE_FORMATS = ["png"] in sdl_image.py solves the issue by hard coding the array. The content of settings.SDL2_IMAGE_FORMATS was [png] (I printed it), I think the string -> array conversion is missing

@kripken
Copy link
Member

kripken commented Jan 4, 2016

See test_sdl2_image_formats in tests/test_browser.py, it should be testing this. Does the test not pass for you? Or is the test not covering something that you are using, and we need to improve it?

@ooxi
Copy link
Author

ooxi commented Jan 4, 2016

How do I run the tests? I am using the emscripten binary distribution on windows.

@kripken
Copy link
Member

kripken commented Jan 4, 2016

python tests/runner.py browser.test_sdl2_image_formats should run that test.

@suikki
Copy link

suikki commented Mar 10, 2016

I'm experiencing the same problem. I tried running the test. Stuff seems to compile and run (maybe?) but I just get a "no http server activity" error (same thing with with any other test I tried to run with a command similar to above).

However, when I try to compile my own project it doesn't even compile as the python script crashes (with the same error as the original poster had). To me it seems the problem is related to parsing the command line option in python and I don't imagine the test would be really testing that any way.

I'm running windows also and I suspect that might be the issue.

The test seems to use no single quotes around the array (SDL2_IMAGE_FORMATS=["png"]), but using that just gives another error (mentioned in emscripten-core/emscripten#3831).

@GuilhermeAlanJohann
Copy link

I have exactly the same problem here! Using windows 10.

@tombsar
Copy link

tombsar commented Dec 21, 2016

+1 This error occurs for me on Windows 10, whereas my code compiles fine with the same set of options on Linux.

Edit: I fixed the error by replacing SDL2_IMAGE_FORMATS='["png"]' with SDL2_IMAGE_FORMATS="[""png""]". I guess the problem is that Windows does not interpret the ' characters the same way bash does.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants