Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use WhirlyGlobe with swift #543

Closed
zhengwu123 opened this issue Mar 18, 2016 · 39 comments
Closed

how to use WhirlyGlobe with swift #543

zhengwu123 opened this issue Mar 18, 2016 · 39 comments
Assignees

Comments

@zhengwu123
Copy link

Hi

I am installed WhirlyGlobe with cocoapods.
I encountered a problem when I try to compile(IOS9 - Swift).

Ld /Users/new/Library/Developer/Xcode/DerivedData/SocialEarth-fvgdvcqmdxctywcyhjryfsxyvnnc/Build/Products/Debug-iphoneos/GoogleProtobuf.framework/GoogleProtobuf normal arm64
cd "/Users/new/Desktop/swift learning/SocialEarth/Pods"
export IPHONEOS_DEPLOYMENT_TARGET=9.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -L/Users/new/Library/Developer/Xcode/DerivedData/SocialEarth-fvgdvcqmdxctywcyhjryfsxyvnnc/Build/Products/Debug-iphoneos -F/Users/new/Library/Developer/Xcode/DerivedData/SocialEarth-fvgdvcqmdxctywcyhjryfsxyvnnc/Build/Products/Debug-iphoneos -filelist /Users/new/Library/Developer/Xcode/DerivedData/SocialEarth-fvgdvcqmdxctywcyhjryfsxyvnnc/Build/Intermediates/Pods.build/Debug-iphoneos/GoogleProtobuf.build/Objects-normal/arm64/GoogleProtobuf.LinkFileList -install_name @rpath/GoogleProtobuf.framework/GoogleProtobuf -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=9.2 -dead_strip -fembed-bitcode-marker -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -framework Foundation -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/new/Library/Developer/Xcode/DerivedData/SocialEarth-fvgdvcqmdxctywcyhjryfsxyvnnc/Build/Intermediates/Pods.build/Debug-iphoneos/GoogleProtobuf.build/Objects-normal/arm64/GoogleProtobuf_dependency_info.dat -o /Users/new/Library/Developer/Xcode/DerivedData/SocialEarth-fvgdvcqmdxctywcyhjryfsxyvnnc/Build/Products/Debug-iphoneos/GoogleProtobuf.framework/GoogleProtobuf

Undefined symbols for architecture arm64:
"deflate", referenced from:
google_public::protobuf::io::GzipOutputStream::Deflate(int) in gzip_stream.o
"inflate", referenced from:
google_public::protobuf::io::GzipInputStream::Inflate(int) in gzip_stream.o
"inflateInit2", referenced from:
google_public::protobuf::io::internalInflateInit2(z_stream_s
, google_public::protobuf::io::GzipInputStream::Format) in gzip_stream.o
"deflateEnd", referenced from:
google_public::protobuf::io::GzipOutputStream::Close() in gzip_stream.o
"deflateInit2", referenced from:
google_public::protobuf::io::GzipOutputStream::Init(google_public::protobuf::io::ZeroCopyOutputStream
, google_public::protobuf::io::GzipOutputStream::Options const&) in gzip_stream.o
"inflateEnd", referenced from:
google_public::protobuf::io::GzipInputStream::~GzipInputStream() in gzip_stream.o
google_public::protobuf::io::GzipInputStream::Next(void const*
, int
) in gzip_stream.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please help me out

@mousebird
Copy link
Collaborator

It's not the Swift part, I think, it looks like missing Protobuf methods.

Which podspec are you using? The one in the central pod repo is out of date. Try using the one in the develop_2_4_1 branch.

@zhengwu123
Copy link
Author

Hi Steve:

Thanks for your fast reply.

I tried both pod 'WhirlyGlobe' pod 'WhirlyGlobe -> 2.3'

when I ran the pod install. it install all the files automatically.

How can I include branch_2_4_1 into my workspace?

@mousebird
Copy link
Collaborator

You can use the podspec directly from the 2.4 tree.
It's right here:
https://github.com/mousebird/WhirlyGlobe/blob/master/WhirlyGlobe.podspec

@zhengwu123
Copy link
Author

Thanks again for your reply.

It's my first time to use podspec, Can you tell me how to use it?

In the past, I only know how to install with pod 'module name'.

@mousebird
Copy link
Collaborator

There are instructions on Cocoapods.org.
It's something like this:
pod 'WhirlyGlobe', :git => 'https://github.com/mousebird/WhirlyGlobe.git', :tag => 'v2.4'

@zhengwu123
Copy link
Author

Thank you so much!!!
I successfully installed the 2.4 version.

