Can't run examples :(
sardaukar opened this issue · comments
I've installed SFML and CSFML and VoidCSFML (I think, new Fedora setup - sorry). This is what I get when I run sudo ldconfig -v | grep sfml
:
libvoidcsfml-network.so.2.4 -> libvoidcsfml-network.so.2.4
libvoidcsfml-audio.so.2.4 -> libvoidcsfml-audio.so.2.4
libvoidcsfml-graphics.so.2.4 -> libvoidcsfml-graphics.so.2.4
libvoidcsfml-window.so.2.4 -> libvoidcsfml-window.so.2.4
libvoidcsfml-system.so.2.4 -> libvoidcsfml-system.so.2.4
libcsfml-audio.so.2.4 -> libcsfml-audio.so.2.4.0
libcsfml-graphics.so.2.4 -> libcsfml-graphics.so.2.4.0
libcsfml-network.so.2.4 -> libcsfml-network.so.2.4.0
libcsfml-window.so.2.4 -> libcsfml-window.so.2.4.0
libcsfml-system.so.2.4 -> libcsfml-system.so.2.4.0
libsfml-window.so.2.4 -> libsfml-window.so.2.4.2
libsfml-system.so.2.4 -> libsfml-system.so.2.4.2
libsfml-network.so.2.4 -> libsfml-network.so.2.4.2
libsfml-graphics.so.2.4 -> libsfml-graphics.so.2.4.2
libsfml-audio.so.2.4 -> libsfml-audio.so.2.4.2
I had to add /usr/local/lib
to /etc/ld.so.conf
for it to work. But now when I run an example, I get:
❯ crystal examples/diagnostics.cr
Error in examples/diagnostics.cr:2: while requiring "crsfml": can't find file 'crsfml' relative to '/home/sardaukar/Code/FOREIGN/crsfml/examples'
require "crsfml"
This is odd, since lib/crsfml
relative to examples points to ../../src
.
What am I doing wrong? Thanks.
Crystal searches lib
in the current directory, not relative to main file.
cd examples && crystal diagnostics.cr
Same thing if I run from the examples dir.
examples git:master ❯ tree
.
├── diagnostics.cr
├── echo.cr
├── flippy_bird.cr
├── gl.cr
├── lib
│ └── crsfml -> ../../src
├── README.md
├── resources
│ ├── background.jpg
│ ├── bird.png
│ ├── font
│ │ ├── Cantarell-Regular.otf
│ │ └── COPYING
│ ├── keyboard-layout.yaml
│ └── shaders
│ ├── blur.frag
│ ├── pixelate.frag
│ └── wave.vert
├── shader.cr
├── shapes.cr
├── simple.cr
├── snakes.cr
├── sound_capture.cr
└── transformable.cr
5 directories, 19 files
examples git:master ❯ crystal diagnostics.cr
Error in diagnostics.cr:2: while requiring "crsfml": can't find file 'crsfml' relative to '/home/sardaukar/Code/FOREIGN/crsfml/examples'
require "crsfml"
^
I don't know...
Might as well show the tree of what's above examples.
The tree was just to show the link is there under lib
but it's still not being picked up by Crystal. Well, thanks anyway.
I actually meant that it could show some information if you provided a tree above.
Anyway, I'd be glad to fix this for you but I don't have the ability to do that through GitHub and don't have any guesses.
The tree above is the rest of this repo.