lgi-devs / lgi

Dynamic Lua binding to GObject libraries using GObject-Introspection
MIT License
430 stars 69 forks source link

g_object_newv is deprecated starting in glib 2.54 #197

Open saizai opened 6 years ago

saizai commented 6 years ago
Installing https://luarocks.org/lgi-0.9.2-1.src.rock
/Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -C lgi
pkg-config --exists 'gobject-introspection-1.0 >= 0.10.8' --print-errors
touch .depcheck
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o buffer.o buffer.c
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o callable.o callable.c
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o core.o core.c
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o gi.o gi.c
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o marshal.o marshal.c
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o object.o object.c
object.c:576:34: warning: 'g_object_newv' is deprecated [-Wdeprecated-declarations]
      return lgi_object_2lua (L, g_object_newv (gtype, size, params),
                                 ^
/opt/local/include/glib-2.0/gobject/gobject.h:427:1: note: 'g_object_newv' has been explicitly marked deprecated here
GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties)
^
/opt/local/include/glib-2.0/glib/gversionmacros.h:487:49: note: expanded from macro 'GLIB_DEPRECATED_IN_2_54_FOR'
# define GLIB_DEPRECATED_IN_2_54_FOR(f)         GLIB_DEPRECATED_FOR(f)
                                                ^
/opt/local/include/glib-2.0/glib/gmacros.h:432:32: note: expanded from macro 'GLIB_DEPRECATED_FOR'
#define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN
                               ^
/opt/local/include/glib-2.0/glib/gmacros.h:405:29: note: expanded from macro 'G_DEPRECATED_FOR'
#define G_DEPRECATED_FOR(f) G_DEPRECATED
                            ^
/opt/local/include/glib-2.0/glib/gmacros.h:393:37: note: expanded from macro 'G_DEPRECATED'
#define G_DEPRECATED __attribute__((__deprecated__))
                                    ^
1 warning generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -fno-common  -O2 -fPIC -I/opt/local/include -D_REENTRANT -I/opt/local/include/gobject-introspection-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/libffi-3.2.1/include -Wall -Wextra -O2 -g -DGOBJECT_INTROSPECTION_LIBDIR=\"/opt/local/lib\" -c -o record.o record.c
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -bundle -undefined dynamic_lookup -all_load  -o corelgilua51.so buffer.o callable.o core.o gi.o marshal.o object.o record.o -L/opt/local/lib -lgirepository-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation -lffi
echo "return '0.9.2'" > version.lua
/Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -C lgi install
mkdir -p /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lib/lgi
cp corelgilua51.so /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lib/lgi
mkdir -p /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lua
cp ../lgi.lua /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lua
mkdir -p /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lua/lgi
cp class.lua component.lua core.lua enum.lua ffi.lua init.lua log.lua namespace.lua package.lua record.lua version.lua /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lua/lgi
mkdir -p /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lua/lgi/override
cp override/Clutter.lua override/GLib-Bytes.lua override/GLib-Error.lua override/GLib-Markup.lua override/GLib-Source.lua override/GLib-Timer.lua override/GLib-Variant.lua override/GLib.lua override/GObject-Closure.lua override/GObject-Object.lua override/GObject-Type.lua override/GObject-Value.lua override/Gdk.lua override/Gio-DBus.lua override/Gio.lua override/GooCanvas.lua override/Gst.lua override/Gtk.lua override/Pango.lua override/PangoCairo.lua override/cairo.lua /opt/local/share/luarocks/lib/luarocks/rocks/lgi/0.9.2-1/lua/lgi/override
lgi 0.9.2-1 is now installed in /opt/local/share/luarocks (license: MIT/X11)
saizai commented 6 years ago

See: https://github.com/luarocks/luarocks/issues/751 https://github.com/luarocks/luarocks/issues/422

psychon commented 6 years ago

Uhm, what are the issues that are you referring to exactly?

You provided build output with a single warning (that caused five additional notes) and are linking to two issues in LuaRocks that are, as far as I can see, unrelated. I cannot see any issues here.

saizai commented 6 years ago

Just the deprecation. It isn't a blocking error now, but presumably will be at a later point.

psychon commented 6 years ago

I doubt a lot that gobject will ever break its API, but okay.

Also, this symbol was deprecated in version 2.54 and the suggestion is to use g_object_new_with_properties instead. That function only appeared in version 2.54. So this requires some version-specific #if to continue using g_object_newv on older versions.

Actually, the code in question already has a comment that it is there for compatibility with gobject-introspection before version 1, so this code path is not even used currently. (Sigh, three different code paths for creating objects just because the API keeps changing).