However, This error hit me when I try to build.

Use of undeclared identifier SQLITE_OPEN_READONLY.
And I read your github issue reply.
"If you explicitly pull in the sqlite header for the module that's complaining the problem goes away."

I am still not quite get the idea. Can you tell me what to do to remove this error?

@mousebird
Copy link
Collaborator

Above the include for fmdb, just include the sqlite3 header. I think it's just sqlite3.h or something similar.

@zhengwu123
Copy link
Author

Sorry to bother you again.

new problem detected.

AFHTTPRequestOperationManager.h file not found

this file is removed from AFNetworking 3.0.

what should I do?

@mousebird
Copy link
Collaborator

For 2.4, you can change the Podfile to request an earlier version of AFNetworking.

Or you could switch to the develop_2_4_1 branch where we've removed the AFNetworking dependency.

@zhengwu123
Copy link
Author

How can I change to the earlier version of AFNetworking?

when I use pod 'WhirlyGlobe', :git => 'https://github.com/mousebird/WhirlyGlobe.git', :tag => 'v2.4'
it install the AFNetworking 3.0.4.
I tried add pod 'AFNetworking' ~>2.0.

But it doesn't work.

@jcollas
Copy link
Contributor

jcollas commented Mar 18, 2016

I appear to be the owner of the WhirlyGlobe pod in cocoa pods. I didn’t realize that 2.4 had been released. If you’d like, I’ll push the 2.4 podspec for general availability. (modulo the fixes that Zheng Wu needs)

That ok with you, Steve?

Juan

On Mar 18, 2016, at 6:48:34 PM, zheng wu notifications@github.com wrote:

How can I change to the earlier version of AFNetworking?

when I use pod 'WhirlyGlobe', :git => 'https://github.com/mousebird/WhirlyGlobe.git', :tag => 'v2.4'
it install the AFNetworking 3.0.4.
I tried add pod 'AFNetworking' ~>2.0.

But it doesn't work.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@mousebird
Copy link
Collaborator

I wouldn't mind some help with the 2.4 podspec, sure!

We've taken control of the podspec generation now and it works fine for 2.4.1 and generally for 2.4 when we reference it directly from the repo.

However, I've been unable to push the new podspec for 2.4 because the lint process takes for-freaking-ever and then fails.

@jmnavarro
Copy link
Contributor

@zhengwu123 to use 2.4.1 you have to specify the branch in your pod:

pod 'WhirlyGlobe', :git => 'https://github.com/mousebird/WhirlyGlobe.git', :branch => 'develop_2_4_1'

Not sure if this fixes your errors, but probably does

@jcollas
Copy link
Contributor

jcollas commented Mar 20, 2016

Steve, Jose,

I’ve got the podspec set for 2.4 (and one for 2.4.1). I can push the 2.4 one to cocoa pods today. Here’s the verify:

….. Many warnings ...
- NOTE | [WhirlyGlobe/Lib,WhirlyGlobe/MaplyComponent] xcodebuild: /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/ActiveModel.h:22:9: fatal error: 'map' file not found
- NOTE | [WhirlyGlobe/glues-wg, WhirlyGlobe/Lib, WhirlyGlobe/MaplyComponent, and more...] xcodebuild: /var/folders/9l/62k0ljzn4qxfgzgml59v9pbc0000zc/T/CocoaPods/Lint/App/main.m:3:9: fatal error: could not build module 'WhirlyGlobe'
- NOTE | [WhirlyGlobe/glues-wg] xcodebuild: /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/SDL_opengles.h:32:10: fatal error: 'GLES/gl.h' file not found
- NOTE | [iOS] [WhirlyGlobe/kissxml] xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
- NOTE | [WhirlyGlobe/Lib-Headers, WhirlyGlobe/MaplyComponent-Headers, WhirlyGlobe/Headers, and more...] xcodebuild: Headers/Public/WhirlyGlobe/Identifiable.h:21:9: fatal error: 'set' file not found

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error and 125 warnings.

Hey, look there are a couple of C++ errors. Beats me why, but when I do a pod install against 2.4 and a test application, it works fine. Included is the 2.4 podspec for your review:

WhirlyGlobe.podspec.zip

If you’re good with it, I’ll push it.

Juan

On Mar 18, 2016, at 8:21:48 PM, Jose Manuel Navarro notifications@github.com wrote:

@zhengwu123 to use 2.4.1 you have to specify the branch in your pod:

pod 'WhirlyGlobe', :git => 'https://github.com/mousebird/WhirlyGlobe.git', :branch => 'develop_2_4_1'

