You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@corinthia.apache.org by António Soares <as...@gmail.com> on 2015/03/19 12:41:06 UTC

Static library for iOS

Hi there,
I'm a student doing master in Informatics engineer and I would like to
implement a type of your DFConverter in my iOS app. After trying to compile
your work with xcode on MACOSX 10.10 I finally had success compiling,
before that it failed when I used the UNIX option because didn't found
tree.h header.
Now i'm trying to do a static library with a public header that i can use
in my iOS project.

Is possible to get any kind of documentation or instruction how to do that?
I had many problema compiling a static library or framework in the pass
days.

Any help would be appreciated.

Thanks for your time,

António Soares

Re: Static library for iOS

Posted by jan i <ja...@apache.org>.
Something for the wiki

rgds
jan i
On Mar 22, 2015 12:37 PM, "Peter Kelly" <pm...@apache.org> wrote:

> Hi Antonio,
>
> This is actually an interesting question and in looking into this I
> realised it doesn’t currently work properly with our current build
> configuration. For my own iOS app I actually still maintain a separate
> Xcode project file (for historical reasons). I’ve just gone through the
> process of trying to use a CMake-generated project file, and here’s what I
> had to do:
>
> 1. First create the Corinthia.xproject file by running CMake:
>
>     mkdir ~/code/incubator-corinthia/build
>     cd ~/code/incubator-corinthia/build
>     cmake -G Xcode ..
>     open Corinthia.xcodeproj
>
> 2. Once Xcode is open, there should be a yellow warning symbol shown near
> the center-top of the window. Click this, and then on the “Validate Project
> Settings” warning, and click “Perform Changes” (this apples the
> “automatically select architectures” setting). Say no if it subsequently
> asks you about snapshots.
>
> 3. In the view where it has the list containing the Corinthia project
> followed by all the targets (ALL_BUILD, ZERO_CHECK, DocFormats etc.),
> select the Corinthia project, and the “Build Settings” near the top of the
> window. Change Supported Platforms to “iOS”, and Base SDK to “Latest iOS
> (iOS 8.2)”. The architectures should be listed as “Standard architectures
> (armv7, arm64)”, at least if you have an iOS device plugged into your
> machine.
>
> 4. Delete the dftest, dfbuild, and dfutil targets. These are command-line
> tools which won’t work on iOS and will cause errors while compiling.
>
> 5. Go to Product -> Build
>
> This should compile everything without errors.
>
> Now, to use this library in your iOS app:
>
> 6. Close the Corinthia project window, and then open your app’s project
> file.
>
> 7. In the left-most pane, click on your app project, and then drag
> Corinthia.xcodeproj on top of it, so the blue line appears just underneath
> it. This will add it as a sub-project.
>
> 8. Under “Build Phases" for your app project, go to “Link Binary with
> Libraries”, click add, then “add other”,  browse to the
> incubator-corinthia/build/lib directory, and select libDocFormats.a. Then
> add libz.dylib, libxml2.dylib, and ImageIO.framework.
>
> 9. Under “Build Settings” for your app project, go to “Header Search
> Paths”, and add the following two absolute paths (adjusting for the
> location where you have the repository):
>
>     /Users/peter/code/incubator-corinthia/DocFormats/headers
>     /Users/peter/code/incubator-corinthia/DocFormats/api/headers
>
> 10. In the .m source file where you want to call the library API
> functions, add the following two lines:
>
>     #import <DFPlatform.h>
>     #import <DocFormats/DocFormats.h>
>
> 11. Now you should be able to make API calls like the following:
>
>     DFGetFile("concrete.docx","abstract.html",NULL);
>
> Summary: I realise this is a *lot* to do, and there’s plenty of
> opportunities to do the wrong option here. We need to make this a lot
> smoother, ideally supporting this use case in the CMake-generated project
> files (which presently cater for OS X but not iOS). This is actually the
> first time I’ve tried building the library on iOS without using my
> existing, separately-maintained project file, and in going through the
> process I’ve realised how complex it is in practice.
>
> Let me know how you go with these instructions; if you get stuck I’ll try
> to help further.
>
> —
> Dr Peter M. Kelly
> pmkelly@apache.org
>
> PGP key: http://www.kellypmk.net/pgp-key <http://www.kellypmk.net/pgp-key>
> (fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)
>
> > On 19 Mar 2015, at 6:41 pm, António Soares <as...@gmail.com>
> wrote:
> >
> > Hi there,
> > I'm a student doing master in Informatics engineer and I would like to
> > implement a type of your DFConverter in my iOS app. After trying to
> compile
> > your work with xcode on MACOSX 10.10 I finally had success compiling,
> > before that it failed when I used the UNIX option because didn't found
> > tree.h header.
> > Now i'm trying to do a static library with a public header that i can use
> > in my iOS project.
> >
> > Is possible to get any kind of documentation or instruction how to do
> that?
> > I had many problema compiling a static library or framework in the pass
> > days.
> >
> > Any help would be appreciated.
> >
> > Thanks for your time,
> >
> > António Soares
>
>

