alexlarsson / gthree

Gthree is a GObject/Gtk+ port of three.js
MIT License
84 stars 13 forks source link

Build failed on 32-bit arches #66

Open tim77 opened 5 years ago

tim77 commented 5 years ago

Failed to build on armv7hl and i686 arches https://koji.fedoraproject.org/koji/taskinfo?taskID=37600791

/usr/lib/gcc/i686-redhat-linux/9/include/stddef.h:424: syntax error, unexpected identifier in '  __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128))));' at '__float128'

Full build log.

alexlarsson commented 5 years ago

Ah, yeah. This seems to be some sort of bug in gobject-introspection. I had to disable that to get it to build on flathub.

Honestly, i have no idea whats causing it, although 32bit vs __float128 might be a hint? @ebassi did you see anything like this in graphene?

alexlarsson commented 5 years ago

Hmm, looking at e.g https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/13 atm. It seems to print similar error messages, but it doesn't actually cause it to crash like this:

Command '['/builddir/build/BUILD/gthree-0.2.0/i686-redhat-linux-gnu/tmp-introspectlplo3b0z/Gthree-1.0', '--introspect-dump=/builddir/build/BUILD/gthree-0.2.0/i686-redhat-linux-gnu/tmp-introspectlplo3b0z/functions.txt,/builddir/build/BUILD/gthree-0.2.0/i686-redhat-linux-gnu/tmp-introspectlplo3b0z/dump.xml']' died with <Signals.SIGSEGV: 11>.

Any chance you could try to get a backtrace for this segfault?

alexlarsson commented 5 years ago

Hmm, I tried to build it in a i386 flatpak runtime and it worked fine...

alexlarsson commented 5 years ago

It still prints the warning, but no segfault.

ebassi commented 5 years ago

g-ir-scanner doesn't know anything about __float128, but it's a system header so it shouldn't matter at all—and it definitely shouldn't segfault.

A trace of the segfault would help.

If you can, also running with GI_SCANNER_DEBUG=save-temps in the environment, and then attaching the generated data dumper files would be nice.

alexlarsson commented 5 years ago

