Comments (11)
Having the same problem - Linux 4.19.27-gentoo-r1 dev-qt/qtcore 5.11.3-r2
while requiring "qt5" (Exception)
Unhandled exception: Error opening file 'crystal' with mode 'r': No such file or directory (Errno)
Failed to raise an exception: END_OF_STACK
[0x558ea0224416] ???
[0x558e9f8ffd79] __crystal_raise +153
[0x558e9f901468] ???
[0x558e9f912ead] ???
[0x558e9f90c32a] ???
[0x558e9f90b53d] ???
[0x558e9f907f20] ???
[0x558e9f93a589] ???
[0x558e9f9049dd] main +45
[0x7f75b09b6ae7] __libc_start_main +231
[0x558e9f8fc40a] _start +42
[0x0] ???
from qt5.cr.
@TheBrainScrambler I am going to close this ticket because a sample project created using the following steps is tested and working:
-
crystal init app test
-
In its
shard.yml
:
name: test
version: 0.1.0
targets:
test:
main: src/test.cr
crystal: 0.34.0
license: MIT
dependencies:
qt5:
github: Papierkorb/qt5.cr
branch: master-ready-to-use
-
Run
shards
-
In
src/test.cr
you can put the hello world code:
require "qt5"
qApp = Qt::Application.new
label = Qt::Label.new "Hello from Crystal/Qt!"
label.show
Qt::Application.exec
- Running
crystal src/test.cr
opens the GUI window
Feel free to open a new issue if you'll have other problems.
from qt5.cr.
Hello again. After following your steps on Arch Linux with crystal
, shards
and qt5-base
installed, it ... doesn't work. Here is the new error :
There was a problem expanding macro 'macro_140018970143472'
Code in lib/qt5/src/qt5/binding.cr:6:1
6 | {% begin %}
^
Called macro defined in lib/qt5/src/qt5/binding.cr:6:1
6 | {% begin %}
Which expanded to:
> 1 |
> 2 |
> 3 | require "./binding/binding_linux-gnu-x86_64-qt5.15"
^
Error: can't find file './binding/binding_linux-gnu-x86_64-qt5.15' relative to '/home/the_pumpkin_man/test/lib/qt5/src/qt5/binding.cr'```
from qt5.cr.
Heya,
This would mean that the Qt bindings have not been generated.
If you use the master
branch then you need to generate the bindings yourself, and this is supported up to version Qt 5.13 (5.14 and 5.15 are not problematic to build, but nevertheless still require some little updates to config/*.yml
files). The instructions how to configure and run the build are included in the README (search for (Re)generating all Qt5 binding versions
and 1 section below it).
To avoid building yourself and use some of the earlier, pre-built versions (as mentioned, up to and including 5.13), switch to the branch master-ready-to-use
. The prebuilt files will be present/existing in the searched location.
Finally, the third thing which is useful to say, is that it would also be useful if the Qt bindings would auto-detect the Qt version already present on the system and build bindings for that version, instead of versions listed in support/generate_bindings.cr
. A patch for this exists in @ZaWertun's fork but needs to be refined and integrated.
Let us know if you need additional assistance/instructions.
from qt5.cr.
Um, I actually followed your instructions, that means I used the master-ready-to-use
branch. But by seeking my Qt version I get 5.15.0-3
. Since your said it is a "problematic" version, does that mean the master-ready-to-use
branch doesn't work on it and I have to generate the bindings myself ?
from qt5.cr.
Correct. You'd have to use the master
branch and generate the bindings yourself by updating support/generate_bindings.cr
and running the generation process. (You would just add a line for Qt 5.15 in that .cr file, and disable/comment all the others (since you only want 5.15).
Then when you run the generation of bindings, it would download Qt 5.15 into the local cache folder, unpack it, and generate bindings from that. This will require about 500MB for the Qt 5.15 archive, and a couple GBs of disk space when unpacked.)
However, as mentioned in previous answer, it won't work out of the box as Qt 5.14 and Qt 5.15 add some new enums, and you will need to add those missing enums to file config/enums.yml
. Also, because these new enums are only present in Qt version 5.14 and later, and some only in Qt 5.15 and later, you will have to wrap them inside "if_...newer_or_5.14" and "if..._newer_or_5.15".
I can't get to doing this myself in the next ~10 days, but you can attempt to do this yourself, and you can ask more specific questions in this ticket. Also @ZaWertun may be able to chime in with help too.
Let us know how it goes.
(Note that if you just want to generate the bindings for yourself without submitting a patch to us, then you don't have to bother with "if...newer" at all. Simply add the missing enums to the file. And, regarding the question of which enums to add -- well, when you run the generation, the build will fail and tell you which enums are missing, so you can take this list and add them. There are about 5 or 6 of them in total if I am not mistaken.)
from qt5.cr.
Oh, sorry then, I don't really want to bother with that ... I just wanted it to work out-of-the-box for testing things, and not trying to generate bindings. Since it isn't really your fault, I will just close this issue. It is an old one anyway.
from qt5.cr.
OK, when we add support for 5.15 I will let you know on this ticket.
from qt5.cr.
I just followed the instruction given to TheBrainScrambler on May, the 29, 2020 and the compiler stopped on this error:
$ crystal src/test.cr
Showing last frame. Use --error-trace for full trace.
In lib/qt5/src/qt5/binding.cr:7:20
7 | {% use_binding = run("#{DIR}/../../support/decide_binding_fast.cr") %}
^--
Error: Error executing run (exit code: 1): /home/alex/Laboratory/Crystal/test/lib/qt5/src/qt5/../../support/decide_binding_fast.cr
stdout:
stderr:
In support/decide_binding_slow.cr:7:8
7 | YAML.mapping(find_paths: Bindgen::FindPath::Configuration)
^------
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)
In support/decide_binding_slow.cr:7:3
7 | YAML.mapping(find_paths: Bindgen::FindPath::Configuration)
^
Warning: expanding macro
There was a problem expanding macro 'mapping'
Called macro defined in /usr/share/crystal/src/yaml/mapping.cr:222:3
222 | macro mapping(**_properties_)
Which expanded to:
> 1 | ::YAML.mapping({find_paths: Bindgen::FindPath::Configuration})
2 |
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)
My configuration is as follows.
$ crystal --version
Crystal 0.35.1 [5999ae29b] (2020-06-19)
LLVM: 8.0.0
Default target: x86_64-unknown-linux-gnu
$ cat /etc/os-release
NAME="Linux Mint"
VERSION="20 (Ulyana)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20"
VERSION_ID="20"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=ulyana
UBUNTU_CODENAME=focal
$ uname -r
5.4.0-59-generic
$ qtdiag SIGINT(2) ↵ 10:22:52
Qt 5.9.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.3.0) on "xcb"
OS: Linux Mint 20 [linux version 5.4.0-59-generic]
Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2
Let me know if I can give you some more info or I can do anything else to fix/bypass this problem.
from qt5.cr.
Hey @alexbottoni it seems to me that the error report you included prints the warnings about YAML.mapping, but not the actual error. Can you check that?
Also please let us know whether you tried to generate the bindings yourself or you used the master-ready-to-use
branch.
from qt5.cr.
Hi docelic. I'm not sure how to extract the actual error. Can you give me instructions?
I used the master-ready-to-use branch. My shard.yml is as follows.
name: test
version: 0.1.0
targets:
test:
main: src/test.cr
crystal: 0.34.0
license: MIT
dependencies:
qt5:
github: Papierkorb/qt5.cr
branch: master-ready-to-use
Anyway, I tried to run the same command with the error tracing activated. Here the result:
$ crystal build src/test.cr --error-trace
In src/test.cr:1:1
1 | require "qt5"
^
Error: while requiring "qt5"
In lib/qt5/src/qt5.cr:5:1
5 | require "./qt5/binding"
^
Error: while requiring "./qt5/binding"
In lib/qt5/src/qt5/binding.cr:6:1
6 | {% begin %}
^
Error: expanding macro
In lib/qt5/src/qt5/binding.cr:7:20
7 | {% use_binding = run("#{__DIR__}/../../support/decide_binding_fast.cr") %}
^--
Error: Error executing run (exit code: 1): /home/alex/Laboratory/Crystal/test/lib/qt5/src/qt5/../../support/decide_binding_fast.cr
stdout:
stderr:
In support/decide_binding_slow.cr:7:8
7 | YAML.mapping(find_paths: Bindgen::FindPath::Configuration)
^------
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)
In support/decide_binding_slow.cr:7:3
7 | YAML.mapping(find_paths: Bindgen::FindPath::Configuration)
^
Warning: expanding macro
There was a problem expanding macro 'mapping'
Called macro defined in /usr/share/crystal/src/yaml/mapping.cr:222:3
222 | macro mapping(**_properties_)
Which expanded to:
> 1 | ::YAML.mapping({find_paths: Bindgen::FindPath::Configuration})
2 |
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)
A total of 2 warnings were found.
Unhandled exception: Error opening directory: '/usr/bin/python3': Not a directory (File::Error)
from ../../../../../../../usr/share/crystal/src/crystal/system/unix/dir.cr:6:5 in 'open'
from ../../../../../../../usr/share/crystal/src/dir.cr:19:12 in 'initialize'
from ../../../../../../../usr/share/crystal/src/dir.cr:17:3 in 'new'
from ../../../../../../../usr/share/crystal/src/dir.cr:31:11 in 'glob'
from ../../../../../../../usr/share/crystal/src/dir/glob.cr:28:3 in 'glob'
from ../../../../../../../usr/share/crystal/src/dir/glob.cr:13:5 in '[]'
from lib/bindgen/src/bindgen/find_path/match_finder.cr:48:9 in 'run_path_try'
from lib/bindgen/src/bindgen/find_path/match_finder.cr:22:11 in 'run_version_check'
from lib/bindgen/src/bindgen/find_path/versioned_match_finder.cr:17:9 in 'collect'
from lib/bindgen/src/bindgen/find_path.cr:76:19 in 'find'
from lib/bindgen/src/bindgen/find_path.cr:49:12 in 'find_all!'
from support/decide_binding_slow.cr:18:1 in '__crystal_main'
from ../../../../../../../usr/share/crystal/src/crystal/main.cr:105:5 in 'main_user_code'
from ../../../../../../../usr/share/crystal/src/crystal/main.cr:91:7 in 'main'
from ../../../../../../../usr/share/crystal/src/crystal/main.cr:114:3 in 'main'
from __libc_start_main
from _start
from ???
Unhandled exception: Support script decide_binding_slow.cr failed (Exception)
from ???
from ???
from __crystal_main
from main
from __libc_start_main
from _start
from ???
Given the error regarding qt5 (that should be correctly installed and available) I tried to re-install shards:
$ shards
Resolving dependencies
Fetching https://github.com/Papierkorb/qt5.cr.git
Failed to update https://github.com/Papierkorb/qt5.cr.git // Have I to worry about this line?
$ shards install
Resolving dependencies
Fetching https://github.com/Papierkorb/qt5.cr.git
Fetching https://github.com/Papierkorb/bindgen.git
Fetching https://github.com/Papierkorb/toka.git
Using toka (0.1.2)
Using bindgen (0.7.0 at 5730ce0)
Using qt5 (0.2.0 at b574f43)
I have got the same error as before. Please note that:
$ qtdiag
Qt 5.9.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.3.0) on "xcb"
OS: Linux Mint 20 [linux version 5.4.0-59-generic]
and:
$ sudo apt-get install qtbase5-dev
...
qtbase5-dev è già alla versione più recente (5.12.8+dfsg-0ubuntu1). // Should it be 5.9.7? apt-get decided for this...
(most recent version already installed)
Let me know if I can be of any help.
from qt5.cr.
Related Issues (20)
- On FreeBSD : require "./qt5/binding" qmake: could not find a Qt installation of '5'
- "Generated on #{Time.now}" error when compiling project using qt5.cr HOT 3
- random invalid memory access HOT 4
- Renewed maintenance of qt5.cr HOT 10
- Building Qt 5.12 bindings on Debian 9 HOT 1
- Qt 5.14 errors HOT 12
- Qt signal handlers are not using type converters HOT 1
- Instructions for new binding versions give error/5.11 does't work on Debian HOT 2
- Archive download locations differ based on versions for generate_bindings HOT 1
- Crystal 1.0.0-dev breaks several QGraphicsItem subclasses
- Marshalling polymorphic Crystal wrappers in QObject HOT 3
- QStringList not mapped HOT 1
- SEGV in operator delete() after DeferredDelete event HOT 1
- Undefined method 'mapping' for YAML:Module HOT 10
- Crystal 1.2 issue HOT 3
- GC frees objects and signal handlers HOT 17
- --ldflags: command not found HOT 2
- Problem to regenerate a specific qt5 binding HOT 3
- Problems with Macs os m1 platform HOT 1
- Build error -- missing method in YAML HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qt5.cr.