Not sure if this fixes your errors, but probably does


You are receiving this because you commented.
Reply to this email directly or view it on GitHub

@jmnavarro
Copy link
Contributor

hey @jcollas

We have similar issues about bridging problems between Swift and Obj-C++.
Do you experience that using your brand-new Podspec?

@jcollas
Copy link
Contributor

jcollas commented Mar 21, 2016

Jose,

Nope. I tested against a swift application I had (my rewrite of the MaplyComponentTester). No problems at all, except for having to add a search path to get to the wg version of kissxml.

I think the podspec I sent for 2.4 would work fine for 2.4.1 too.

Juan

On Mar 21, 2016, at 6:14:57 AM, Jose Manuel Navarro notifications@github.com wrote:

hey @jcollas

We have similar issues about bridging problems between Swift and Obj-C++.
Do you experience that using your brand-new Podspec?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@jmnavarro
Copy link
Contributor

Can you push your new Podspec somewhere? I'd like to try it both with 2.4 and 2.4.1

Thanks!

@jcollas
Copy link
Contributor

jcollas commented Mar 21, 2016

Jose,

I’ve updated the issue with the podspec:

#543 (comment)

If it works properly for you, let me know and I’ll push it to Cocoapods as WhirlyGlobe 2.4

Enjoy,

Juan

On Mar 21, 2016, at 6:23:45 AM, Jose Manuel Navarro notifications@github.com wrote:

Can you push your new Podspec somewhere? I'd like to try it both with 2.4 and 2.4.1

Thanks!


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@jmnavarro
Copy link
Contributor

Sorry, I didn't notice the attachment.

I tried your podspec but I'm getting some error related with std. Same issue described here, but with pure ObjC project.

You can check my branch and sample project included there

@mousebird
Copy link
Collaborator

I had some trouble with private vs public headers in Cocoapods. I might have solved them by making all the headers public. Actually, I think that's it. The problem was that someone needed access to the WhirlyGlobeLib headers to do some deep implementation.

Is there anyway to make those public but keep Swift away from them?

@mousebird
Copy link
Collaborator

I'm wondering if we're going to need two Cocopods or at least two subsets within the podspec.

I need to let some people have access to the WhirlyGlobeLib headers for deep C++ magic. But exposure to those is fatal for Swift. So maybe we just need a Swift only podspec?

Of course, then you'd have trouble writing Swift modules and Obj-C++ models in the same Pod-using app. That's not ideal.

Is there someway to #ifdef out a Swift compile? Something I can put in the headers perhaps?

@jmnavarro
Copy link
Contributor

Yeah, Swift includes a (very basic) preprocessor.

Anyway, the test I did failed even with an ObjC project.

I guess we need to narrow it down with ObjC projects and then fix it with Swift (with the same or different podspec)

@jcollas do you think public/private headers as Steve suggests may be the cause?

@jcollas
Copy link
Contributor

jcollas commented Mar 23, 2016

I worked on this a little last night, and made a few changes to the podspec for 2.4.1 which allow it to compile cleanly. It almost works for 2.4 also, but there are several include files which used angled brackets to refer to WhirlyGlobe header files, and Xcode just hates that.

Steve's right, I had to make the WhirlyGlobeLib headers private, but I think I can get around that by making them private only when using them from the MaplyComponent-Headers. Then everything should work properly.

