Issue building Glib with Homebrew's libglib-2.0 (solution?)



Hello everyone,

I have been running my Gtk3 application under continuous integration and
started seeing issues with building Glib on macOS with Homebrew's libglib-2.0.

I then came across this issue on GitHub and StackOverflow:

  - <https://github.com/Homebrew/homebrew-core/issues/5404>
  - <https://stackoverflow.com/questions/39686986/can-t-install-perl-module-glib-on-os-x-el-capitan>

which boils down the following error:

    ```
    /usr/local/Cellar/glib/2.50.0/include/glib-2.0/glib/gtypes.h:423:3: error: 
'_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
      G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/Cellar/glib/2.50.0/include/glib-2.0/glib/gmacros.h:232:103: note: expanded from macro 
'G_STATIC_ASSERT'
    #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, 
__COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                                                                                          
^~~~~~~~~~~~~~~
    1 error generated.
    ```

After looking at the compilation flags, I noticed that ccflags contained
`-arch x86_64 -arch i386`. Removing `-arch i386` fixed the static
assertion and the build continued.

My solution was to set `ARCHFLAGS`

    ```
    ARCHFLAGS="-arch x86_64" cpanm --verbose Glib
    ```

I hope that helps others that might be seeing the same issues. Perhaps
it may be worth detecting this problem and alerting the user on install?

Cheers,
- Zaki Mughal


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]