ray icon indicating copy to clipboard operation
ray copied to clipboard

Having trouble installing on OSX

Open jwhitmire opened this issue 13 years ago • 20 comments

I'm trying to install this on a fairly new laptop and can't get it to work in 1.8.7 or 1.9.2. I have homebrew and have installed both glew and libsndfile. When I try to install the gem, it can't find libGLEW:

Building native extensions.  This could take a while...
ERROR:  Error installing ray:
    ERROR: Failed to build gem native extension.

        /Users/jeffwhitmire/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for main() in -lGLEW... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

I'm guessing that when it's building the gem, somehow /usr/local/lib is not in the lib path (not sure if that's LDFLAGS or LD_LIBRARY_PATH). I've tried several attempts at fixing this and came up short. Any help would be appreciated.

jwhitmire avatar Jul 21 '11 04:07 jwhitmire

Have you tried with this?

export LDFLAGS="-L/usr/local/lib"
export CFLAGS="-I/usr/local/include"

Also, what does mkmf.log say?

Mon-Ouie avatar Jul 21 '11 05:07 Mon-Ouie

Wow, thanks for the quick response. I tried that, no luck. I just checked the mkmf.log and found this:


"gcc -o conftest -I/Users/jeffwhitmire/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/jeffwhitmire/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/jeffwhitmire/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -fno-common -pipe -Wextra -Wall -Wno-unused-parameter -std=gnu99 -g -O0 -I/usr/X11/include/freetype2 -I/usr/X11/include -I/usr/X11/include -DSAY_OSX -x objective-c conftest.c  -L. -L/Users/jeffwhitmire/.rvm/rubies/ruby-1.9.2-p290/lib -L. -Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -L/usr/X11/lib -lfreetype -lz -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -L/usr/X11/lib -framework OpenAL -framework OpenGL -framework Cocoa     -lruby.1.9.1-static  -lpthread -ldl -lobjc "
cc1obj: error: /Developer/SDKs/MacOSX10.6.sdk: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

Weird thing is the /Developer/SDKs/MacOSX10.6.sdk directory does exist and looks just fine to me. I'm confused.

jeffwhitmire@004671-LS-PC ~  $ ls -l /Developer/SDKs/MacOSX10.6.sdk
total 8
drwxr-xr-x  4 root  wheel   136 Apr 11 14:00 Developer
drwxr-xr-x  3 root  wheel   102 Jul  5 09:36 Library
-rw-r--r--  1 root  wheel  1207 Apr 11 13:59 SDKSettings.plist
drwxr-xr-x  3 root  wheel   102 Aug 21  2009 System
drwxr-xr-x  9 root  wheel   306 Jul  5 09:36 usr

jwhitmire avatar Jul 21 '11 06:07 jwhitmire

I'm not sure what that sysroot option is for. I don't have it when I compile here. :/

Mon-Ouie avatar Jul 21 '11 06:07 Mon-Ouie

FYI, I've now upgraded to Lion and installed the latest XCode, then uninstalled the gem and tried reinstalling it. I still get the exact same error :(

jwhitmire avatar Jul 23 '11 22:07 jwhitmire

Tried this tonight with a friend on his laptop, and it installed fine, but he also doesn't have the sysroot option in his gem build. I'm really not sure what is causing that on my laptop but it's clearly the cause of this issue. I'd love it if somebody could help me figure out what I need to turn off that would keep this from happening. I really want to play with ray more in depth.

jwhitmire avatar Jul 28 '11 02:07 jwhitmire

At a guess, do you have this parameter somewhere in your env variables? (CFLAGS, maybe)

Mon-Ouie avatar Jul 28 '11 10:07 Mon-Ouie

@jwhitmire where can you find the mkmf.log file, I couldn't find it. I've been having problems installing as well.

ghost avatar Jul 28 '11 10:07 ghost

@secondplanet It will be located in gems/ray-version/ext/mkmf.log, from the gem installation directory (which you can see from gem env).

Mon-Ouie avatar Jul 28 '11 13:07 Mon-Ouie

I have looked for that already with no luck. I grabbed a copy of all of the environment settings on my friends machine where this worked, and I'm going to go over those carefully later looking for differences that may help. I'll report back if I find anything.

jwhitmire avatar Jul 28 '11 13:07 jwhitmire

@jwhitmire It might be the version of Mac you are running. I got it to work fine on Snow Leopard, but not on Tiger.

ghost avatar Jul 28 '11 14:07 ghost

@Mon-Ouie I didn't find it there.

ghost avatar Jul 28 '11 16:07 ghost

@secondplanet, I've tried it on both snow leopard and lion. Also what @Mon-Ouie said is correct about the location of that logfile. Type 'gem env', grab the path(s?) listed under "GEM PATHS:" and you should find it under one of those paths as: /gems/ray-0.1.1/ext/mkmf.log

That's where it is for me

jwhitmire avatar Jul 28 '11 18:07 jwhitmire

I figured out what I was doing wrong: the installation doesn't recognize locally installed glew and libsndfile with Homebrew, they need to be installed as user w/ administrator privileges in /usr/local/.

ghost avatar Aug 15 '11 13:08 ghost

@secondplanet, I'm glad you got your issues resolved. I just tried again with 0.2.0 with no luck.

jwhitmire avatar Aug 22 '11 02:08 jwhitmire

I know this is an old thread, but I am having the same issue. I don't have admin privileges on the computer I am trying to install it on, and the computer I do have admin privileges on is so messed up in terms of command line tools I can badly get anything to work. I tried to install this gem, but it requires libpng 1.6.10 and I have 1.6.13. I can't seem to get around it. my mkmf.log:

 "/usr/bin/clang -o conftest -I/Users/iandrobney/.rvm/rubies/ruby-2.1-head/include/ruby-2.1.0/x86_64-darwin13.0 -I/Users/iandrobney/.rvm/rubies/ruby-2.1-head/include/ruby-2.1.0/ruby/backward -I/Users/iandrobney/.rvm/rubies/ruby-2.1-head/include/ruby-2.1.0 -I.  -I/Users/iandrobney/homebrew/opt/libyaml/include -I/Users/iandrobney/homebrew/opt/readline/include -I/Users/iandrobney/homebrew/opt/libksba/include -I/Users/iandrobney/homebrew/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wextra-tokens  -fno-common -pipe -Wextra -Wall -Wno-unused-parameter -std=gnu99  -I/Users/iandrobney/homebrew/Cellar/freetype/2.5.3_1/include/freetype2 -I/usr/X11/include -DSAY_OSX -x objective-c conftest.c  -L. -L/Users/iandrobney/.rvm/rubies/ruby-2.1-head/lib -L/Users/iandrobney/homebrew/opt/libyaml/lib -L/Users/iandrobney/homebrew/opt/readline/lib -L/Users/iandrobney/homebrew/opt/libksba/lib -L/Users/iandrobney/homebrew/opt/openssl/lib -L. -fstack-protector -L/Users/iandrobney/homebrew/opt/libyaml/lib -L/Users/iandrobney/homebrew/opt/readline/lib -L/Users/iandrobney/homebrew/opt/libksba/lib -L/Users/iandrobney/homebrew/opt/openssl/lib  -L/Users/iandrobney/homebrew/Cellar/freetype/2.5.3_1/lib -lfreetype -lz -lbz2 -L/Users/iandrobney/homebrew/Cellar/libpng/1.6.10/lib -lpng16 -L/usr/X11/lib -framework OpenAL -framework OpenGL -framework Cocoa     -lruby.2.1.0  -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/Users/iandrobney/homebrew/Cellar/libpng/1.6.10/lib'
ld: library not found for -lpng16
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */
 

/Users/iandrobney/homebrew/Cellar/libpng/1.6.13/lib exsists, but /Users/iandrobney/homebrew/Cellar/libpng/1.6.10/lib doesn't. I have tried making a symlink of 1.6.13 as 1.6.10 and also a duplicate, but neither helped. any ideas?

crystalclaw avatar Sep 10 '14 17:09 crystalclaw

I don't have a Mac to test this anymore, but there's no hard dependency on a specific version of libpng, it is generating those flags by calling freetype-config --libs. You should trry and see why that command is output flags that don't work.

Mon-Ouie avatar Sep 12 '14 09:09 Mon-Ouie

I'm not exactly sure how to trace that, but I'll do my best.

I just reran the command, and it output this:

The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

I have a feeling it has something to do with this, but according to what I've found on the internet, it's not going to be possible without sudo. I guess I'll just do my best, and also do a fresh install of os x on my admin computer (home one).

EDIT: I have definently already installed the Xcode developer tools.

crystalclaw avatar Sep 12 '14 17:09 crystalclaw

The command should generate a file (in the same directory as extconf.rb) that shows what command it tried to run exactly.

Mon-Ouie avatar Sep 13 '14 06:09 Mon-Ouie

OK, I'll give that a look when I get back to my computer. I installed 1.6.10, but that didn't work. I'll continue troubleshooting. Thanks for the help. On Sep 13, 2014 1:25 AM, "Mon-Ouie" [email protected] wrote:

The command should generate a file (in the same directory as extconf.rb) that shows what command it tried to run exactly.

— Reply to this email directly or view it on GitHub https://github.com/Mon-Ouie/ray/issues/30#issuecomment-55483393.

crystalclaw avatar Sep 13 '14 13:09 crystalclaw

What is this file called? I found extconf.rb, but is the only files not .c and .h in the ext folder. Edit: also, compiling the gem gives me this warning:

WARNING:  open-ended dependency on yard (>= 0, development) is not recommended
  if yard is semantically versioned, use:
    add_development_dependency 'yard', '~> 0'
WARNING:  open-ended dependency on riot (>= 0, development) is not recommended
  if riot is semantically versioned, use:
    add_development_dependency 'riot', '~> 0'
WARNING:  open-ended dependency on rr (>= 0, development) is not recommended
  if rr is semantically versioned, use:
    add_development_dependency 'rr', '~> 0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help

Edit2: Trying to install result of above also gave me checking for main() in -lGLEW... no

crystalclaw avatar Sep 15 '14 16:09 crystalclaw