Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

monsieurpaul

macrumors regular
Original poster
Oct 8, 2009
230
0
Hello all,

Sorry for the long and messy post but I am juggling with concepts I don’t fully understand.

My goal (self-imposed as a way to learn Objective-C/Cocoa) is to create a Mac app for creating QR Codes (the 2D barcodes). I don’t want that my app relies on another website (zxing or kaiwa for example) for doing all the work and I found a C library (libqrencode) that seems to fit the bill. Now come the questions…

According to the documentation of this library I must build it using ./configure, make, make install. I understand this for a program but not so well for a library. What will be the result of the build? A .dylib file?

When I try to build the library the official way, the compiler tell me that I need to have the library libpng installed. I understand that this library is replaced in Cocoa by another so it gives me 2 choices :
- I install libpng and go on. Easier (or rather less difficult) but not very satisfying and I think my app using libpng would never makes it to the App Store (one can dream…)
- I rewrite the part of the library using libpng (I found only 1 function using it). Much more difficult and much more satisfying.

My first try (quick and dirty) was to include all the .c and .h files of the sources directly in my project. Is it feasible? Acceptable?

And last but not least, is this legit? The library is licensed under the GNU Lesser General Public License. I understand that I can use it in a commercial software?

I have tried first to google my way out of these questions but I have been overwhelmed by all the information I found…

Thank you,

Paul
 
Last edited:
Now come the questions…

According to the documentation of this library I must build it using ./configure, make, make install. I understand this for a program but not so well for a library. What will be the result of the build? A .dylib file?

Depending on how it's built, you SHOULD get an .so file. You would then include this file in your library path, plus the relevant .h files in your compile path so you can compile.

And last but not least, is this legit? The library is licensed under the GNU Lesser General Public License. I understand that I can use it in a commercial software?

LGPL permits the use of the library within the commercial program, so you will be fine.
 
My first try (quick and dirty) was to include all the .c and .h files of the sources directly in my project. Is it feasible? Acceptable?

I would just install qrencode via MacPorts. This is will give you libqrencode compiled as a .dylib in /opt/local/lib and the header files in /opt/local/include.

You'd just need to add /opt/local/lib to the library search path and /opt/local/include to the header search path in your Xcode project, as well as link to libqrencode.

I think my app using libpng would never makes it to the App Store
I have app's from the app store that utilise external 3rd-party libraries. Apple wouldn't object to this (I don't think they object to this even on the iPhone/iPad). You'd just need to include the .dylib file in your application bundle.
 
Hello,

I am reactivating this thread because of a new problem. After recompiling the library (libqrencode), adding the dylib in the project files and the search paths in the project settings, I am able to use the library in my app.
However, when I install the application on another Mac, it crashes with the message that it can't find the external dylib.
That makes sense, but how can I add a copy of this library in my application so that it can works on whatever Mac I install it ?

thanks,

Paul
 
Embedding a Private Framework in Your Application Bundle

http://developer.apple.com/library/...orks.html#//apple_ref/doc/uid/20002258-106880


Also see the dyld man page, especially the @executable_path, @loader_path, and @rpath prefixes:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/dyld.1.html

You will also need to use 'otool' to inspect and/or change the path by which your embedded dylib is loaded. There's a link to otool's man page at the bottom of the dyld man page.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.