Archived
This forum has been archived. Please start a new discussion on GitHub.
Using IceRuby 3.2.1 on OSX
in Help Center
I was able to successfully compile IceRuby 3.2.1 using the Ice for OSX binary (with some help from the following:
However, I cannot get Ruby to recognize IceRuby. I followed the directions for Linux by doing (and yes, I substituted /opt/IceRuby-3.2.1/ for where I really have it installed):
However, I get this error message.
Any thoughts as to what might be going on?
)Note that I simply copied Make.rules.Darwin over from the source [C++] package into my Ice's config directory and all worked great.
However, I cannot get Ruby to recognize IceRuby. I followed the directions for Linux by doing (and yes, I substituted /opt/IceRuby-3.2.1/ for where I really have it installed):
Using Ice for Ruby
The Ruby interpreter must be able to locate the Ice extension. One way
to configure the interpreter is to define the RUBYLIB environment
variable as follows:
$ export RUBYLIB=/opt/IceRuby-3.2.1/ruby:$RUBYLIB
This example assumes that your Ice for Ruby installation is located in
the /opt/IceRuby-3.2.1 directory.
In addition, you must modify your PATH environment variable to include
the directory /opt/IceRuby-3.2.1/bin as shown below:
$ export PATH=/opt/IceRuby-3.2.1/bin:$PATH
You must also modify LD_LIBRARY_PATH to include the directory
/opt/IceRuby-3.2.1/lib:
$ export LD_LIBRARY_PATH=/opt/IceRuby-3.2.1/lib:LD_LIBRARY_PATH
To verify that Ruby can load the Ice extension successfully, open a
command window and start the interpreter using irb:
$ irb
irb(main):001:0>
At the prompt, enter
require "Ice"
If the interpreter responds with the value "true", the Ice extension
was loaded successfully. Enter "exit" to quit the interpreter.
However, I get this error message.
>> require "Ice"
LoadError: no such file to load -- IceRuby
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/Ice.rb:11
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from (irb):1
Any thoughts as to what might be going on?
0
Comments
-
Under MacOS LD_LIBRARY_PATH is DYLD_LIBRARY_PATH. Did you use that? Do you also have the Ice libraries (and dependencies) in your DYLD_LIBRARY_PATH and the Ice binaries in your PATH?0
-
Under MacOS LD_LIBRARY_PATH is DYLD_LIBRARY_PATH. Did you use that? Do you also have the Ice libraries (and dependencies) in your DYLD_LIBRARY_PATH and the Ice binaries in your PATH?
Here is an output of all the things I did for compilation:$ export PATH=/Users/tylo/Documents/Programs/Ice-3.2.1/bin:$PATH
$ export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/Ice-3.2.1/lib:$DYLD_LIBRARY_PATH
$ export DYLD_BIND_AT_LAUNCH=1
$ export PATH=$ICE_HOME/bin:$RUBY_HOME/bin:$PATH
$ export LD_LIBRARY_PATH=$ICE_HOME/lib:$LD_LIBRARY_PATH
$ export PYTHONPATH=/Users/tylo/Documents/Programs/Ice-3.2.1/python:$PYTHONPATH
$ export ICE_HOME=/Users/tylo/Documents/Programs/Ice-3.2.1
After doing that, I was able to compile IceRuby from source.
This is an account of everything I did in order to try and configure Ruby to recognize IceRuby:$ export RUBYLIB=/Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby:$RUBYLIB
$ export PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/bin:$PATH
$ export LD_LIBRARY_PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/lib:LD_LIBRARY_PATH
$ export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/lib:DYLD_LIBRARY_PATH
$ export DYLD_LIBRARY_PATH=$ICE_HOME/lib:$DYLD_LIBRARY_PATH
Ruby still gives the following error:LoadError: no such file to load -- IceRuby
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/Ice.rb:11
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from (irb):10 -
Note that you are missing some $ signs.
$ export LD_LIBRARY_PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/lib:LD_LIBRARY_PATH $ export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/libYLD_LIBRARY_PATH
LD_LIBRARY_PATH does nothing under Darwin, so no need to set that stuff.
I expect you are not linking the IceRuby bundle correctly. You need to do something like:c++ -dynamic -bundle -g -ftemplate-depth-128 -Wall -D_REENTRANT -L../../ruby -o ../../ruby/IceRuby.3.2.1.bundle Communicator.o Init.o ImplicitContext.o Logger.o ObjectFactory.o Operation.o Properties.o Proxy.o Slice.o Types.o Util.o -L../../ruby -L../../../cpp/lib -lIce -lSlice -lIceUtil -L/usr/local/lib -lruby
0 -
First, I'd like to thank you for your help so far. It's much appreciated. I've fixed the missing $ sign (good eye), but it did not yield any results, unfortunately.c++ -dynamic -bundle -g -ftemplate-depth-128 -Wall -D_REENTRANT -L../../ruby -o ../../ruby/IceRuby.3.2.1.bundle Communicator.o Init.o ImplicitContext.o Logger.o ObjectFactory.o Operation.o Properties.o Proxy.o Slice.o Types.o Util.o -L../../ruby -L../../../cpp/lib -lIce -lSlice -lIceUtil -L/usr/local/lib -lruby
I don't quite understand what directory I need to be in to do this. Also you mentioned something like this. I'm not experienced enough in Unix Speech to know what half this stuff is doing. Also, I saw no mention of this step in any ReadMe file. Is this not something that should have been accomplished during the Make process? It appears to be part of the compilation process.
Infact, I just stumbled across this, which appeared somewhere during the Make process:c++ -dynamiclib -g -ftemplate-depth-128 -Wall -D_REENTRANT -L../../ruby -o ../../ruby/IceRuby.3.2.1.dy Communicator.o Init.o ImplicitContext.o Logger.o ObjectFactory.o Operation.o Properties.o Proxy.o Slice.o Types.o Util.o -L../../ruby -L/Users/tylo/Documents/Programs/Ice-3.2.1/lib -lIce -lSlice -lIceUtil -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -lruby
It appears to be what you're speaking of, and it has already been done. Are you suggesting I try that command once more?0 -
I don't quite understand what directory I need to be in to do this. Also you mentioned something like this. I'm not experienced enough in Unix Speech to know what half this stuff is doing. Also, I saw no mention of this step in any ReadMe file. Is this not something that should have been accomplished during the Make process? It appears to be part of the compilation process.
The basic issue is that we don't support Ice for ruby on MacOS. Building the IceRuby bundle is Mac specific, therefore it isn't surprising that you didn't find it in a README.It appears to be what you're speaking of, and it has already been done. Are you suggesting I try that command once more?
You need to replace the link step above with a link step that builds a bundle instead of a shared library. You should get what you need by fixing the config/Make.rules.Darwin to have rules like the following:mklibfilename = $(if $(2),$(1).$(2).bundle,$(1).bundle) mksoname = $(if $(2),$(1).$(2).bundle,$(1).bundle) mklibname = $(1).bundle curdir = $(shell pwd) ifeq ($(OPTIMIZE),yes) ifneq ($(embedded_runpath_prefix),) mkshlib = $(CXX) -bundle $(shlibldflags) -o $(1) -install_name $(runpath_libdir)/$(2) $(3) $(4) else mkshlib = $(CXX) -bundle $(shlibldflags) -o $(1) -install_name $(2) $(3) $(4) endif else # Don't use -install_name if we're building a debug version. GDB doesn't honor the # DYLD_LIBRARY_PATH environment variable if a runpath is embedded in the # executables or libraries. mkshlib = $(CXX) -bundle $(shlibldflags) -o $(1) $(3) $(4) endif
0 -
Ok, I went ahead and did what you asked, and re-ran the make process. I believe something went wrong, perhaps because I already ran it once before. Maybe you can see what went wrong?$ make
making all in src
making all in IceRuby
rm -f ../../ruby/IceRuby.3.2.1.bundle
c++ -bundle -g -ftemplate-depth-128 -Wall -D_REENTRANT -L../../ruby -o ../../ruby/IceRuby.3.2.1.bundle Communicator.o Init.o ImplicitContext.o Logger.o ObjectFactory.o Operation.o Properties.o Proxy.o Slice.o Types.o Util.o -L../../ruby -L/Users/tylo/Documents/Programs/Ice-3.2.1/lib -lIce -lSlice -lIceUtil -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -lruby
rm -f ../../ruby/IceRuby.32.bundle
ln -s IceRuby.3.2.1.bundle ../../ruby/IceRuby.32.bundle
rm -f ../../ruby/IceRuby.bundle
ln -s IceRuby.32.bundle ../../ruby/IceRuby.bundle
making all in ruby
make[1]: Nothing to be done for `all'.
Afterwards, I tried testing to see if it worked and received the following error message:LoadError: dlopen(/Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle, 9): Library not loaded: /opt/Ice-3.2/lib/libIce.32.dylib
Referenced from: /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle
Reason: image not found - /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle
from /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/Ice.rb:11
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from (irb):1
The Reason: image not found - /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle was a pretty clear indication to me that something was going amiss during the altered make process.0 -
LoadError: dlopen(/Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle, 9): Library not loaded: /opt/Ice-3.2/lib/libIce.32.dylib
...
The Reason: image not found - /Users/tylo/Documents/Programs/IceRuby-3.2.1/ruby/IceRuby.bundle was a pretty clear indication to me that something was going amiss during the altered make process.
It looks to me like the bundle isn't the issue, I think you have built that correctly. What is going on now is that the loading of the bundle is failing because it is searching for the Ice shared library in the embedded shared library path (/opt/...). Since you haven't installed Ice (otherwise it would find the shared library) the library load is failing. Adding the location of the Ice shared library to your DYLD_LIBRARY_PATH should fix the issue.0 -
Adding the location of the Ice shared library to your DYLD_LIBRARY_PATH should fix the issue.
Are you speaking of this command?export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/lib:$DYLD_LIBRARY_PATH
I had done this before the rebuild with the new make file you requested, but did it once again to make sure. It did not change where ruby was looking for the library.
I also noticed that the path it is looking for is: /opt/Ice-3.2/lib/libIce.32.dylib , but I have Ice-3.2.1.0 -
I think I'll make life easier by putting all the Ice components into /opt
Also, I just found out that TeRK requires Ice 3.1.1, so I'll be getting rid of Ice 3.2.1.
I also found out that making a symbolic linksudo mkdir /opt cd /opt sudo ln -s /Users/tylo/Documents/Programs/IceRuby-3.2.1 /opt/Ice-3.2
likely would have solved my problem in my above post.
EDIT: The "solution" in red didn't actually work...
I'll be back here to report how everything goes...
Thanks,0 -
You said:export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/IceRuby-3.2.1/lib:$DYLD_LIBRARY_PATH
You need to ensure the location of the Ice library is in the DYLD_LIBRARY_PATH, not the IceRuby bundle (that is located from the RUBYLIB environment variable).
Earlier you said:export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/Ice-3.2.1/lib:$DYLD_LIBRARY_PATH
So, assuming the Ice shared library is in that location, then you need to ensure that this is in the DYLD_LIBRARY_PATH.
If, after correctly setting the DY_LIBRARY_PATH, you cannot get it work you have a couple of alternatives. The simplest is for you to install Ice into /opt. Another is to change the build of Ice to not embed the runtime path for the shared library into the Ice library.I also noticed that the path it is looking for is: /opt/Ice-3.2/lib/libIce.32.dylib , but I have Ice-3.2.1.
That is expected. The embedded runtime path for 3.2.1 shared libraries is /opt/Ice-3.2 since 3.2.1 is fully binary compatible with 3.2. From Make.rules:# # The "root directory" for runpath embedded in executables. Can be unset # to avoid adding a runpath to Ice executables. # embedded_runpath_prefix ?= /opt/Ice-$(1VERSION_MAJOR).$(VERSION_MINOR)
0 -
Earlier you said:
export DYLD_LIBRARY_PATH=/Users/tylo/Documents/Programs/Ice-3.2.1/lib:$DYLD_LIBRARY_PATH
Yes, this worked. It's definitely worth just shoving all this stuff in /opt, for certain.
Thanks for all the help, Matthew.0