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

Compiling for iOS #19

Closed
notlion opened this issue Jul 11, 2014 · 16 comments
Closed

Compiling for iOS #19

notlion opened this issue Jul 11, 2014 · 16 comments

Comments

@notlion
Copy link

notlion commented Jul 11, 2014

Clang gives this error when compiling for iOS (arm64):

In file included from ../deps/rxcpp/Rx/v2/src/rxcpp/rx.hpp:8:
In file included from ../deps/rxcpp/Rx/v2/src/rxcpp/rx-includes.hpp:124:
In file included from ../deps/rxcpp/Rx/v2/src/rxcpp/rx-scheduler.hpp:861:
../deps/rxcpp/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp:35:16: error: thread-local storage is unsupported for the current target
        static RXCPP_THREAD_LOCAL current_thread_queue_type* queue;

Version info (Xcode 5.1.1):

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix

I get this for both device and simulator builds. Apologies if Rx isn't supported on iOS yet. I'm curious to check it out!

@cnlier
Copy link

cnlier commented Jul 11, 2014

The __thread specifier is not supported on iOS (nor is thread_local). Perhaps can be replaced with pthread_setspecific, see here: http://alex.tapmania.org/2011/03/simple-thread-local-storage-with-pthreads.html

@notlion
Copy link
Author

notlion commented Jul 12, 2014

Thanks, @cnlier. pthread_setspecific seems fairly straightforward. If one of the maintainers is listening.. Is iOS a platform you guys are interested in supporting? Also, is thread-local storage integral to RxCpp? Would it be possible to use it in a single-threaded context without?

@headinthebox
Copy link

Pretty sure we'd like to run Rx everywhere.

@kirkshoop will know for sure if there are other places, but a threadlocal typically used in the current thread scheduler https://github.com/Reactive-Extensions/RxCpp/blob/master/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp also called trampoline scheduler https://github.com/Netflix/RxJava/blob/875cfd7d4cd90d2b9dfb58c782518f503497687e/rxjava-core/src/main/java/rx/schedulers/TrampolineScheduler.java (you can see the ThreadLocal there as well).

@kirkshoop
Copy link
Member

Yep, we want rxcpp to work on iOS.

The current thread scheduler appears to be the only place that uses thread local storage.

We will get to this, but contributions are welcome!

@notlion
Copy link
Author

notlion commented Jul 15, 2014

Got it compiling with pthreads last night via the post linked by @cnlier. Thanks!

@headinthebox
Copy link

Nice.

@galvare2
Copy link

I'm also interested in getting this to compile on IOS - @notlion could you maybe put up a pull request with your changes to get it to compile, or walk me through what you did?

@notlion
Copy link
Author

notlion commented Jul 18, 2014

I pushed my changes here:
https://github.com/notlion/RxCpp/tree/experimental-ios

It compiles and the tests pass. I don't have much experience with threaded code, so I can't say if the implementation is correct or not. Let me know how it goes!

@kirkshoop
Copy link
Member

If you sign the CLA http://cla.msopentech.com and submit the pull request I would be happy to review and merge this.

@notlion
Copy link
Author

notlion commented Jul 28, 2014

Awesome. I'd be happy to submit a PR once I've had a chance to test out RxCpp a bit more. It's a little tough to get started due to the limited documentation. Your ofxRx project has been really helpful, though. I'm trying to learn by adapting it to Cinder. Thanks!

@kirkshoop
Copy link
Member

Cinder is a great idea! I just pushed changes to ofxRx to add some debugging info to the app background.

I look forward to a pull request :)

@stefanfisk
Copy link
Contributor

@notlion I'd love to have a look at this as well, but I'm having even less success with building for iOS. how exactly are you going about it?

@notlion
Copy link
Author

notlion commented Aug 19, 2014

@stefanfisk My experimental-ios branch should compile for iOS. Follow the instructions for Xcode in the Readme.

@ildarsharafutdinov
Copy link

@notlion, have you managed to test your solution for iOS?

@notlion
Copy link
Author

notlion commented Jan 25, 2015

@ildarsharafutdinov Not outside of compilation. In the end I decided to go with a signals/slots implementation since my use case didn't require most of what RxCpp is capable of.

@kirkshoop
Copy link
Member

@ValeryKopylov has applied this fix. 25dbb11

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

7 participants