Custom cocoa installers and application dependencies - cocoa

I am working on a Cocoa application that uses FTP and SFTP transfers, and the best way I've found to accomplish this is by using libcurl. Now I'm pretty sure that Mac OS X does not ship with libcurl installed, and even if it did it most likely wasn't built with libssh, which I would also need.
The only solution I can come up with in my head is to ship my application with a pre-built version of libcurl. Create some kind of custom installer to check the users computer for libcurl and install the prebuilt version if necessary. Am I correct with this? Seems like there might be a better way.
...and if a custom installer is what I need, can anyone point me at a good tutorial?

You can use install_name_tool to change the search path of dynamically linked libraries.
Using #executable_path you can use paths relative to your applications executable file and then place the libraries either in your frameworks folder ("#executable_path/../Frameworks/libcurl.dylib") or inside the executable directory (e.g. "#executable_path/lib/libcurl.dylib").
This way you can build your own dynamically linked libraries and ship them inside your application bundle.

Now I'm pretty sure that Mac OS X does not ship with libcurl installed, …
Yes, it does:
curl --version %~(0)
curl 7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
… and even if it did it most likely wasn't built with libssh, which I would also need.
Correct: It doesn't.
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IPv6 Largefile NTLM SSL libz
You may find it simpler to build your libcurl as a static library, and link against that, than to build a shared library and copy it into your app's Frameworks subdirectory.

What makes you sure that OS X doesn't ship with libcurl?
$ locate libcurl
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libcurl.2.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libcurl.3.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libcurl.4.0.0.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libcurl.4.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libcurl.dylib
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libcurl.2.dylib
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libcurl.3.dylib
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libcurl.4.dylib
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libcurl.dylib
Either way, if you need your own, just put it in your bundle.

Maybe you want to have a look at ConnectionKit before using libcurl.

Related

dylib to dylib pathing on mac osx, how to make rpath work on mac?

We have a project which dynamically links against several dylibs. When copy the build to another mac. One need to run "otool" over the dylibs and executable in order to fix the shared library paths in them during "install".
Looks like OSX had some strange requirements for DLL to DLL pathing that made relative paths not work in them (i.e: using rpath). My questions here:
what is the the normal way to ship a software on mac? i.e: when running either a .pkg or .dmg installer, how one make sure the dylibs installed are able to link against each other in relative path? the dylib path must be fixed with either the rpath or some post install scripts
if we are not allowed to run a post install script to fix this, what are the other options?
Relative paths should work just fine. For example assume a macOS application bundle. The application lives in Contents/MacOS while the library lives in Contents/Frameworks. In this case you would relink the application's libraries to something like this #executable_path/../Frameworks/library.so. If you don't use an application bundle but have all files in the same directory simple using #executable_path should work too.
No need to use #rpath in these examples. you can use this too but it requires the application to define this path. This may be helpful if you want to distribute a library and people are supposed to link to your library. That way they can give an #rpath in their application to find the library without otool-ing them.
And you of course you make these changes before your package up your application into a .dmg or .pkg.

git2go with libssl and libssh2 in single binary

Could anyone offer some suggestions (or resources) on how I could package a GO program that uses git2go, libssl and libssh2 such that it doesn't require the end user to install these libraries separately?
I am only targeting Linux distros (if it matters)
One way would be to build those dependencies statically as well and use PKG_CONFIG_PATH point to your own copies so everything gets linked statically. That should make CMake choose the static versions.
But if the goal is to avoid depending on the user-installed libraries rather than making everything a single executable, I would recommend shipping the libraries and working with the load path to make sure they get loaded. With gcc you'd pass -Wl,-R to set the search path in the binary itself, so you can set where to search for the shared libraries you're shipping with your app. With go it looks like you can pass -r to the linker (via -ldflags or manually) to do the same thing.
libgit2 is rather extensible, so there is a third option which is to implement the TLS stream and SSH transport in Go and plug those into a version of libgit2 without support for these. This is however a significant amount of work.

Do I need to build LLDB locally to use C++ interface?

I have XCode 5 installed, I can use command-line lldb just fine. Now I want to create my own application that will link with LLDB C++ interface. I tried to search through the XCode package and found no .a archives, no headers. Does this mean I need to build LLDB locally (and go through the signing process)?
it is indeed correct that there are no header files included in the LLDB.framework that comes with Xcode
With that said, you have two possible avenues:
build LLDB from source, as you said, and then use the built ToT to write your app
obtain the headers from our open source repository and put them in the magical location in the Xcode-provided LLDB.framework and that should enable you to link successfully against whatever LLDB you have.
The incantation should be to make an Headers folder in LLDB.framework/Versions/A and copy all the PUBLIC headers from our sources into there (you want LLDB.h, all the SB*.h files and lldb-defines,enumerations,forward,public,types,versioning.h) - then go into LLDB.framework and make a symlink named Headers to Versions/Current/Headers
Just an FYI - the public API (SB*.h) is all that is pretty much supported and guaranteed to be relatively stable. If you start trying to use the private layer (lldb_private::*), you are going to be on your own and breakages might be fairly frequent as the internals of the debugger evolve

How to setup ZeroMQ on Windows to work with OpenPGM?

How to setup ZeroMQ on Windows to work with OpenPGM?
I've done it. It wasn't as hard as I originally feared. Here's how I did it:
Download OpenPGM binaries from here: http://miru.hk/openpgm/
Download ZMQ source, either the tarball or from github
Open builds\msvc\msvc10.sln in Visual Studio
Select the WithOpenPGM configuration
Add appropriate OpenPGM directories to the additional Include directories
Add appropriate OpenPGM directories to additional library directories
Add appropriate OpenPGM .lib file to additional linker dependencies
Build and enjoy
if I remember correctly the snapshots are built with OpenPGM support: http://snapshot.zero.mq/
You first follow the OpenPGM guide: https://code.google.com/p/openpgm/wiki/OpenPgm5CReferenceBuildLibraryWindows then you make sure that the compilation process of zeromq can link that library...
It should be possible to get to work, however, this is possible it's not that easy:
https://zeromq.jira.com/browse/LIBZMQ-377
However, you can download a completely compiled binary with OpenPGM on Windows from here:
http://www.zeromq.org/distro:microsoft-windows
If I were in your shoes, I would set up OpenPGM on FreeBSD or Ubuntu and have a router process there that takes the messages from the Windows machine and multicasts them. That way, you have a much simpler problem to deal with on Windows, and you will be using one of the preferred platforms for OpenPGM
Almost all the code that you need to handle the routing scenario is already written for you in the 0MQ Guide.

qt lrelease windows binary?

can someone give a link to lrelease binary for windows?
I can't seem to find it everywhere.
I have a server app that translates the ui dynamically via web translate engine (like google translate) and translates the entries in the .ts file. Now I need to generate a .qm from .ts and return it to the client.
So I need to put the lrelease utility on the server. Don't want to install the whole qt framework. Just the .exe and maybe some depending .dll-s.
// UPDATE
Thanks for replies. I managed to get it working in Windows.
Same question, but looking for Linux (Ubuntu) binary.
How can I check just lrelease dependencies.
I know it is in the qt4-dev-tools package, but it depends on almost whole Qt.
So is there any way to check only the lrelease dependencies?
You could download e.g. [QT for VS 2008][1], install it on some machine and copy lrelease and the required DLLs (I'd assume QtCore and QtXml) from there to the server. I don't think you'll find up-to-date standalone binaries on the net.

Resources