Re: Static library for iOS

Posted by Peter Kelly <pm...@apache.org>.
Hi Antonio,

This is actually an interesting question and in looking into this I realised it doesn’t currently work properly with our current build configuration. For my own iOS app I actually still maintain a separate Xcode project file (for historical reasons). I’ve just gone through the process of trying to use a CMake-generated project file, and here’s what I had to do:

1. First create the Corinthia.xproject file by running CMake:

    mkdir ~/code/incubator-corinthia/build
    cd ~/code/incubator-corinthia/build
    cmake -G Xcode ..
    open Corinthia.xcodeproj

2. Once Xcode is open, there should be a yellow warning symbol shown near the center-top of the window. Click this, and then on the “Validate Project Settings” warning, and click “Perform Changes” (this apples the “automatically select architectures” setting). Say no if it subsequently asks you about snapshots.

3. In the view where it has the list containing the Corinthia project followed by all the targets (ALL_BUILD, ZERO_CHECK, DocFormats etc.), select the Corinthia project, and the “Build Settings” near the top of the window. Change Supported Platforms to “iOS”, and Base SDK to “Latest iOS (iOS 8.2)”. The architectures should be listed as “Standard architectures (armv7, arm64)”, at least if you have an iOS device plugged into your machine.

4. Delete the dftest, dfbuild, and dfutil targets. These are command-line tools which won’t work on iOS and will cause errors while compiling.

5. Go to Product -> Build

This should compile everything without errors.

Now, to use this library in your iOS app:

6. Close the Corinthia project window, and then open your app’s project file.

7. In the left-most pane, click on your app project, and then drag Corinthia.xcodeproj on top of it, so the blue line appears just underneath it. This will add it as a sub-project.

8. Under “Build Phases" for your app project, go to “Link Binary with Libraries”, click add, then “add other”,  browse to the incubator-corinthia/build/lib directory, and select libDocFormats.a. Then add libz.dylib, libxml2.dylib, and ImageIO.framework.

9. Under “Build Settings” for your app project, go to “Header Search Paths”, and add the following two absolute paths (adjusting for the location where you have the repository):

    /Users/peter/code/incubator-corinthia/DocFormats/headers
    /Users/peter/code/incubator-corinthia/DocFormats/api/headers

10. In the .m source file where you want to call the library API functions, add the following two lines:

    #import <DFPlatform.h>
    #import <DocFormats/DocFormats.h>

11. Now you should be able to make API calls like the following:

    DFGetFile("concrete.docx","abstract.html",NULL);

Summary: I realise this is a *lot* to do, and there’s plenty of opportunities to do the wrong option here. We need to make this a lot smoother, ideally supporting this use case in the CMake-generated project files (which presently cater for OS X but not iOS). This is actually the first time I’ve tried building the library on iOS without using my existing, separately-maintained project file, and in going through the process I’ve realised how complex it is in practice.

Let me know how you go with these instructions; if you get stuck I’ll try to help further.

—
Dr Peter M. Kelly
pmkelly@apache.org

PGP key: http://www.kellypmk.net/pgp-key <http://www.kellypmk.net/pgp-key>
(fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)

