bartavelle / hruby Goto Github PK
View Code? Open in Web Editor NEWEmbed Ruby in your Haskell program.
License: BSD 3-Clause "New" or "Revised" License
Embed Ruby in your Haskell program.
License: BSD 3-Clause "New" or "Revised" License
The Cabal file for this package should declare Includes: "ruby.h"
and appropriate Extra-Libraries: ...
stanzas because the build fails if those resources aren't available.
Hi,
I have given it a try by adding a flag for Ruby21.
cabal install -f ruby21 hruby
will install without error.
But when I try to install puppet-language
, I get the following errors:
Loading package hruby-0.1.3 ... linking ... ghc: /home/vagrant/projects/language-puppet/.cabal-sandbox/lib/x86_64-linux-ghc-7.6.3/hruby-0.1.3/libHShruby-0.1.3.a: unknown symbol `rb_str_new2'
Could you release 0.2.8 with the latest commit ?
Thanks
Does this library support ruby 2.4.x correctly?
I'm wondering because I managed to compile it, but none of the builds that depend on hruby
, like language-puppet
, link successfully with that resulting package, i.e. I get errors like these ones:
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Bindings.o):(.text+0x253d): more undefined references to `rb_str_new2' follow
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Bindings.o):(.text+0x27bd): undefined reference to `rb_ary_new2'
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Bindings.o):(.text+0x29ab): undefined reference to `rb_ary_new4'
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Helpers.o):(.text+0x478f): undefined reference to `rb_ary_new4'
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Helpers.o):(.text+0x4d5a): undefined reference to `rb_str_new2'
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Helpers.o):(.text+0x5872): undefined reference to `rb_str_new2'
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Helpers.o):(.text+0x621a): undefined reference to `rb_str_new2'
[ 395s] /usr/lib64/ghc-8.0.2/hruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS/libHShruby-0.3.4.3-8m7CsJorZf257hqkjk3RnS.a(Helpers.o):(.text+0x656e): undefined reference to `rb_str_new2'
[ 395s] collect2: error: ld returned 1 exit status
This is the error message I have got:
$ puppetresources -p . --hiera ./tests/hiera.yaml -o puppetmaster --facts-override ./tests/facts-testing.yaml --pdbfile ./tests/facts.yaml
not an array! RBuiltin RSTRING
<main>: [BUG] Segmentation fault
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
We're getting the following error in NixOS:
Running 1 test suites...
Test suite test-roundtrip: RUNNING...
test-roundtrip: Stack "Could not load ./test/test.rb" "cannot load such file -- ./test/test.rb\n"
Test suite test-roundtrip: FAIL
Is it possible that this file is missing from the release archive on Hackage?
hruby > Building library for hruby-0.3.8.1..
hruby > [1 of 4] Compiling Foreign.Ruby.Bindings
hruby > [2 of 4] Compiling Foreign.Ruby.Helpers
hruby >
hruby > /tmp/stack-b1b9478f83173021/hruby-0.3.8.1/Foreign/Ruby/Helpers.hs:123:39: error:
hruby > • Couldn't match type: HM.HashMap k v
hruby > with: Data.Aeson.KeyMap.KeyMap Value
hruby > Expected: [(k, v)] -> Object
hruby > Actual: [(k, v)] -> HM.HashMap k v
hruby > • In the second argument of ‘(.)’, namely ‘HM.fromList’
hruby > In the expression: Object . HM.fromList
hruby > In an equation for ‘toHash’: toHash = Object . HM.fromList
hruby > • Relevant bindings include
hruby > toHash :: [(k, v)] -> Value
hruby > (bound at Foreign/Ruby/Helpers.hs:123:21)
hruby > |
hruby > 123 | toHash = Object . HM.fromList
hruby > | ^^^^^^^^^^^
hruby >
hruby > /tmp/stack-b1b9478f83173021/hruby-0.3.8.1/Foreign/Ruby/Helpers.hs:144:26: error:
hruby > • Couldn't match type: Data.Aeson.KeyMap.KeyMap Value
hruby > with: HM.HashMap a0 a1
hruby > Expected: HM.HashMap a0 a1
hruby > Actual: Object
hruby > • In the first argument of ‘HM.toList’, namely ‘m’
hruby > In the first argument of ‘forM_’, namely ‘(HM.toList m)’
hruby > In the first argument of ‘($)’, namely ‘forM_ (HM.toList m)’
hruby > |
hruby > 144 | forM_ (HM.toList m) $ \(k, v) -> do
hruby > | ^
I would like to make language-puppet
pin that version so I can use aeson- 0.8 which is now the default on archlinux.
Thanks
hruby
would work fine on Windows if not for its Setup
script. Currently, if you try to configure this project, it fails with:
$ cabal configure --enable-tests
Resolving dependencies...
[1 of 1] Compiling Main ( dist\setup\setup.hs, dist\setup\Main.o )
Linking .\dist\setup\setup.exe ...
Configuring hruby-0.3.4.2...
Detected ruby: RubyInfo {rbVersion = (2,4,0), rbInstallName = "ruby", rbIncludes = ["C:/msys64/mingw64/include/ruby-2.4.0","C:/msys64/mingw64/include/ruby-2.4.0/ruby","C:/msys64/mingw64/include/ruby-2.4.0/x64-mingw32","C:/msys64/mingw64/lib/ruby/2.4.0/x64-mingw32"], rbLib = "C:/msys64/mingw64/lib", rbLibName = "x64-msvcrt-ruby240"} cc:["-DRUBY2","-DRUBY21"]
setup.exe: Bad header file: ruby.h
The header file contains a compile error. You can re-run configure with the
verbosity flag -v3 to see the error messages from the C compiler.
If you run cabal configure -v3
, you'll see that ruby.h
is failing with lots of errors to the effect of:
In file included from C:/msys64/mingw64/include/ruby-2.4.0/ruby/io.h:24:0,
from
C:/Users/RyanGlScott/Software/ghc-8.0.2/mingw/x86_64-w64-mingw32/include/sys/stat.h:14,
from C:/msys64/mingw64/include/ruby-2.4.0/ruby/defines.h:106,
from C:/msys64/mingw64/include/ruby-2.4.0/ruby/ruby.h:36,
from C:/msys64/mingw64/include/ruby-2.4.0/ruby.h:33,
from C:\Users\RYANGL~1\AppData\Local\Temp\2696224464.c:1:
C:/msys64/mingw64/include/ruby-2.4.0/ruby/encoding.h:137:1: error: unknown
type name 'VALUE'
VALUE rb_enc_vsprintf(rb_encoding *, const char*, va_list);
^
What's happening here is that MinGW-w64 uses a header file called io.h
, and there's also an io.h
file in C:/msys64/mingw64/include/ruby-2.4.0/ruby
. Normally, this wouldn't be an issue, since all of the Ruby headers refer to its io.h
as ruby/io.h
. But the Setup
script is putting C:/msys64/mingw64/include/ruby-2.4.0/ruby
on the include path, which causes gcc
to pick up the wrong io.h
!
A patch which fixes this issue is:
diff --git a/Setup.hs b/Setup.hs
index e226bae..fcbb77b 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -55,14 +55,13 @@ getRubyInfo = do
Just v -> do
installName <- evalRuby "print RbConfig::CONFIG['RUBY_INSTALL_NAME']"
headerDir <- evalRuby "print RbConfig::CONFIG['rubyhdrdir']"
- headerDir' <- evalRuby "print RbConfig::CONFIG['rubyhdrdir'] + File::Separator + 'ruby'"
archDir <- evalRuby "print RbConfig::CONFIG['rubyarchhdrdir']"
libDir <- evalRuby "print RbConfig::CONFIG['libdir']"
td <- evalRuby "print RbConfig::CONFIG['topdir']"
libName <- evalRuby "print RbConfig::CONFIG['LIBRUBY_SO'].sub(/^lib/,'').sub(/\\.(so|dll|dylib)([.0-9]+)?$/,'')"
return $ RubyInfo <$> pure v
<*> installName
- <*> sequence [headerDir, headerDir', archDir, td]
+ <*> sequence [headerDir, archDir, td]
<*> libDir
<*> libName
I would go ahead and make a pull request with this change, but I first wanted to make sure that this C:/msys64/mingw64/include/ruby-2.4.0/ruby
isn't important. It doesn't seem like it is, since I can still build hruby
on Linux without it, and pkg-config
doesn't think it's needed either:
# Windows
$ pkg-config --cflags ruby-2.4
-IC:/msys64/mingw64/include/ruby-2.4.0/x64-mingw32 -IC:/msys64/mingw64/include/ruby-2.4.0
# Linux
$ pkg-config --cflags ruby-2.3
-I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0
I have this failure using ruby 3.1.4
Not sure if it is the way I am building hruby or the fact that I am now using ruby 3.x.y.
undefined method `current' for Ractor:Class
/nix/store/v001jk4sximy2fn9c704dj64a2vwfxsm-ruby-3.1.4/lib/ruby/3.1.0/psych.rb:727:in `config'
/nix/store/v001jk4sximy2fn9c704dj64a2vwfxsm-ruby-3.1.4/lib/ruby/3.1.0/forwardable.rb:232:in `load_tags='
/nix/store/v001jk4sximy2fn9c704dj64a2vwfxsm-ruby-3.1.4/lib/ruby/3.1.0/psych.rb:737:in `<module:Psych>'
/nix/store/v001jk4sximy2fn9c704dj64a2vwfxsm-ruby-3.1.4/lib/ruby/3.1.0/psych.rb:234:in `<top (required)>'
/nix/store/v001jk4sximy2fn9c704dj64a2vwfxsm-ruby-3.1.4/lib/ruby/3.1.0/yaml.rb:4:in `require'
/nix/store/v001jk4sximy2fn9c704dj64a2vwfxsm-ruby-3.1.4/lib/ruby/3.1.0/yaml.rb:4:in `<top (required)>'
/nix/store/05m5z8ir6akpcz87cv8i8l43pqja7d35-language-puppet-1.5.0-data/share/ghc-9.2.8/x86_64-linux-ghc-9.2.8/language-puppet-1.5.0/ruby/hrubyerb.rb:3:in `require'
Any idea ?
Would you mind releasing the latest version on hackage ?
The reason I am asking is because ghc-mod
is quite buggy with ghc-7.10
particularly when you link cabal sandbox (and I need 0b4b767 on arch linux) ...
Now that stackage built with Ubuntu 16.04, it would be nice try to have it available there.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.