Non-blocking error compiling valent
Current Behavior
When I was trying to update valent to e887b7f5d96d6ed1f6100dcb5492f0fbbcdf8dae, I got this:
[271/341] Generating src/libvalent/Valent-1.gir with a custom command (wrapped by meson to set env)
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gutils.h:378: syntax error, unexpected INTEGER, expecting identifier in ' if ((__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 0); if (nth_bit < -1) G_PASTE (_g_boolean_var_, 0) = 1; else G_PASTE (_g_boolean_var_, 0) = 0; G_PASTE (_g_boolean_var_, 0); }), 0)))' at '0'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gutils.h:393: syntax error, unexpected INTEGER, expecting identifier in ' if (nth_bit < 0 || (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 1); if (nth_bit > 8 * 8) G_PASTE (_g_boolean_var_, 1) = 1; else G_PASTE (_g_boolean_var_, 1) = 0; G_PASTE (_g_boolean_var_, 1); }), 0)))' at '1'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gutils.h:408: syntax error, unexpected INTEGER, expecting identifier in ' return (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 2); if (number) G_PASTE (_g_boolean_var_, 2) = 1; else G_PASTE (_g_boolean_var_, 2) = 0; G_PASTE (_g_boolean_var_, 2); }), 1)) ?' at '2'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gstring.h:196: syntax error, unexpected INTEGER, expecting identifier in ' if ((__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 3); if (gstring != ' at '3'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gstring.h:218: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 4); if (gstring == ' at '4'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gstring.h:221: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 5); if (val == ' at '5'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gstring.h:229: syntax error, unexpected INTEGER, expecting identifier in ' if ((__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 6); if (gstring->len + len_unsigned < gstring->allocated_len) G_PASTE (_g_boolean_var_, 6) = 1; else G_PASTE (_g_boolean_var_, 6) = 0; G_PASTE (_g_boolean_var_, 6); }), 1)))' at '6'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gstring.h:232: syntax error, unexpected IF in ' if ((__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 7); if (val + len_unsigned <= end || val > end + len_unsigned) G_PASTE (_g_boolean_var_, 7) = 1; else G_PASTE (_g_boolean_var_, 7) = 0; G_PASTE (_g_boolean_var_, 7); }), 1)))' at 'if'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/glib/gstring.h:232: syntax error, unexpected INTEGER, expecting identifier in ' if ((__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 7); if (val + len_unsigned <= end || val > end + len_unsigned) G_PASTE (_g_boolean_var_, 7) = 1; else G_PASTE (_g_boolean_var_, 7) = 0; G_PASTE (_g_boolean_var_, 7); }), 1)))' at '7'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h:819: syntax error, unexpected INTEGER, expecting identifier in ' do { if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 8); if ((((g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ((weak_pointer)), (((GType) ((20) << (2))))))))) G_PASTE (_g_boolean_var_, 8) = 1; else G_PASTE (_g_boolean_var_, 8) = 0; G_PASTE (_g_boolean_var_, 8); }), 1)) ; else g_assertion_message (((gchar*) 0), "/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h", 819, ((const char*) (__func__)), "'" "G_IS_OBJECT (weak_pointer)" "' should be TRUE"); } while (0);' at '8'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h:819: syntax error, unexpected ')', expecting identifier or '(' in ' do { if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 8); if ((((g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ((weak_pointer)), (((GType) ((20) << (2))))))))) G_PASTE (_g_boolean_var_, 8) = 1; else G_PASTE (_g_boolean_var_, 8) = 0; G_PASTE (_g_boolean_var_, 8); }), 1)) ; else g_assertion_message (((gchar*) 0), "/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h", 819, ((const char*) (__func__)), "'" "G_IS_OBJECT (weak_pointer)" "' should be TRUE"); } while (0);' at ')'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h:822: syntax error, unexpected INTEGER, expecting identifier in ' do { if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 9); if ((weak_pointer) == ' at '9'
/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h:822: syntax error, unexpected ')', expecting identifier or '(' in '# 822 "/nix/store/zhl6wmjjsiclfyy69k37xpc1prswhjmw-glib-2.76.2-dev/include/glib-2.0/gobject/gobject.h"' at ')'
/build/source/src/libvalent/device/valent-packet.h:59: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 10); if (packet == ' at '10'
/build/source/src/libvalent/device/valent-packet.h:66: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 11); if ((node = json_object_get_member (root, "id")) == ' at '11'
/build/source/src/libvalent/device/valent-packet.h:71: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 12); if ((node = json_object_get_member (root, "type")) == ' at '12'
/build/source/src/libvalent/device/valent-packet.h:75: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 13); if ((node = json_object_get_member (root, "body")) == ' at '13'
/build/source/src/libvalent/device/valent-packet.h:80: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 14); if ((node = json_object_get_member (root, "payloadSize")) != ' at '14'
/build/source/src/libvalent/device/valent-packet.h:84: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 15); if ((node = json_object_get_member (root, "payloadTransferInfo")) != ' at '15'
This error doesn't block the build though.
Expected Behavior
idk
Desktop
GNOME Shell
Other Desktop
No response
Operating System
NixOS unstable
Installed from
Built from source (Other)
Version
1.0.0.alpha
Devices
No response
Plugins
No response
Logs
No response
Screenshots
No response
Interesting, thanks for reporting!
I guess this is something funky the compiler might be doing.
/build/source/src/libvalent/device/valent-packet.h:59: syntax error, unexpected INTEGER, expecting identifier in ' if (__builtin_expect (__extension__ ({ int G_PASTE (_g_boolean_var_, 10); if (packet == ' at '10'
This should be packet == NULL, where NULL should be pre-processed to 0L. Do you happen to know what compiler/linker you built with? I didn't think 0 would ever get optimized away :upside_down_face:
This should be
packet == NULL, whereNULLshould be pre-processed to0L. Do you happen to know what compiler/linker you built with? I didn't think0would ever get optimized away upside_down_face
gcc (GCC) 12.2.0
GNU ld (GNU Binutils) 2.40
Hmm, I can't seem to reproduce this. Has it reoccurred for you since that time?
Hmm, I can't seem to reproduce this. Has it reoccurred for you since that time?
Yes.
Aleksana-Laptop :: ~/works/nix-experimental/valent ❯ gcc --version
gcc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Aleksana-Laptop :: ~/works/nix-experimental/valent ❯ cmake --version
cmake version 3.25.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Aleksana-Laptop :: ~/works/nix-experimental/valent ❯ meson --version
1.1.0
Aleksana-Laptop :: ~/works/nix-experimental/valent ❯ vala --version
Vala 0.56.7
Aleksana-Laptop :: ~/works/nix-experimental/valent ❯ ninja --version
1.11.1
Aleksana-Laptop :: ~/works/nix-experimental/valent ❯ glib-compile-resources --version
2.76.2
idk, maybe caused by specific vala version. Will update nixpkgs and try again later.
Tested with vala 0.48.25 and 0.54.9 (These versions happens to be in Nixpkgs). The same.
Also can reproduce with gcc 11.3.0 and clang 11.1.0
I still can't seem to reproduce this, but I think if this were a compiler bug someone else would have hit it.
My best guess is that something in Valent's build configuration allows compiling with options that result in this output. If possible, could you try building with --buildtype=release? I think distributions like NixOS usually default to --buildtype=plain and set desired flags, but I'm curious if there's something the meson configuration doesn't account for.
My best guess is that something in Valent's build configuration allows compiling with options that result in this output. If possible, could you try building with
--buildtype=release? I think distributions like NixOS usually default to--buildtype=plainand set desired flags, but I'm curious if there's something the meson configuration doesn't account for.
That doesn't change anything. But I've tested the binary and everything is functional. I'll ignore it for now.
Okay, let's just leave this open and deal with it if it becomes a problem, or magically fixes itself.
I'm getting the same error gom-build.log
Thanks!
It seems like this error is not related to Valent, since it's happening in other GLib-based projects on NixOS. I'd recommend opening an issue for this, since it may affect a number of applications and libraries.