Created
January 12, 2010 08:19
-
-
Save larrytheliquid/274999 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'hubris' # best line ever | |
class Target | |
hubris :inline =>"triple::Int->Int; triple n = 3*n" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/local/bin/ghc --make -shared -dynamic -o /var/hubris/cache/Inlinezua98545310b0385107e395d302fc84528.so -optl-Wl,-rpath,/usr/local/stow/ghc-6.12.1/lib/ghc-6.12.1 -lHSrts-ghc6.12.1 /tmp/hubris_XXXXX7794.hs -I/usr/lib/ruby/1.8/x86_64-linux/ /var/hubris/source/Inlinezua98545310b0385107e395d302fc84528.hs /tmp/hubris_interface_XXXXX7794.c -Wall -Werror -fno-warn-unused-imports | |
Linking /var/hubris/cache/Inlinezua98545310b0385107e395d302fc84528.so ... | |
/usr/bin/ld: /tmp/hubris_XXXXX7794.o: relocation R_X86_64_PC32 against undefined symbol `newCAF' can not be used when making a shared object; recompile with -fPIC | |
/usr/bin/ld: final link failed: Bad value | |
collect2: ld returned 1 exit status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
larrytheliquid@netbooktheliquid:~/src/testhubris$ ruby test.rb | |
/var/lib/gems/1.8/gems/hubris-0.0.3/lib/hubris.rb:86:in `hubrify': Hubrify error: (HaskellError) | |
ran |Hubrify --module Inline_a98545310b0385107e395d302fc84528 --output /var/hubris/cache/Inlinezua98545310b0385107e395d302fc84528.so --strict /var/hubris/source/Inlinezua98545310b0385107e395d302fc84528.hs| | |
output|Candidates: ["triple"] | |
Language.Ruby.Hubris.wrap Inline_a98545310b0385107e395d302fc84528.triple (fromIntegral $ fromEnum $ Language.Ruby.Hubris.Binding.RUBY_Qtrue) | |
type of wrap.triple is "Language.Ruby.Hubris.Binding.Value" | |
Exportable: ["triple"] | |
{-# LANGUAGE ForeignFunctionInterface, ScopedTypeVariables #-} | |
module Language.Ruby.Hubris.Exports.Inline_a98545310b0385107e395d302fc84528 where | |
import Language.Ruby.Hubris | |
import qualified Prelude as P() | |
import Language.Ruby.Hubris.Binding | |
import qualified Inline_a98545310b0385107e395d302fc84528 | |
triple :: Value -> Value | |
triple b = (Language.Ruby.Hubris.wrap Inline_a98545310b0385107e395d302fc84528.triple) b | |
foreign export ccall "hubrish_triple" triple :: Value -> Value | |
C: | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define HAVE_STRUCT_TIMESPEC 1 | |
#include <ruby.h> | |
#ifdef DEBUG | |
#define eprintf printf | |
#else | |
int eprintf(const char *f, ...){} | |
#endif | |
VALUE hubrish_triple(VALUE); | |
VALUE triple(VALUE mod, VALUE v){ | |
eprintf("triple has been called\n"); | |
VALUE res = hubrish_triple(v); | |
if (rb_obj_is_kind_of(res,rb_eException)) { | |
eprintf("triple has provoked an exception\n"); | |
rb_exc_raise(res); | |
} else { | |
eprintf("returning from triple\n"); | |
return res; | |
} | |
} | |
extern void safe_hs_init(); | |
extern VALUE Exports; | |
void Init_Inlinezua98545310b0385107e395d302fc84528(){ | |
eprintf("loading\n"); | |
VALUE Fake = Qnil; | |
safe_hs_init(); | |
Fake = rb_define_module_under(Exports, "Inlinezua98545310b0385107e395d302fc84528"); | |
eprintf("defined module Hubris::Exports::Inlinezua98545310b0385107e395d302fc84528:%p\n", Fake); | |
eprintf("Defining |triple|\n"); | |
rb_define_method(Fake, "triple",triple, 1); | |
} | |
/usr/local/bin/ghc --make -shared -dynamic -o /var/hubris/cache/Inlinezua98545310b0385107e395d302fc84528.so -optl-Wl,-rpath,/usr/local/stow/ghc-6.12.1/lib/ghc-6.12.1 -lHSrts-ghc6.12.1 /tmp/hubris_XXXXX8260.hs -I/opt/local/include/ruby-1.9.1 /var/hubris/source/Inlinezua98545310b0385107e395d302fc84528.hs /tmp/hubris_interface_XXXXX8260.c -Wall -Werror -fno-warn-unused-imports | |
Failed: code: ExitFailure 1 | |
err:output: | |
error: | |
/tmp/hubris_interface_XXXXX8260.c:4:18: | |
error: ruby.h: No such file or directory | |
/tmp/hubris_interface_XXXXX8260.c:10:0: | |
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hubrish_triple’ | |
/tmp/hubris_interface_XXXXX8260.c:11:0: | |
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘triple’ | |
/tmp/hubris_interface_XXXXX8260.c:24:0: | |
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Exports’ | |
/tmp/hubris_interface_XXXXX8260.c: In function ‘Init_Inlinezua98545310b0385107e395d302fc84528’: | |
/tmp/hubris_interface_XXXXX8260.c:27:0: | |
error: ‘VALUE’ undeclared (first use in this function) | |
/tmp/hubris_interface_XXXXX8260.c:27:0: | |
error: (Each undeclared identifier is reported only once | |
/tmp/hubris_interface_XXXXX8260.c:27:0: | |
error: for each function it appears in.) | |
/tmp/hubris_interface_XXXXX8260.c:27:0: | |
error: expected ‘;’ before ‘Fake’ | |
/tmp/hubris_interface_XXXXX8260.c:29:0: | |
error: ‘Fake’ undeclared (first use in this function) | |
/tmp/hubris_interface_XXXXX8260.c:29:0: | |
warning: implicit declaration of function ‘rb_define_module_under’ | |
/tmp/hubris_interface_XXXXX8260.c:29:0: | |
error: ‘Exports’ undeclared (first use in this function) | |
/tmp/hubris_interface_XXXXX8260.c:32:0: | |
warning: implicit declaration of function ‘rb_define_method’ | |
/tmp/hubris_interface_XXXXX8260.c:32:0: | |
error: ‘triple’ undeclared (first use in this function) | |
| | |
error || | |
status |256|1 | |
from /var/lib/gems/1.8/gems/hubris-0.0.3/lib/hubris.rb:54:in `hubris' | |
from test.rb:5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment