Skip to content

Instantly share code, notes, and snippets.

@inc0der
Last active November 16, 2023 19:51
Show Gist options
  • Save inc0der/48f1923ea29b3df38bbb0b3069103697 to your computer and use it in GitHub Desktop.
Save inc0der/48f1923ea29b3df38bbb0b3069103697 to your computer and use it in GitHub Desktop.
Fix for linc_dialogs in arch

There is a small problem using linc_dialogs in Arch linux which I came across when building an app with Ceramic.

The problem with compiling the app in Arch is it could not find the glib-2.0 includes, this is because in the linc_dialogs.xml the glib path is set to an incorrect path which may be the correct path for Debian based distrubitions like Ubuntu.

to fix this I simply replaced line 32 with this line below, essentially changing the path to the correct location at usr/lib/glib-2.0

<compilerflag value="-I/usr/include/glib-2.0" if="USE_GTK3" />

After fixing that there was a new issue caused by harfbuzz, I found a solution in the Haxe discord server, it was as simple as changing line 48 so that it's included with gtk3.0 as well.

<compilerflag value="-I/usr/include/harfbuzz"/>

If you're lazy and want to do a quick copy and paste, here is my full xml file.

<xml>

    <set name="USE_GTK3" value="1"/>

    <set name="GTK_PATH" value="/usr/lib/x86_64-linux-gnu/gtk-2.0" if="HXCPP_M64"/>
    <set name="GTK_GLIB_PATH" value="/usr/lib/x86_64-linux-gnu/glib-2.0" if="HXCPP_M64"/>
    <set name="GTK_PATH" value="/usr/lib/i386-linux-gnu/gtk-2.0" unless="HXCPP_M64"/>
    <set name="GTK_GLIB_PATH" value="/usr/lib/i386-linux-gnu/glib-2.0" unless="HXCPP_M64"/>

<!-- <error value="err - ${GTK_GLIB_PATH}" /> -->

    <files id="linc_dialogs">

      <cache value="1" />
      <compilerflag value="-I${LINC_DIALOGS_PATH}/linc"/>

      <section if="mac">
        <file name="${LINC_DIALOGS_PATH}/linc/linc_dialogs_mac.mm" />
      </section>

      <section if="windows">
        <file name="${LINC_DIALOGS_PATH}/linc/linc_dialogs_windows.cpp" />
      </section>

      <section if="linux">

      <file name="${LINC_DIALOGS_PATH}/linc/linc_dialogs_linux.cpp" />

        <!-- gtk 3 only -->
      <compilerflag value="-I/usr/include/gtk-3.0" if="USE_GTK3" />
      <compilerflag value="-I/usr/include/glib-2.0" if="USE_GTK3" />

      <!-- gtk 2 and 3 -->
        <compilerflag value="-I/usr/include/libpng12"/>
        <compilerflag value="-I/usr/include/atk-1.0"/>
        <compilerflag value="-I/usr/include/cairo"/>
        <compilerflag value="-I/usr/include/gdk-pixbuf-2.0"/>
        <compilerflag value="-I/usr/include/pango-1.0"/>
        <compilerflag value="-I/usr/include/gio-unix-2.0/"/>
        <compilerflag value="-I/usr/include/freetype2"/>
        <compilerflag value="-I/usr/include/glib-2.0"/>
        <compilerflag value="-I/usr/include/pixman-1"/>
        <compilerflag value="-I/usr/include/harfbuzz"/>

      <!-- gtk 2 only -->
        <compilerflag value="-I/usr/include/gtk-2.0" if="USE_GTK2"/>
        <compilerflag value="-I${GTK_PATH}/include" if="USE_GTK2"/>
        <compilerflag value="-I${GTK_GLIB_PATH}/include" if="USE_GTK2"/>

      </section>

    </files>

    <files id="haxe">
      <compilerflag value="-I${LINC_DIALOGS_PATH}/linc"/>
    </files>

   <target id="haxe">

      <files id="linc_dialogs" />

      <section if="mac">
        <vflag name="-framework" value="Cocoa" />
        <vflag name="-framework" value="Foundation" />
      </section>

      <section if="windows">
        <lib name="comdlg32.lib" />
        <lib name="ole32.lib" />
      </section> <!-- windows -->

      <section if="linux">
        <!-- These are from `pkg-config --libs gtk+-3.0` -->
        <lib name="-lgtk-3" if="USE_GTK3"/>
        <lib name="-lgdk-3" if="USE_GTK3"/>
        <lib name="-lcairo-gobject" if="USE_GTK3"/>

        <!-- from both gtk3 and gtk2 -->
        <lib name="-latk-1.0"/>
        <lib name="-lgio-2.0"/>
        <lib name="-lpangocairo-1.0"/>
        <lib name="-lgdk_pixbuf-2.0"/>
        <lib name="-lpango-1.0"/>
        <lib name="-lcairo"/>
        <lib name="-lgobject-2.0"/>
        <lib name="-lglib-2.0"/>

        <!-- These are from `pkg-config --libs gtk+-2.0` -->
        <lib name="-lgtk-x11-2.0" if="USE_GTK2"/>
        <lib name="-lgdk-x11-2.0" if="USE_GTK2"/>
        <lib name="-lpangoft2-1.0" if="USE_GTK2"/>
        <lib name="-lfontconfig" if="USE_GTK2"/>
        <lib name="-lfreetype" if="USE_GTK2"/>
      </section>

   </target>
</xml>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment