Giter Club home page Giter Club logo

Comments (21)

bohonghuang avatar bohonghuang commented on July 19, 2024 1

@binarydigitz01 Sure. All the cffi foreign libraries required by cl-gtk4 are defined in cl-gobject-introspection:

(eval-when (:compile-toplevel :load-toplevel :execute)
  (cffi:define-foreign-library gobject
    (:darwin "libgobject-2.0.dylib")
    (:unix (:or "libgobject-2.0.so.0" "libgobject-2.0.so"))
    (:windows "libgobject-2.0-0.dll")
    (t "libgobject-2.0"))
  (cffi:define-foreign-library girepository
    (:darwin "libgirepository-1.0.dylib")
    (:unix (:or "libgirepository-1.0.so" "libgirepository-1.0.so.1"))
    (:windows (:or "libgirepository-1.0.dll" "libgirepository-1.0.0.dll"
                   "libgirepository-1.0-1.dll"))
    (t "libgirepository-1.0")))

where the shared library names could be replaced with the absolute paths to them in your system and these libraries are loaded by cffi. Other shared libraries required by GObject-based library like GTK4 is loaded by libgirepository, not by cffi, and the invocation to GTK4 function is delegated to libgirepository too. This library could be loaded without problem, which means cffi can load libgirepository and query the functions in GTK4, but it failed to call these functions through it. So the error may occur in libgirepository, instead of cffi.

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024 1

Yeah that was the issue TYSM for your time!

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024 1

hmmm ig so, but actually i was pulling libraries from unstable repo, switching to stable seems to have to fixed it for me...

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

Here is my $LD_LIBRARY_PATH
/nix/store/ans0zi3b9k02ikks810np7i87j5vvsip-gobject-introspection-1.74.0/lib:/nix/store/5rj03qmq4i4vb872r3bb0vhsk2xcv57m-glib-2.74.1/lib:/nix/store/ry57by1j7yfnhv6iij7cibd0n7alk5sw-gtk4-4.8.2/lib:/nix/store/ry57by1j7yfnhv6iij7cibd0n7alk5sw-gtk4-4.8.2/bin

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

@binarydigitz01 Can you provide some detailed information, such as the call stack where the error occurred? You may try this example in Python to test out whether gobject-introspection works fine in your system.

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

Stack Trace :

 0: ((LAMBDA (&REST GIR::ARGS-IN) :IN GIR::BUILD-FUNCTION) "org.bohonghuang.cl-gtk4-example" 0)
 1: (GTK4.EXAMPLE:SIMPLE)
 2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (GTK4.EXAMPLE:SIMPLE) #<NULL-LEXENV>)
 3: (EVAL (GTK4.EXAMPLE:SIMPLE))

Sure I'll check out the python example

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

I checked it out, and the python example works as expected.

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

@binarydigitz01 Can you print out the value of (gir::repository-get-search-path) after loading cl-gtk4?

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024
("/nix/store/fhbrxggdwy28dzbcqxf25slxrp1vfk96-gdk-pixbuf-2.42.10/lib/girepository-1.0"
 "/nix/store/dinn3b9mh7d0wcwhkyqyqmz3lw793glh-graphene-1.10.8/lib/girepository-1.0"
 "/nix/store/iwr05lr9cnwnpd5p3h4v5cj7wdij0rsy-harfbuzz-5.2.0/lib/girepository-1.0"
 "/nix/store/l49qnb6j4516dxjjja12zmq4ydldmmak-pango-1.50.11/lib/girepository-1.0"
 "/nix/store/5adcsapgip7glpwibkqly9bh8q6fgdl7-gsettings-desktop-schemas-43.0/lib/girepository-1.0"
 "/nix/store/ry57by1j7yfnhv6iij7cibd0n7alk5sw-gtk4-4.8.2/lib/girepository-1.0"
 "/nix/store/ans0zi3b9k02ikks810np7i87j5vvsip-gobject-introspection-1.74.0/lib/girepository-1.0"
 "/nix/store/ans0zi3b9k02ikks810np7i87j5vvsip-gobject-introspection-1.74.0/lib/girepository-1.0")

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

@binarydigitz01 Sorry, I'm not very familiar with the Nix-like system. Can you find the file like /usr/share/gir-1.0/Gtk-4.0.gir and check out the field shared-library in it? In my machine, it looks like this:

<repository version="1.2"
            xmlns="http://www.gtk.org/introspection/core/1.0"
            xmlns:c="http://www.gtk.org/introspection/c/1.0"
            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
  <include name="Gdk" version="4.0"/>
  <include name="Gsk" version="4.0"/>
  <package name="gtk4"/>
  <c:include name="gtk/gtk.h"/>
  <namespace name="Gtk"
             version="4.0"
             shared-library="libgtk-4.so.1"
             c:identifier-prefixes="Gtk"
             c:symbol-prefixes="gtk">
...

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

Can you tell me what library does install that file? Having trouble finding it myself

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

@binarydigitz01 It belongs to gtk4 in my system.

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

I can't really seem to find it, let me go talk to other nixos users, and I'll get back to you

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

I have successfully loaded the library by setting the LD_LIBRARY_PATH to all the libraries mentioned. The $LD_LIBRARY_PATH also contains the location of gtk4/lib directory

@binarydigitz01 All right. You can also try adding the paths to these libraries to cffi:*foreign-library-directories* before loading cl-gtk4 instead of setting up LD_LIBRARY_PATH. To recompile the library, you may need to clean up the cache directory of the Lisp implementation first.

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

Finally found it. It's at /nix/store/q7rwmj163mk4dkar5wcbkdmha71518jq-gtk4-4.8.2-dev/share, the field shared-library is: /nix/store/ry57by1j7yfnhv6iij7cibd0n7alk5sw-gtk4-4.8.2/lib/libgtk-4.so.1

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

it seems that that the gtk4-dev directory isn't found by cffi...

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

it seems that that the gtk4-dev directory isn't found by cffi...

Have you tried resetting LD_LIBRARY_PATH and adding the paths to libgobject-2.0.so and libgirepository-1.0.so into cffi:*foreign-library-directories*? Theoretically, gtk4-dev is not mandatory for this library, and /nix/store/ry57by1j7yfnhv6iij7cibd0n7alk5sw-gtk4-4.8.2/lib/libgtk-4.so.1 seems existent in your system and can be loaded by gobject-introspection in Python, so it should work without problem.

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

I tried setting cffi:foreign-library-directories, but it didn't work. It seems this is more of a cffi isuue than cl-gtk4. Could you please tell me how exactly cffi works, and what all does cl-gtk4 need, so i could ask the devs of cffi as well?

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

Sorry, I believe i forgot to mention the complete error:
Could not locate gtk_application_new: /nix/store/v6szn6fczjbn54h7y40aj7qjijq7j6dc-glibc-2.34-210/lib/libm.so.6: version `GLIBC_2.35' not found (required by /nix/store/63d8pp6a9i2p9bmsd0n1dvsqslmf20dn-cairo-1.16.0/lib/libcairo.so.2)

It seems that cairo is the one throwing the error, not cffi. So it's a problem on my end.

from cl-gtk4.

binarydigitz01 avatar binarydigitz01 commented on July 19, 2024

I have glibc-2.74.1, not 2.35, so that might be an issue

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

I have glibc-2.74.1, not 2.35, so that might be an issue

Maybe you are confusing glibc and glib2. The latter serves as a fundamental library for GObject-based libraries, while the former is the basis for your system to run

from cl-gtk4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.