Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile chapter 12 for Mac OSX Mountain Lion? #4

Open
bsabiston opened this issue Feb 8, 2013 · 6 comments
Open

compile chapter 12 for Mac OSX Mountain Lion? #4

bsabiston opened this issue Feb 8, 2013 · 6 comments

Comments

@bsabiston
Copy link

For chapter 12, about distance fields, I want to compile the demo for a mac.

I try 'make' on a mac running 10.8.2, and it says

bob$ make
Usage: make Win32 | Linux | MacOSX | clean | distclean
bob$ make MacOSX
./bundle.sh contourdemo
make: ./bundle.sh: No such file or directory

It is probably something extremely simple but what do I need to do?
Thanks!
Bob

@csanta
Copy link

csanta commented Mar 1, 2013

My workaround for that was just to comment that line out. I figured that file never made it into the git branch as I also don't have that file after cloning.

I encountered another problem during the compilation:

ld: can't open output file for writing: contourdemo.app/Contents/MacOS/contourdemo, errno=2 for architecture x86_64

And I solved it by manually creating the directories contourdemo.app/Contents/MacOS/

After that I was able to compile and run the sample code.

@bsabiston
Copy link
Author

I was just thinking I would like to go back and get this working. I commented out that line but I am getting "ld: library not found for -lglfw".

The file 'libglfw.a' is in the demo folder, but I guess it doesn't see it? Is that some environment variable problem or something? Anyone know? Thanks!
Bob

@csanta
Copy link

csanta commented Mar 2, 2013

Yes, it can't find it. You can try bringing it over to your current directory.

@bsabiston
Copy link
Author

It is in the current directory, 'demo'. And I checked my .bash_profile and './' is the last thing in my PATH. That is the only thing I know to check, I'm not very fluent with my UNIX.
Bob

@bsabiston
Copy link
Author

OK -- I added "-L." to the gcc compile line in the Makefile. That got it to see the library. Unfortunately the library provided I think is not for Mac. So I went and downloaded GLFW and compiled it, which seemed to work. But when I put the new libglfw.a in the directory and compile, I get this:

Undefined symbols for architecture x86_64:
"_IOCreatePlugInInterfaceForService", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOIteratorNext", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOMasterPort", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IORegistryEntryCreateCFProperties", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOServiceGetMatchingServices", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOServiceMatching", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
ld: symbol(s) not found for architecture x86_64

So that is weird. Do you know what would cause that? It seems like a problem maybe with the GLFW than this project.
Bob

@bsabiston
Copy link
Author

OK! I needed to add "-framework IOKit" to the end of the gcc line also. Finally I get the same error as @csanta!
I followed his directions about creating the directories. And ... FINALLY! The thing compiles.

And it works! Only it didn't work by double-clicking the 'app', as you might expect. From the terminal you have to go to the inner directory contour demo.app/Contents/MacOS and run 'contourdemo'.

I can't believe it! It works. Hope this lengthy account helps anyone else wanting to run this on Mac in 2013.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants