Anyone building pdfium for ios/ios simulator?

1,883 views
Skip to first unread message

Adam Schepis

unread,
Aug 29, 2014, 1:57:53 PM8/29/14
to pdf...@googlegroups.com
Having issues getting this all squared away so that i can link it into my iOS app. Anyone having luck with this?  Basically it comes down to adding more architectures, i think.

Adam Schepis

unread,
Sep 5, 2014, 8:20:30 PM9/5/14
to pdf...@googlegroups.com
I've done the work to get pdfium working in iOS.  It involves removing v8 when os==ios (so you can't load pdfs with scripts) and doing a couple other minor things to properly detect iOS in the code.  I'm wondering what the best way to contribute this back is.  Is using `git-cl` etc as state here (http://dev.chromium.org/developers/contributing-code) going to work or do i have to point it at a different code review server?

darkdes...@gmail.com

unread,
Sep 18, 2014, 5:28:57 PM9/18/14
to pdf...@googlegroups.com
Adam,

Did this ever get integrated? If not, I'd love to know how to get the working since I also need to target iOS.

Thanks,
joe

darkdes...@gmail.com

unread,
Sep 18, 2014, 5:32:33 PM9/18/14
to pdf...@googlegroups.com
More specifically I have already had to do the work to strip v8 out of the library but figuring out how to get it to configure and guid for iOS would be great.

Adam Schepis

unread,
Sep 18, 2014, 8:46:27 PM9/18/14
to darkdes...@gmail.com, pdf...@googlegroups.com
Joe, 

I did get it building and working in my iOS app. you can see my fork here:

I never heard back about how best to contribute back but I need to find the time to just put a patch together and send it along



— Adam


--
You received this message because you are subscribed to the Google Groups "pdfium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
To post to this group, send email to pdf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/489c59f4-2ff3-485f-8c72-7302f28d2141%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Schepis

unread,
Sep 18, 2014, 9:17:14 PM9/18/14
to Joseph Jones, pdf...@googlegroups.com
build/gyp_pdfium -Dpdf_use_v8=0 -DOS=ios

— Adam


On Thu, Sep 18, 2014 at 9:13 PM, Joseph Jones <darkdes...@gmail.com> wrote:

Awesome, thanks! You saved me a lot of time and frustration figuring out how to get GYP to work for this.
 
How do you build for iOS with this? Does the generated xcodeproj now have an iOS target in it or do you have to add a command line parameter to GYP to get it to generate an iOS specific xcodeproj?
 
--
Joseph Jones
 

Adam Schepis

unread,
Sep 19, 2014, 5:33:57 AM9/19/14
to Joseph Jones, pdf...@googlegroups.com
Right, I’m not sure if thats 100% correct, but its in a “works for me” state and since those top level projects don’t produce any artifacts it seemed alright to me.

— Adam


On Thu, Sep 18, 2014 at 9:47 PM, Joseph Jones <darkdes...@gmail.com> wrote:

Lifesaver... thank you! I've had a hell of a time getting help in the mailing list and the GYP documentation is rather vague on this part of the gyp magic.

Adam Schepis

unread,
Sep 19, 2014, 10:50:41 AM9/19/14
to Joseph Jones, Joseph Jones, pdf...@googlegroups.com
Happy to help!

— Adam


On Fri, Sep 19, 2014 at 10:43 AM, Joseph Jones <darkdes...@fastmail.fm> wrote:

Yep. Thanks. You truly did save me a lot of grief as I didn't even realize it would be that easy.i was trying to set up configurations and targets and grasp.

From: Adam Schepis
Sent: ‎9/‎19/‎2014 2:34 AM
To: Joseph Jones
Cc: pdf...@googlegroups.com
Subject: Re: Anyone building pdfium for ios/ios simulator?

Adam Schepis

unread,
Sep 22, 2014, 5:38:31 AM9/22/14
to Joseph Jones, pdf...@googlegroups.com
No, i haven’t run into that. What version of Xcode? What device? What other libraries/frameworks are you linking?

— Adam


On Sun, Sep 21, 2014 at 4:49 PM, Joseph Jones <darkdes...@fastmail.fm> wrote:

Have you run into any problems linking PDFIUM when building iphonesimulator?
 
Specifically: 

Undefined symbols for architecture x86_64:

  "_opendir$INODE64", referenced from:

      FX_OpenFolder(char const*) in libfxcrt.a(fx_basic_util.o)

      FX_OpenFolder(wchar_t const*) in libfxcrt.a(fx_basic_util.o)

  "_readdir$INODE64", referenced from:

      FX_GetNextFile(void*, CFX_ByteString&, int&) in libfxcrt.a(fx_basic_util.o)

      FX_GetNextFile(void*, CFX_WideString&, int&) in libfxcrt.a(fx_basic_util.o)

ld: symbol(s) not found for architecture x86_64

 
 
 
--
Joseph Jones
 

Adam Schepis

unread,
Sep 22, 2014, 3:37:42 PM9/22/14
to Joseph Jones, pdf...@googlegroups.com
I did this via my hawkish shell script.  excerpt below (tried to remove unimportant stuff while still keeping it working. When building for IOS just set the PLATFORM var:

PLATFORM=apple-ios ./script.sh

I didn’t include it in the gyp files since it was just as easy to set the variables via xcodebuild params.

----------------------
#!/usr/bin/env bash

: ${PLATFORM:="apple-darwin"}

ROOT_DIR=$(git rev-parse --show-toplevel)

case $PLATFORM in
"apple-darwin")
    DEVELOPER=$(xcode-select -print-path)
    LIPO=$(xcrun -sdk iphoneos -find lipo)
    ARCHS="x86_64 i386"
    SDK="10.8"
    ;;
"apple-ios")
    DEVELOPER=$(xcode-select -print-path)
    LIPO=$(xcrun -sdk iphoneos -find lipo)
    ARCHS="armv7 armv7s x86_64 i386"
    SDK="7.1"
    OTHER_LDFLAGS="-miphoneos-version-min=${SDK}"
    PDFIUM_FLAGS="-Dpdf_use_v8=0 -DOS=ios"
    ;;
*)
    ;;
esac

echo "Platform: $PLATFORM"
echo "Root: $ROOT_DIR"
echo "Prefix: $PREFIX_DIR"
echo "Archs: $ARCHS"

function print_bar() {
    echo "[===========================================================]"
}

function print_title() {
    print_bar
    echo $@
    print_bar
}

# build pdfium
print_title "building pdfium"
pushd deps/pdfium

case $PLATFORM in
    "apple-darwin")
        ;;
    *)
        ;;
esac

build/gyp_pdfium ${PDFIUM_FLAGS}

function build_pdfium_configuration() {
    xcodebuild -project "pdfium.xcodeproj" -alltargets -configuration $1
    case $PLATFORM in
        "apple-ios")
            xcodebuild -project "pdfium.xcodeproj" -alltargets -configuration $1 -arch i386 -arch x86_64 -sdk iphonesimulator
            ;;
        *)
            ;;
    esac
}

build_pdfium_configuration Debug
build_pdfium_configuration Release



— Adam


On Mon, Sep 22, 2014 at 12:50 PM, Joseph Jones <darkdes...@fastmail.fm> wrote:

Looking at your changes I don't see anything that would produce output for the simulator. Do you compile in Xcode at all and try ti run in the simulator?
 
--
Joseph Jones
 
 
 
On Mon, Sep 22, 2014, at 06:57 AM, Joseph Jones wrote:
XCode 6, iphonesimulator and nothing but pdfium and the standard frameworks that you get from a brand new project.
Sent: ‎9/‎22/‎2014 2:38 AM

Adam Schepis

unread,
Sep 22, 2014, 8:43:31 PM9/22/14
to Joseph Jones, pdf...@googlegroups.com
Excellent! If you want to contribute the changes back to my fork i will roll them into my patch

— Adam


On Mon, Sep 22, 2014 at 6:34 PM, Joseph Jones <darkdes...@fastmail.fm> wrote:

Effectively what I got working by adding the built Xcode projects GYP created as target dependencies to my test project.
 
Thanks,
joe

Paulo Coutinho

unread,
May 24, 2018, 1:13:14 AM5/24/18
to pdfium
Hi,

I finished my script to build the PDFium to iOS. All is here with manual patchs:

But i have some issues after compile. All issues is described here:

Can you help me?

Dimuthu Upeksha

unread,
Jan 30, 2024, 3:44:48 PMJan 30
to pdfium
Thanks, Paulo for coming up with build scripts. Is this work being used in any serious project and is it up to date with the recent Pdfium version?

Dimuthu

Reply all
Reply to author
Forward
0 new messages