> On 19 Mar 2015, at 6:41 pm, António Soares <as...@gmail.com> wrote:
> 
> Hi there,
> I'm a student doing master in Informatics engineer and I would like to
> implement a type of your DFConverter in my iOS app. After trying to compile
> your work with xcode on MACOSX 10.10 I finally had success compiling,
> before that it failed when I used the UNIX option because didn't found
> tree.h header.
> Now i'm trying to do a static library with a public header that i can use
> in my iOS project.
> 
> Is possible to get any kind of documentation or instruction how to do that?
> I had many problema compiling a static library or framework in the pass
> days.
> 
> Any help would be appreciated.
> 
> Thanks for your time,
> 
> António Soares


Re: Static library for iOS

Posted by jan i <ja...@apache.org>.
On Thursday, March 19, 2015, Franz de Copenhague <
franzdecopenhague@outlook.com> wrote:

> >> running the command below you can get the information
> >>
> >> xml2-config --cflags --libs
> >>
> >> In my system returns
> >>
> >>
> >>
> -I/Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
> >> -lxml2
> >>
> > yes, but what do you with zlib1, SDL, SDL_image, iconv and not to forget
> > docformat.lib or did I misunderstand something.
> >
>
> xml2-config only is worthy for Antonio's question regarding to tree.h

Thanks nice to learn something (did not know that tree.h was libxml2).

rgds
jan i

>
> > ........ because didn't found
> > tree.h header.
>
> franz
>
>
>



-- 
Sent from My iPad, sorry for any misspellings.

RE: Static library for iOS

Posted by Franz de Copenhague <fr...@outlook.com>.
>> running the command below you can get the information
>>
>> xml2-config --cflags --libs
>>
>> In my system returns
>>
>>
>> -I/Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
>> -lxml2
>>
> yes, but what do you with zlib1, SDL, SDL_image, iconv and not to forget
> docformat.lib or did I misunderstand something.
>

xml2-config only is worthy for Antonio's question regarding to tree.h

> ........ because didn't found
> tree.h header.

franz


 		 	   		  

Re: Static library for iOS

Posted by jan i <ja...@apache.org>.
On 19 March 2015 at 18:26, Franz de Copenhague <
franzdecopenhague@outlook.com> wrote:

>
>
> >
> > Now i'm trying to do a static library with a public header that i can use
> >> in my iOS project.
> >>
> > remark we do not currently have a release and no public header file, that
> > is one of the key issues we are working on in trunk.
> >
> running the command below you can get the information
>
> xml2-config --cflags --libs
>
> In my system returns
>
>
> -I/Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
> -lxml2
>
yes, but what do you with zlib1, SDL, SDL_image, iconv and not to forget
docformat.lib or did I misunderstand something.

I am right now in the process of build static libraries of all the 3rd
party...first version is for windows in 32bit and 64bit.

rgds
jan i.


>
> franz

RE: Static library for iOS

Posted by Franz de Copenhague <fr...@outlook.com>.

>
> Now i'm trying to do a static library with a public header that i can use
>> in my iOS project.
>>
> remark we do not currently have a release and no public header file, that
> is one of the key issues we are working on in trunk.
>
running the command below you can get the information

xml2-config --cflags --libs

In my system returns

-I/Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
-lxml2

franz 		 	   		  

Re: Static library for iOS

Posted by jan i <ja...@apache.org>.
On 19 March 2015 at 12:41, António Soares <as...@gmail.com> wrote:

> Hi there,
> I'm a student doing master in Informatics engineer and I would like to
> implement a type of your DFConverter in my iOS app. After trying to compile
> your work with xcode on MACOSX 10.10 I finally had success compiling,
> before that it failed when I used the UNIX option because didn't found
> tree.h header.
>
We build regurlary on MacOSX and one of the developers has this as his main
development platform, so I am pretty sure that works (especially if you use
branch "stable").

Have a look at
https://cwiki.apache.org/confluence/display/Corinthia/Build+instructions


Now i'm trying to do a static library with a public header that i can use
> in my iOS project.
>
remark we do not currently have a release and no public header file, that
is one of the key issues we are working on in trunk.


However please be aware DocFormart is only a static library, not a dll.


>
> Is possible to get any kind of documentation or instruction how to do that?
> I had many problema compiling a static library or framework in the pass
> days.
>
see our wiki (for MACos). IoS is not on our test plan right now, but I see
no reason why it should not work.



>
> Any help would be appreciated.
>
We say the same, your help with Corinthia could bring us all a step ahead.

rgds
jan I.


>
> Thanks for your time,
>
> António Soares
>