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
build for IOS #38
Comments
Did not check. But maybe try libtdjson. |
It is possible to build libtdjson with cmake and some cmake toolchain for ios. We are planning publish some examples and build scripts soon. |
I have try to build with /CMake/iOS.cmake but i got this error:
and have this in log
|
You are on a right track, but "Also you will need zlib and openssl built for ios". We will include instructions on how to build these libraries for iOS in our Swift example, but there are many of them that can be publicly found. |
@mrH3ktor I've managed to build it by first building OpenSSL for iOS (I used this project for a quick try https://github.com/x2on/OpenSSL-for-iPhone) and then manually setting OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY and OPENSSL_INCLUDE_DIR to those. |
Thanks guys. i pass that error and now getting another one. at first i add this line to /CMake/iOS.cmake file: then run this command: i got this log: when i try to build i got this error: |
Some TDLib sources are generated and that can't be done directly when the library is cross-compiled. You need to run ones a native build to generate these sources before running cross-compilation: |
I use this shell script to build the libraries for iOS:
This will create a build folder. Just include all You might need to tweak some build settings. Feel free to ask! And if someone has any recommendation on how to optimise the build or the linking time in Xcode! Please!!! |
@leoMehlig But could you help me with the problem of compiling the project when I try to use these libraries directly in the iOS project? I have successfully created libraries using your shell script, most likely without errors, here is the result of running the script: At the output, I got these files: I added the folders "OpenSSL-for-iPhone", "tdlibs" and the file "module.modulemap" to the project: Project location path: The hierarchy of paths for the location of files and folders with libraries:
Added all links to libraries and files by editing the required keys in the "Build Settings" project settings in Xcode:
After this step with the import of all the necessary files, the project is successfully compiled. And then there are problems when I try to use the C interface of the td_json library. I start creating a build of the project for a simulator or a real device, and at the time of compilation and a long "Linking" procedure, a lot of critical compiler errors occur: "Undefined symbols for architecture x86_64" or "Undefined symbols for architecture arm64": Please, tell me, at least in what direction should I go, what would try to fix it. |
@Sanich63 Your file structure looks fine. |
We have published example of building TDLib for iOS, watchOS and tvOS, which is also an alternative example of building TDLib for macOS. |
In the iOS example it is only shown how to build the library using the given scripts. The Swift example provides an .xcodeproj example, suggesting to add a produced libtdjson.dylib into But iOS Swift projects don't support adding pure .dylib files into a project. That way, the project compiles and runs fine, but when I was trying to submit it to the AppStore, I was getting According to this technical note on Apple Developer website (search for Embedded .dylib files section there), this is because I try to embed pure .dylib into an .ipa. It says it is not supported and I should wrap a .dylib into a framework. But I couldn't find any description of how to do that. Can you please provide a usable Xcode project example or maybe tell in what direction I should go? |
For anyone else who is experiencing this issue, you can use my pre build framework (documentation will follow). Just download it from the release page basically. |
Maybe it is best to correct the Thanks to @leoMehlig very much, the custom build script works great, and the framework is fully suitable for AppStore Distribution. I added it to my workspace and the archive finally got uploaded :) |
There is nothing wrong with the `build.sh`. One should just not use the dylib in iOS, but instead the `.a` files with a modulemap.
|
After running |
The instructions are completely incomplete. You can't just follow them and build it for iOS. Besides, no-one needs a .dylib as a result for an iOS app, because you can develop with it, but you can't go to AppStore with a .dylib included (it should be a .framework). Integrating TDLib is a great headache for me at the moment |
@olSolo this is exactly what I am talking about. Thankfully, @leoMehlig did leave a working link above. |
@WingedDoom yeah, @leoMehlig did a great job. Unfortunately I can't use a pre-built framework from an unknown source in my project, so my final hope is @leoMehlig's build script |
There is a build script in the project of the prebuilt framework. I use this one to build the project on Travis. You should be able to build it using this script. Maybe take a look at the .travis.yml file.
…Sent from my iPhone
On 31. Jul 2018, at 16:18, olSolo ***@***.***> wrote:
@WingedDoom yeah, @leoMehlig did a great job. Unfortunately I can't use a pre-built framework from an unknown source in my project, so my final hope is @leoMehlig's build script
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@leoMehlig I get "No such module: libtdjson" error when I try to use the precompiled framework or when I use same framework but with built by myself .a libraries. No idea what to do :( |
@leoMehlig well, I build the framework, embed it in my project, in the file that use TDLib methods I do import TDJSON. On my machine it works great even after all kinds of cleaning and deleting Derived Data, but on the CI machine there is "Missing required module 'libtdjson' in the file that uses TDLib. The module map is default: module libtdjson [system][extern_c] { |
@olSolo Are you also build tdlib on your CI? Maybe you are missing some .a file. One is too big for git, so it's ignored and instead in the release as a download. |
@leoMehlig no, the TDJSON.framework was taken already assembled from the repository. Yet no ideas |
How can i build this for IOS?
The text was updated successfully, but these errors were encountered: