Papierkorb / qt5.cr

Qt5 bindings for Crystal, based on Bindgen
Mozilla Public License 2.0
211 stars 20 forks source link

Error when trying to compile the example. #9

Closed JonnyCodewalker closed 4 years ago

JonnyCodewalker commented 6 years ago

When trying to compile the example i get the following error:

Error in src/test.cr:2: while requiring "qt5"
require "qt5" # Require it!
^
in lib/qt5/src/qt5.cr:5: while requiring "./qt5/binding"
require "./qt5/binding"
^
in lib/qt5/src/qt5/binding.cr:6: expanding macro
{% begin %}
^
in lib/qt5/src/qt5/binding.cr:7: Error executing run (exit code: 1): /home/jonathan/Documents/Crystal/test/lib/qt5/src/qt5/../../support/decide_binding_fast.cr 
stdout:

stderr:
    Error in support/decide_binding_slow.cr:1: while requiring "bindgen/library"
    require "bindgen/library"
    ^
    in lib/bindgen/src/bindgen/library.cr:11: while requiring "./*"
    require "./*"
    ^
    in lib/bindgen/src/bindgen/find_path.cr:2: Good news: Crystal#5445 is fixed, see this file!
    require "./find_path/*"
    ^
    Support script decide_binding_slow.cr failed (Exception)
      from ???
      from __crystal_main
      from main
      from __libc_start_main
      from ../sysdeps/x86_64/start.S:122:0 in '_start'
      from ???
  {% use_binding = run("#{__DIR__}/../../support/decide_binding_fast.cr") %}
                   ^~~
Papierkorb commented 6 years ago

Nice, that's now fixed in 0.24.2. You tripped a trip-wire in bindgen checking for this condition.

Update the dependencies in your qt5.cr and try again.

JonnyCodewalker commented 6 years ago

Ok, either I found another trip-wire or it is something with my system.


 crystal run src/test.cr
cc: error: /home/jonathan/Documents/Crystal/test/lib/qt5/src/qt5/binding/../../../ext/binding_linux-gnu-x86_64-qt5.10.a: No such file or directory
Error: execution of command failed with code: 1: `cc "${@}" -o '/home/jonathan/.cache/crystal/crystal-run-test.tmp'  -rdynamic  /home/jonathan/Documents/Crystal/test/lib/qt5/src/qt5/binding/../../../ext/binding_linux-gnu-x86_64-qt5.10.a -lstdc++ -lQt5Core -lQt5Gui -lQt5Widgets -lpcre -lgc -lpthread /opt/crystal-0.24.2/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`
Papierkorb commented 6 years ago

You're not using the master-ready-to-go branch which you should if you don't want to generate the bindings yourself.

JonnyCodewalker commented 6 years ago

screenshot from 2018-03-11 22-09-39 If it helps, I am on Solus.

ctxcode commented 6 years ago

Hello there,

I had the exact same error. I'm really a beginner at compiled languages. (first day actually). It's looking for a file named "binding_linux-gnu-x86_64-qt5.10.a" , but there is no such file in the "master-ready-to-go" branch. So i tried compiling it myself and it worked. I can now run my program.

What i did:

sudo apt-get install libgc-dev
cd lib/qt5/ext/
make

I had some trouble with "make", so i changed the Makefile

CXXFLAGS := -Wall -Werror -Wno-unused-function -fPIC -fno-rtti -I/usr/include/x86_64-linux-gnu/qt5 -I.
CPPFILES := qt_binding_linux-gnu-x86_64-qt5.10.cpp
OBJFILES := $(CPPFILES:.cpp=.o)
LIBFILE  := binding_linux-gnu-x86_64-qt5.10.a

CC = g++
AR ?= ar
RM ?= rm

Also, i have qt5.5, i changed it to 5.10 in the text above just not to confuse you. But maybe you'll run into different errors then me.

Sidenote: Sorry if what i'm doing is completely wrong. I have no idea how compiled languages work :)

Papierkorb commented 6 years ago

Please don't modify files, the process on how to generate the bindings manually is outlined in the README. (May not have been when you were doing that yet)

Also, that file exists in https://github.com/Papierkorb/qt5.cr/tree/master-ready-to-use/src/qt5/binding

ctxcode commented 6 years ago

I removed all my files and reinstalled the package. Now everything worked from the start. I think it's because i didn't have libgc-dev installed last time. And you need it to compile those bindings.

docelic commented 4 years ago

Closing this ticket as the comments on it seem to indicate that the issue has been fixed a while ago. Please reopen if it persists.