Try this one for 2.4.1 (I'm going against the develop_2_4_1 branch)

WhirlyGlobe.podspec.zip

@jmnavarro
Copy link
Contributor

Great! it works like a charm, both for ObjC and Swift!
Can you send a PR to 2.4.1 branch with this spec? I'll merge as is.

Since 2.4.1 is in beta, we cannot push this spec to cocoapods. However, if you can make the 2.4 spec work like this (only ObjC, Swift support is introduced in 2.4.1) we can push it right away.

Thanks @jcollas you're our pod master! (:

@jmnavarro jmnavarro self-assigned this Mar 23, 2016
@jcollas
Copy link
Contributor

jcollas commented Mar 23, 2016

Thanks.

I want to see if I can make the WhirlyGlobeLib headers public again, but private when building MaplyComponent first.

I cannot make the podspec work for 2.4 unless Steve removes the angled bracket include references, but I'll look into it further.

@jmnavarro
Copy link
Contributor

@jcollas let me know where angled brackets need to be removed and I'll do it

Thanks!

@jcollas
Copy link
Contributor

jcollas commented Mar 24, 2016

Here's the 'pod spec lint' for the WhirlyGlobe 2.4 podspec I have.

...

- ERROR | [WhirlyGlobe/MaplyComponent] xcodebuild:  /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/MaplyAnnotation.h:22:9: error: 'MaplyCoordinate.h' file not found with <angled> include; use "quotes" instead
- ERROR | [WhirlyGlobe/MaplyComponent] xcodebuild:  /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/MaplyVectorObject.h:23:9: error: 'MaplyCoordinate.h' file not found with <angled> include; use "quotes" instead
- ERROR | [WhirlyGlobe/MaplyComponent] xcodebuild:  /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/MaplyVectorObject.h:24:9: error: 'MaplyCoordinateSystem.h' file not found with <angled> include; use "quotes" instead
- ERROR | [WhirlyGlobe/MaplyComponent] xcodebuild:  /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/MaplySticker.h:22:9: error: 'MaplyCoordinate.h' file not found with <angled> include; use "quotes" instead
- ERROR | [WhirlyGlobe/MaplyComponent] xcodebuild:  /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/MaplySticker.h:23:9: error: 'MaplyQuadImageTilesLayer.h' file not found with <angled> include; use "quotes" instead
- ERROR | [WhirlyGlobe/MaplyComponent] xcodebuild:  /Users/jcollas/Library/Developer/Xcode/DerivedData/App-eoedtsmbfyucjidfynxotepdzbdp/Build/Products/Release-iphonesimulator/WhirlyGlobe/WhirlyGlobe.framework/Headers/MaplyViewController.h:22:9: error: 'MaplyCoordinate.h' file not found with <angled> include; use "quotes" instead

If you can replace the <> with "", it'll work like a charm for 2.4. I know you've already done that for 2.4.1

@jcollas
Copy link
Contributor

jcollas commented Mar 24, 2016

@jmnavarro are you planning on patching the v2.4 tag to include the header changes? If not, I'll finish up my changes to the 2.4.1 podspec and PR it to you ... If you are, let me know and I'll submit a 2.4 WhirlyGlobe podspec.

@mousebird
Copy link
Collaborator

José has a branch that should have it fixed. I need to test it in a couple of other situations and then I'll merge it back in for 2.4.

@jmnavarro
Copy link
Contributor

Hey @zhengwu123

Thanks to @jcollas we have a brand-new pod.

Can you try again with the branch "develop_2_4_1"

pod 'WhirlyGlobe', :git => 'https://github.com/mousebird/WhirlyGlobe.git', :branch => 'develop_2_4_1'

Let us know how it goes

Thanks!

@jmnavarro
Copy link
Contributor

@jcollas this is the branch with your podspec https://github.com/mousebird/WhirlyGlobe/commits/pod-2.4

@mousebird will recreate tag v2.4 when he tests everything, so I assume there's no need to push again to cocoapods

Thanks for being so responsive!

@jmnavarro
Copy link
Contributor

@jcollas BTW, regarding 2.4.1, I already commited the podspec you attached here.

I tested it and it seems to be working, but let me know if anything is wrong

@mousebird
Copy link
Collaborator

I merged in @jmnavarro's branch and redid the v2.4 tag.
If one of you would like to give it a try, I'd say we're good to go.

@jmnavarro
Copy link
Contributor

It works for me

@jcollas I thought the podspec for 2.4 was already pushed, but it isn't. I guess you can do it when you have a chance

@mousebird
Copy link
Collaborator

@jmnavarro I pushed your podspec from your branch. Is there another variant?

@jmnavarro
Copy link
Contributor

@mousebird I meant pushed to cocoapods.org. Once the podspec is working, we should push it there (right now we only have podspec for 2.3)

@mousebird
Copy link
Collaborator

Yes, that would be good. @jcollas was going to do it, I think. The tag should now be updated.

@jcollas
Copy link
Contributor

jcollas commented Mar 26, 2016

Ok, 2.4 podspec is pushed to the cocoa pods repo. the spec wouldn't validate until I added a library reference for xml2 to kissxml. Since you moved the tag on v2.4, you may need to put in a note to remove ~/Library/Caches/CocoaPods/Pods/External/WhirlyGlobe which would have the older cached version with the angled brackets in the includes. If possible, I'd like to change the references to local_libs in WhirlyGlobe to their equivalent podspec references for future releases.

@mousebird
Copy link
Collaborator

I'd be happy to get rid of the local_libs. I guess we'd need to set up pod specs for some of them and figure out how to use the others. glues in particular has some local changes to let us get along with Google Map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants