Skip to content

Instantly share code, notes, and snippets.

View Crystal compile error
$ CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang gmake
Using /usr/local/bin/llvm-config [version=4.0.0]
/usr/local/bin/clang++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc `/usr/local/bin/llvm-config --cxxflags`
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.
/usr/local/bin/clang -fPIC -c -o src/ext/sigfault.o src/ext/sigfault.c
ar -rcs src/ext/libcrystal.a src/ext/sigfault.o
CRYSTAL_CONFIG_PATH=`pwd`/src ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
Invalid memory access (signal 11) at address 0x7f7fffbefff8
[0x126cb6138336] *CallStack::print_backtrace:Int32 +118
View test.cr
class Any
alias Type = Array(Int32) | String | Nil
getter raw : Type
def initialize(raw)
@raw = raw.as Type
end
def foo
if @raw.responds_to?(:each)
@wmoxam
wmoxam / Running compiler specs
Last active Oct 6, 2016
Testing ysbaddaden:openbsd-support
View Running compiler specs
$ CC=/usr/local/bin/clang crystal run spec/compiler_spec.cr
Using compiled compiler at .build/crystal
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libxml2.so.15.1: warning: warning: strcat() is almost always misused, please use strlcat()
/usr/local/lib/libxml2.so.15.1: warning: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libyaml.so.0.0: warning: warning: sprintf() is often misused, please use snprintf()
View Fail.txt
$ crystal build --release --stats -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
Using compiled compiler at .build/crystal
Parse: 00:00:00.0014303 ( 0.19MB)
Semantic (top level): 00:00:00.7784125 ( 67.32MB)
Semantic (new): 00:00:00.0041213 ( 67.32MB)
Semantic (type declarations): 00:00:00.0730781 ( 75.32MB)
Semantic (abstract def check): 00:00:00.0011441 ( 75.32MB)
Semantic (cvars initializers): 00:00:00.0223832 ( 75.32MB)
Semantic (ivars initializers): 00:00:00.0325921 ( 83.32MB)
Semantic (main): /usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
View fibre.cr
require "thread"
puts Thread.current.current_fiber.inspect
Thread.new { puts Thread.current.current_fiber.inspect }.join
View thread-test.cr
$ crystal threads.cr
#<Thread:0x1023dffc0 @th=nil, @exception=nil, @detached=false, @func=#<Proc(Nil):0x102073f60>, @current_fiber=#<Fiber:0x1023def50: main>>
Invalid memory access (signal 11) at address 0x48
Invalid memory access (signal 11) at address 0x48
Invalid memory access (signal 11) at address 0x48
[4329024091] *CallStack::print_backtrace:Int32 +107
[4329024091] *CallStack::print_backtrace:Int32 +107
[4329024091] *CallStack::print_backtrace:Int32 +107
[4329009207] __crystal_sigfault_handler +55
View Building older versions of crystal on OpenBSD build steps
# Also see: http://wmoxam.com/crystal-openbsd.html
doas pkg_add -i git llvm boehm-gc libevent pcre gmake bash
git clone git@github.com:wmoxam/crystal.git
cd crystal
git checkout tags/0.20.3
wget http://wmoxam.com/public/crystal-0.20.3.tar.gz
View gist:46f0ec35f17d265ebac6e169e50ff774
$ crystal eval 'puts "hi"'
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
hi
$
View Specs
[wmoxam:~/projects/crystal] $ CC=/usr/local/bin/clang gmake spec
./bin/crystal build -o .build/all_spec spec/all_spec.cr
Using compiled compiler at .build/crystal
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
Warning: benchmarking without the `--release` flag won't yield useful results
/usr/local/lib/libxml2.so.15.1: warning: warning: strcat() is almost always misused, please use strlcat()
/usr/local/lib/libgmp.so.9.0: warning: warning: vsprintf() is often misused, please use vsnprintf()
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libgmp.so.9.0: warning: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libyaml.so.0.0: warning: warning: sprintf() is often misused, please use snprintf()
View crystal on OpenBSD
[wmoxam:~/projects/crystal] $ ./crystal eval 'puts "hi"'
Error while requiring "prelude": can't find file 'prelude'
[wmoxam:~/projects/crystal] $ CRYSTAL_PATH=/home/wmoxam/projects/crystal/src ./crystal eval 'puts "hi"'
Error while requiring "prelude"
in ./src/prelude.cr:36: while requiring "file"
require "file"
^