Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Compiling <code>xmlsec</code> for iPhone is a bit tricky but can be done.</p> <p>First of all, some general considerations:</p> <ol> <li><p><code>xmlsec</code> is a GNU project using the <a href="http://en.wikipedia.org/wiki/GNU_build_system" rel="nofollow">GNU build system</a>; building one such project amounts to running a script (configure) and then executing <code>make</code>. configure will create a Makefile tailored for your exact system configuration and will allow you to choose which options of <code>xmlsec</code> to include or not in you build;</p></li> <li><p><code>xmlsec</code> has several dependencies from other libraries: <code>libssl</code>, <code>libcrypto</code> (part of openssl), <code>libxslt</code>, <code>libxml2</code>, <code>libz</code>, and <code>libiconv</code>. Only <code>libxml2</code> and <code>libz</code> are available in the iPhone SDK and you will need to have all of the others available on your system and already compiled. Those libraries are all GNU projects that you can compile by applying the same approach as the one I describe later for <code>xmlsec</code>. One note: <code>libxslt</code>. Apple includes <code>libxslt</code> in the iPhone SDK, but does not make the .h available, so you are not allowed to link to libxslt.dylib which comes with the iPhone SDK and you will have to compile it on your own.</p></li> <li><p>importing the source files from <code>xmlsec</code> into an iPhone project is difficult unless you know which files are proper to <code>xmlsec</code> and which are simple dependencies (<code>xmlsec</code> source tree includes openssl, gnutls, etc that are not certainly necessary to be there), but above all because you cannot control which optional features of xmlsec you would like to include (or exclude) in your build, like configure does for you;</p></li> <li><p>the approach I preferred is, therefore, properly using configure so as to produce an iPhone-specific Makefile, and then build a static library (since you are not allowed to use external dylib on iPhone);</p></li> </ol> <p>The steps, concretely, to compile <code>xmlsec</code> for iPhone are:</p> <p>0 - install and compile all the dependencies; if you cannot find them already ported for iPhone, you can apply (recursively) this same approach to them;</p> <p>1 - cd to libxmlsec root and execute the command:</p> <p><code>CFLAGS=" -arch armv6 -std=c99 -isysroot /Volumes/ext/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" CC="/Volumes/ext/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2" ./configure --host=arm-apple-darwin10 --disable-shared --disable-crypto-dl --with-libxml=&lt;path_to_where_libxml_is&gt; --with-libxslt=&lt;path_to_where_libxslt_is&gt; --with-openssl=&lt;path_to_where_openssl_is&gt;</code></p> <p>in the command above, I am assuming that libxml headers and executables will be found by the compiler since they are part of the SDK. Otherwise include them also.</p> <p>2 - configure will produce a lot of output and, if everything goes right, you will be able to execute the command:</p> <pre><code>make </code></pre> <p>3 - this should run finely to completion and produce your output file: <code>src/.libs/libxmlsec1.a</code> that you can link in your iPhone project (together with all the rest of depended upon libraries).</p> <p>Finally, a <a href="http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/" rel="nofollow">tutorial about compiling openSSL for iPhone</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload