<FromGitter>
<elorest> <RX14> So I finally got it to compile but when i try to run a simple helloworld.cr I get this error, `Error in hello.cr:1: while requiring "prelude": can't find file 'prelude' relative to '/home/pi/crystal'`
akwiatkowski has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 240 seconds]
mgarciaisaia has quit [Quit: Leaving.]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
<FromGitter>
<jipiboily> Unrelatted to Crystal, but did you see GitLab acquired Gitter?
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
<FromGitter>
<drosehn> I received an email from gitter about it.
<Papierkorb>
just saw it in /.
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondi has joined #crystal-lang
<FromGitter>
<ukd1> @jipiboily yep - was leaked this morning1
pawnbox has joined #crystal-lang
<FromGitter>
<elorest> Does anyone know how to fix that issue I posted above about `Error in hello.cr:1: while requiring "prelude": can't find file 'prelude' relative to '/home/pi/crystal'` I can only find one other reference to that error from 2014 but the solution seems out of date. Tried it anyway though.
pawnbox has quit [Ping timeout: 260 seconds]
Raimondi has quit [Ping timeout: 268 seconds]
<FromGitter>
<fridgerator> dumb question, but is prelude.cr in /home/pi/crystal ?
<FromGitter>
<fridgerator> or /home/pi/crystal/lib
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
A124 has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
Raimondi has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
akwiatkowski has joined #crystal-lang
Raimondi has joined #crystal-lang
<FromGitter>
<KCreate> Could you check if crystals environment variables are set?
Raimondi has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mark_66 has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
Raimondi has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
A124 has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 260 seconds]
Raimondi has quit [Ping timeout: 268 seconds]
rolha has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
akwiatkowski has joined #crystal-lang
Raimondi has joined #crystal-lang
gloscombe has joined #crystal-lang
Qchmqs has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
qchmqs_ has joined #crystal-lang
Qchmqs has quit [Ping timeout: 240 seconds]
qchmqs_ has quit [Client Quit]
Qchmqs has joined #crystal-lang
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Qchmqs has quit [Read error: Connection reset by peer]
Qchmqs has joined #crystal-lang
bjz has joined #crystal-lang
alibby has quit [Ping timeout: 264 seconds]
alibby has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Qchmqs has quit [Ping timeout: 240 seconds]
pawnbox has quit [Ping timeout: 260 seconds]
Raimondi has joined #crystal-lang
sija has quit [Quit: Connection closed for inactivity]
Raimondi has quit [Ping timeout: 268 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
Philpax_ has quit [Ping timeout: 240 seconds]
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondi has joined #crystal-lang
<FromGitter>
<lucas-aragno> hey guys, does anyone knows a way/plugin to simulate the `resolve` key from webpack 2 on webpack 1?
Raimondi has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
marius is now known as marius_
bjz has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 258 seconds]
mgarciaisaia has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
akwiatkowski has quit [Ping timeout: 256 seconds]
marius_ is now known as Marius
Raimondi has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sija has joined #crystal-lang
Yxhvd has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
metacortex has joined #crystal-lang
metacortex has quit [Client Quit]
<FromGitter>
<KCreate> Can someone from the Core team please take a look at issue #4115 (https://github.com/crystal-lang/crystal/issues/4115)? ⏎ `File.link` incorrectly creates a symlink instead of a hardlink.
<FromGitter>
<elorest> how do I add that? --unknown?
<FromGitter>
<elorest> sorry go it
<RX14>
i meant in the target :)
<FromGitter>
<elorest> Yeah I saw you had put that above.
<FromGitter>
<elorest> also it appears to work...
<RX14>
nice!
<FromGitter>
<elorest> so let me just try to debrief here really fast. Why do i need to have all the source files available to the binary on my raspberry pi but not when I install it on mac or linux from crenv.
KCreate has quit [Ping timeout: 264 seconds]
<RX14>
when you install using homebrew or crenv you do have all the sources available
<RX14>
it's just handled transparently:
<RX14>
the sources are copied to a location, and then the path to those sources is compiled in to the compiler binary
gloscombe has quit [Remote host closed the connection]
<RX14>
I didn't want to complicate my tutorial with instructions on how to do that because I thought that specifying a path on the raspberry pi while compiling on the desktop could get a bit confusing
<RX14>
if you want you can set CRYSTAL_CONFIG_PATH when cross-compiling the compiler to the same value as you set CRYSTAL_PATH at runtime, and it'll become the default when crystal_path doesn't exist
<FromGitter>
<elorest> So is CRYSTAL_CONFIG_PATH an env var is an option on my cc compiling.
<RX14>
no, on the crystal command you run on the host
<RX14>
CRYSTAL_CONFIG_PATH is read by a macro when compiling the crystal source into the crystal.o you copy to the raspi
<RX14>
so you need to set it on the host
<RX14>
which is why it's confusing :)
<FromGitter>
<elorest> So it's an envvar on my mac or an option?
<RX14>
env var
<FromGitter>
<elorest> Awesome. Thanks. Is there a way to set it so that I don't have to specify the target everytime on my rapsi?
KCreate has joined #crystal-lang
<RX14>
no, that's a compiler bug
<RX14>
i'd report it in the ARM thread you posted in before
<FromGitter>
<elorest> Ok. Thanks so much for your help. Sorry it took so long.
<FromGitter>
<elorest> Hope I don't run into any other weird issues.
KCreate has left #crystal-lang [#crystal-lang]
<RX14>
hopefully we'll be providing release builds for more architectures soon
<RX14>
including ARM
<FromGitter>
<jclem> Does anyone know if it's possible to compile Crystal binaries that can be shared on OS X? Everything I can see seems to imply that it's not possible.
<RX14>
well they can be shared, it's just they need a bunch of libraries from homebrew to be installed
<FromGitter>
<jclem> Yeah, I was kind of starting to see that, but there doesn't appear to be a very easy way to know exactly which libraries my Homebrew formula should require.
<FromGitter>
<jclem> Without trial and error on an OS X VM or something.
<RX14>
run ldd on the executable
<RX14>
or at least thats how it works on linux
<RX14>
you can see the shared libraries it requires
<FromGitter>
<jclem> Ah, okay. yeah it's `otool -L $executable` on Mac OS X apparently
<RX14>
macos has to be different :)
<Papierkorb>
btw, does Mac use ELF or what format is it?
<RX14>
i think it's called mach-o
<RX14>
but it's not ELF
<Papierkorb>
Oh right, it's Mach
<Papierkorb>
what a shame, but probably historic reasons or something
<FromGitter>
<jclem> Eh...I wouldn't know.
<FromGitter>
<jclem> I came across Crystal from @will's recommendation—I'm used to building binaries for CLIs with Go, but Crystal seemed like a better language for building them in (in part because of `OptionParser` vs Go's `flag`), but the compilation part is a bit of a bummer, but it's understandable.
<FromGitter>
<jclem> @RX14 Thanks for your help—ended up having to require installation via Homebrew to get the libraries, but that's not terrible.
<RX14>
yeah hopefully we can figure out a proper solution to this in the future
<RX14>
for linux we can statically compile using musl on an alpine chroot
<RX14>
but for osx? i'm really not sure
Renich has joined #crystal-lang
Renich has quit [Client Quit]
<FromGitter>
<jclem> Does that work for any linux distro, though?
<FromGitter>
<jclem> I just ran `crystal build` on the `crystal-lang/crystal` Docker image, but I haven't tested it yet.
<FromGitter>
<jclem> Seemed easier than using `--cross-compile`.
Renich has joined #crystal-lang
<FromGitter>
<agibralter> Can anyone share an example of Process.run that directs the STDOUT/STDERR from the process to the crystal program's STDIN/STDOUT?
<RX14>
@jclem if it's statically linked why would it not work for any distro?
<RX14>
@agibralter if you check out the docs, you'll see that `output`, `error` and `input` are of type `Stdio`, if you click that you'll see you can set the values to be true to inherit from the parent: https://crystal-lang.org/api/0.21.1/Process.html#run%28command%3AString%2Cargs%3Dnil%2Cenv%3AEnv%3Dnil%2Cclear_env%3ABool%3Dfalse%2Cshell%3ABool%3Dfalse%2Cinput%3AStdio%3Dfalse%2Coutput%3AStdio%3Dfalse%2Cerror%3AStdio%3Dfalse%2Cchdir%3AString%3F%3Dnil%29%3AProcess
<RX14>
%3A%3AStatus-class-method
<RX14>
these doc URLs are way too long
<RX14>
and yes, the docs are pretty confusing on that part
rolha has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<FromGitter>
<agibralter> :) awesome, thank you!
<FromGitter>
<agibralter> And how about this... let's say you have a process that's like a log tail... is there a nice way to Signal::INT.trap { } in the crystal program and then interrupt the Process.run?
<RX14>
keep the process handle around and then terminate it
<RX14>
you'd use Process.new to start the command
<RX14>
which doesn't wait until the cxommand finishes
<RX14>
and then use #kill on the process object you recieve
<RX14>
from the handler
<RX14>
or just exit() and let the kernel kill the children
<RX14>
but that's not quite as nice
alibby1 has joined #crystal-lang
alibby has quit [Ping timeout: 260 seconds]
alibby2 has joined #crystal-lang
<FromGitter>
<agibralter> Ah cool, I'm going to try to give this a whirl
<sardaukar>
RX14: I meant non-blocking IO seems complicated
<RX14>
sardaukar, the IO is already non-blocking in terms of the whole application
<RX14>
what do you need to implement
<RX14>
maybe I can help you with an IO model
<sardaukar>
it's a telnet server - I need to know if a client sends me a message or not
<sardaukar>
so some clients request negotiation params and others don't
<sardaukar>
the only wait to tell is to read on the socket if there's a new message
<sardaukar>
but clients that don't send extra negotiation bytes will freeze if I wait on reads from the socket
<sardaukar>
I guess I could maybe use a channel to send all inbound messages to, but then I guess I'd have two problems :D
<RX14>
well
<FromGitter>
<jclem> Oh, I've been meaning to ask this. Can I initialize an empty hash with a type alias? It's a little annoying to `alias Foo = Hash(String, Bool)` and then immediately `foo = {} of String => Bool` instead of something like `foo = {} of Hash` or `foo : Hash = {}`
<RX14>
Foo.new should work
<RX14>
but it might not
<RX14>
sardaukar, why would using a channel be a problem?
<FromGitter>
<jclem> Oh looks like it does @RX14
<FromGitter>
<jclem> thanks!
<sardaukar>
because then I'd separate the "talking" and "listening" and that sounds like a hassle to keep un sync
<sardaukar>
*in
<RX14>
Hash(Foo, Bar).new >> {} of Foo => Bar in my opinion
<RX14>
butuse whichever you want
<RX14>
sardaukar, do they need to be in sync
<sardaukar>
telnet is request/response so yeah
<RX14>
well it's going to be the same either way isn't it
<RX14>
if you don't respond they won't send a message
<sardaukar>
yeah, I see your point
<sardaukar>
I could give it a show
<RX14>
so you'll read 1 message from the channel and respond
<sardaukar>
*shot
<RX14>
Channel#read will be the same as a libc read
<RX14>
except you can model your message splitting as a blocking loop
<RX14>
instead of having to put your logic in the loop too
<sardaukar>
I'll give it a shot, thanks!
<RX14>
actually no that doesn't buy you anything does it
<sardaukar>
I think you can "funnel" new data onto a channel, right?
<sardaukar>
that's my perception, anyway
<RX14>
yes but then you could just replace channel.send with a function call
<RX14>
which handles the message
<RX14>
this is one place where channels don't help I think
<sardaukar>
crap
<RX14>
except if you need to use a select primitive
<txdv>
If I have Type | Nil, how do I check if it is not equal nil and convert it to Type?
<RX14>
because you can do select over multiple channels including timeout sardaukar
<sardaukar>
oh, select tells you which descriptor has data, right?
<RX14>
well
<RX14>
not quite in crystalk
<sardaukar>
I'm thinking C
<RX14>
in crystal you use it like a case statement
<RX14>
and you provide a block of code for each channel
<RX14>
txdv, use an if statement
<RX14>
if var
<RX14>
and inside the if block if won't be nil
<RX14>
sardaukar, so how does it even work with that negotiation params then
<RX14>
because if it's like you describe there must be a timeout
<RX14>
a small period where you can send it
<sardaukar>
the server sends command as part of the "handshake"
<sardaukar>
and the client, after those, is free to ask for more
<RX14>
but what if it doesn't send it
<txdv>
if i have @chan : Channel(Nil) | Nil
<sardaukar>
command line telnet doesn't (for my current server)
<txdv>
i just have to check if @chan.is_a?(Channel(Nil)); ....; end ?
<sardaukar>
but a specialized client does ask for more, immediately after I send my handshake
<RX14>
txdv, you need to set it as a local variable