I did some debugging on this on x86-64 (don't have a 32bit fedora install here atm), and while it works here normally if i run the scanner under valgrind it prints a warning and fails like so:

==13113== 
==13113== Memcheck, a memory error detector
==13113== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13113== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==13113== Command: /usr/bin/python3 /gnome/bin/g-ir-scanner -v -I/gnome/include/gobject-introspection-1.0 -I/gnome/include/glib-2.0 -I/gnome/lib/glib-2.0/include -pthread --no-libtool --namespace=Gthree --nsversion=1.0 --warn-all --output gthree/Gthree-1.0.gir --quiet --c-include=gthree/gthree.h -DGTHREE_COMPILATION -I/vcs/gnome/gthree/gthree -I/vcs/gnome/gthree/builddir/gthree -I./. -I../. -I./gthree/. -I../gthree/. --filelist=/vcs/gnome/gthree/builddir/gthree/a0bd3e6@@gthree-1@sha/Gthree_1.0_gir_filelist --include=GObject-2.0 --include=Graphene-1.0 --include=GdkPixbuf-2.0 --include=Gdk-3.0 --symbol-prefix=gthree --identifier-prefix=Gthree --pkg-export=gthree --cflags-begin -D_GNU_SOURCE -I./. -I../. -I./gthree/. -I../gthree/. -I/gnome/include/glib-2.0 -I/gnome/lib/glib-2.0/include -I/gnome/include/graphene-1.0 -I/gnome/lib/graphene-1.0/include -I/gnome/include/gtk-3.0 -I/gnome/include/pango-1.0 -I/gnome/include/harfbuzz -I/gnome/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/gnome/include/cairo -I/gnome/include/pixman-1 -I/usr/include/libdrm -I/gnome/include/gdk-pixbuf-2.0 -I/gnome/include/gio-unix-2.0 -I/gnome/include/atk-1.0 -I/gnome/include/at-spi2-atk/2.0 -I/gnome/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/gnome/include/json-glib-1.0 --cflags-end -L/gnome/lib --library gthree-1 -L/vcs/gnome/gthree/builddir/gthree -L/gnome/lib -L/gnome/lib --extra-library=glib-2.0 --extra-library=gobject-2.0 --extra-library=graphene-1.0 --extra-library=gtk-3 --extra-library=gdk-3 --extra-library=z --extra-library=pangocairo-1.0 --extra-library=pango-1.0 --extra-library=harfbuzz --extra-library=atk-1.0 --extra-library=cairo-gobject --extra-library=cairo --extra-library=gdk_pixbuf-2.0 --extra-library=gio-2.0 --extra-library=json-glib-1.0 --extra-library=epoxy --extra-library=m --sources-top-dirs /vcs/gnome/gthree/subprojects/ --sources-top-dirs /vcs/gnome/gthree/builddir/subprojects/
==13113== 
==13113== Conditional jump or move depends on uninitialised value(s)
==13113==    at 0x4B74CB7: PyUnicode_Decode (unicodeobject.c:3213)
==13113==    by 0x4B74F40: PyUnicode_FromEncodedObject (unicodeobject.c:3096)
==13113==    by 0x4B8B3D6: unicode_new (unicodeobject.c:15042)
==13113==    by 0x4B73164: UnknownInlinedFun (typeobject.c:951)
==13113==    by 0x4B73164: _PyObject_FastCallKeywords (call.c:199)
==13113==    by 0x4B74828: call_function (ceval.c:4619)
==13113==    by 0x4BABFC7: _PyEval_EvalFrameDefault (ceval.c:3124)
==13113==    by 0x4B63549: UnknownInlinedFun (call.c:283)
==13113==    by 0x4B63549: _PyFunction_FastCallDict (call.c:322)
==13113==    by 0x4B379C5: _PyObject_Call_Prepend (call.c:908)
==13113==    by 0x4B722E2: slot_tp_init (typeobject.c:6636)
==13113==    by 0x4B731C6: UnknownInlinedFun (typeobject.c:971)
==13113==    by 0x4B731C6: _PyObject_FastCallKeywords (call.c:199)
==13113==    by 0x4B74828: call_function (ceval.c:4619)
==13113==    by 0x4BABFC7: _PyEval_EvalFrameDefault (ceval.c:3124)
==13113== 
==13130== Warning: invalid file descriptor 1036 in syscall close()
==13130== Warning: invalid file descriptor 1037 in syscall close()
==13130== Warning: invalid file descriptor 1038 in syscall close()
==13130== Warning: invalid file descriptor 1039 in syscall close()
==13130==    Use --log-fd=<number> to select an alternative log fd.
==13130== Warning: invalid file descriptor 1040 in syscall close()
==13130== Warning: invalid file descriptor 1041 in syscall close()
==13130== Warning: invalid file descriptor 1042 in syscall close()
Traceback (most recent call last):
  File "/gnome/bin/g-ir-scanner", line 100, in <module>
    sys.exit(scanner_main(sys.argv))
  File "/gnome/lib/gobject-introspection/giscanner/scannermain.py", line 566, in scanner_main
    process_packages(options, packages)
  File "/gnome/lib/gobject-introspection/giscanner/scannermain.py", line 298, in process_packages
    flags = pkgconfig.cflags(packages)
  File "/gnome/lib/gobject-introspection/giscanner/pkgconfig.py", line 50, in cflags
    return shlex.split(out)
  File "/usr/lib64/python3.7/shlex.py", line 305, in split
    return list(lex)
  File "/usr/lib64/python3.7/shlex.py", line 295, in __next__
    token = self.get_token()
  File "/usr/lib64/python3.7/shlex.py", line 105, in get_token
    raw = self.read_token()
  File "/usr/lib64/python3.7/shlex.py", line 187, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation

Being an uninitialized memory read this could easily behave like a segv on i386 instead. I did some research on this ending up filing a python bug against fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1751208