pixie-lang / pixie

A small, fast, native lisp with "magical" powers
GNU General Public License v3.0
2.35k stars 124 forks source link

Error when running mandelbrot program #525

Open jsgrahamus opened 7 years ago

jsgrahamus commented 7 years ago

Installed pixie today (20170113). Runs 'run-tests.pxi' without a failure. However, aborts when trying to run the mandelbrot program.

Below is the info I thought might be relevant. PC is a 64-bit system with ~4 GB of RAM.

steve@steve-Satellite-L555D:~/pixie$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: xenial steve@steve-Satellite-L555D:~/pixie$ pixie examples/mandelbrot.pxi [/home/steve/pixie /home/steve/pixie/lib /home/steve/pixie/include /home/steve/pixie/../lib /home/steve/pixie/../include .] c++ -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/ffiaUQiQE/ffi.cpp -I /home/steve/pixie -I /home/steve/pixie/lib -I /home/steve/pixie/include -I /home/steve/pixie/../lib -I /home/steve/pixie/../include -I . sdl2-config --cflags -o /tmp/ffiaUQiQE/ffi.out && /tmp/ffiaUQiQE/ffi.out /tmp/ffiaUQiQE/ffi.cpp: In function ‘int main(int, char**)’: /tmp/ffiaUQiQE/ffi.cpp:17:50: error: no matching function for call to ‘DumpValue()’ PixieChecker::DumpValue(SDL_PIXELFORMAT_RGBA8888); ^ In file included from /tmp/ffiaUQiQE/ffi.cpp:2:0: /home/steve/pixie/pixie/PixieChecker.hpp:432:6: note: candidate: template void PixieChecker::DumpValue(T) void DumpValue(T t) ^ /home/steve/pixie/pixie/PixieChecker.hpp:432:6: note: template argument deduction/substitution failed: /tmp/ffiaUQiQE/ffi.cpp: In substitution of ‘template void PixieChecker::DumpValue(T) [with T = ]’: /tmp/ffiaUQiQE/ffi.cpp:17:50: required from here /tmp/ffiaUQiQE/ffi.cpp:17:50: error: ‘’ is/uses anonymous type PixieChecker::DumpValue(SDL_PIXELFORMAT_RGBA8888); ^ /tmp/ffiaUQiQE/ffi.cpp:17:50: error: trying to instantiate ‘template void PixieChecker::DumpValue(T)’ Error: in internal function load-file

in internal function load-reader

Compiling: (with-config {:library SDL2, :cxx-flags [sdl2-config --cflags], :includes [SDL.h]} (defcfn SDL_Init) (defconst SDL_INIT_VIDEO) (defconst SDL_WINDOWPOS_UNDEFINED) (defcfn SDL_CreateWindow) (defcfn SDL_CreateRenderer) (defcfn SDL_CreateTexture) (defconst SDL_PIXELFORMAT_RGBA8888) (defconst SDL_TEXTUREACCESS_STREAMING) (defcfn SDL_UpdateTexture) (defcfn SDL_RenderClear) (defcfn SDL_RenderCopy) (defconst SDL_WINDOW_SHOWN) (defcfn SDL_RenderPresent) (defcfn SDL_LockSurface)) in examples/mandelbrot.pxi at 10:1 (with-config {:library "SDL2" ^ in pixie function with-config

in /home/steve/pixie/pixie/ffi-infer.pxi at 226:10 ~(run-infer config @bodies)))) ^ in pixie function run-infer

in /home/steve/pixie/pixie/ffi-infer.pxi at 207:18 result (read-string (io/run-command cmd-str)) ^ in internal function read-string

RuntimeException: :pixie.stdlib/EOFWhileReadingException Unexpected EOF while reading

steve@steve-Satellite-L555D:~/pixie$


Regarding the first error, I do find DumpValue in PixieChecker.hpp. So I haven't figured out what might be wrong.

zen3d commented 5 years ago

The problem appears to lie in the SDL headers. Specifically, in SDL_pixels.h, SDLPIXELFORMAT* are defined in an anonymous enum as such: enum { SDL_PIXELFORMAT_UNKNOWN, ... etc ... }; If you change the enum in SDL_pixels.h to be defined as: typedef enum { SDL_PIXELFORMAT_UNKNOWN, ... etc ... } SDL_PIXELFORMAT_ENUM; the problem goes away and the mandelbrot example runs successfully.

I have filed a bug with the SDL team as bug #4377. It remains to be seen if and when the SDL team will address this.

zen3d commented 5 years ago

The current version of SDL now fixes this specific issue, but they didn't address any of the other anonymous enums in SDL_pixels.h. I'm sure we can create more failing test cases for the SDL team if we are motivated enough :).