5

I am new to the Mac OS X environment when it comes to compiling linux based libraries. Whenever I used a library i just downloaded the .framework file, added it to my /Library/Frameworks and included it in my XCODE project, and all was fine. Now I am stuck with libnoise. I want to use it on my project and I have no idea how to generate the .framework file/directory.

Can you help me please?

2 Answers2

1

If you have libnoise, most likely it contains some sort of a Makefile or a configure script.

By running the

 ./configure
 make all

you will get the library file (libnoise.a) for your platform, the OSX10.8.

Framework is essentially a folder with specific layout and a .plist file. To generate such a folder automatically, you may create an expty Xcode project of the type Framework and add the libnoise.a you've just created as a linker's input.

There is a detailed instruction on how to create the Framework from static libraries (.a files): http://www.blackdogfoundry.com/blog/creating-a-library-to-be-shared-between-ios-and-mac-os-x/

You might be missing the header files in you framework, but then can be also added to the Xcode project from libnoise sources.

This SO answer may be of use also: Difference between framework and static library in xcode4, and how to call them

Apple's documentation is also good: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html

Community
  • 1
  • 1
Viktor Latypov
  • 14,289
  • 3
  • 40
  • 55
  • It has no configure script, just a make file. When I run "make all" it gives me an error telling me the make command was not found, despite the fact that I got XCode installed. – user1693266 Sep 24 '12 at 13:05
  • `make` is a part of DevToolsCLI package from the XCode dvd. I might be incorrect about the package name, but `make` is definitely in the package. If you can't find it, use MacPorts to do the `port install gmake`. – Viktor Latypov Sep 24 '12 at 13:21
  • Gave me a bunch of errors like Makefile:56: ../src/module/voronoi.d: No such file or directory and also this at the end http://pastebin.com/BYu9haF3 – user1693266 Sep 24 '12 at 13:51
  • Had the same problem with .d-files. I think it's time for you to sit and write the `gcc -c voronoi.cpp -o voronoi.o` etc. in your own Makefile :( Then combine the .o files to .a library. – Viktor Latypov Sep 24 '12 at 14:25
  • Alright, seems fair. How do I combine then the .o files into the .a library? – user1693266 Sep 24 '12 at 14:35
  • `ar rcs libnoise.a *.o` (rcs - Refresh/Create/Store) – Viktor Latypov Sep 24 '12 at 14:51
  • Finally you may use the libnoise in gcc's options like "-lnoise" (assuming you have the libnoise.a file in an accessible path) – Viktor Latypov Sep 24 '12 at 14:52
  • It's a pain and frustrating to compile. libtool gives me a lot of errors. Any idea on an alternative way to getting an .a file out of it? – user1693266 Sep 24 '12 at 15:59
  • Done it with a different fork and cmake :) Thanks for the help. – user1693266 Sep 24 '12 at 17:44
1

I'm not entirely sure if this is what was meant by "with a different fork and cmake"

but I got libnoise to run in my mac using this git repo.

https://github.com/qknight/libnoise

ardowz
  • 47
  • 8