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

Support for new packages #1

Open
frichez opened this issue Sep 26, 2022 · 3 comments
Open

Support for new packages #1

frichez opened this issue Sep 26, 2022 · 3 comments

Comments

@frichez
Copy link

frichez commented Sep 26, 2022

I would like to add sqldelight package (and SQLiter dependency).
I miss some info how to build a package.

  • I can't clone the project, git submodule update gives fetch errors due to [email protected] urls. I replaced them locally by https://github.com and the command succeed.
  • gradle command failed to run, I get java.lang.NullPointerException (no error message).
  • What is purpose of the KotlinXtras gradle plugin ?
  • How to build a package ? I don't see reference to the projects located in repos folder.
  • Do you build them with docker ? What is kipfs ?
    Thks!
@danbrough
Copy link
Owner

lol. Great questions!

I think if you have a github account then your should be able to download via the [email protected] url's
but yes, I should change them to https urls but you shouldn't need to check them out at all to run the demos/curl_standalone, demos/ktor_standalone demos.

The repos folder is just a collection repos of kotlin libraries I've tweaked to compile on linux arm platforms.
You don't need to build them as I publish them to mavenCentral() see: https://repo.maven.apache.org/maven2/org/danbrough/.
If you want to build your own then you could compare what I've done with the upstream versions.
Each upstream release will have it's own branch in my forked repository.
For example the kotlinx.coroutines submodule has the remotes/origin/danbroid-1.6.4 branch for the 1.6.4 version.

The KotlinXtras gradle plugin will be for adding tasks (and configuring dependencies) for automatically downloading precompiled binaries from maven.
For example: If you want to cross-compile a kotlin native command line app that targets linuxArm32Hfp.
(As in the demos/curl_standalone)
It's all under rapid change at the moment but should settle down in a week.
I'll sort out my testing environment better to ensure all the demos in the tagged versions work properly.
You shouldn't be getting null pointers that's just my bad.

"Kips" https://github.com/danbrough/kipfs is what started all this for me.
It's a kotlin native library for embedding and accessing an IPFS node.
It can be used for compiling native IPFS apps in kotlin or for accessing IPFS functionality from the JVM via JNI.
The end result being that you can use the same kotlin code for accessing the IPFS functionality from kotlin in a regular JVM, android JVM or build shared libraries for whatever, ios, macos etc ..
To get that working I had to figure out how to do all that with OpenSSL first.

As far as docker goes, I've been playing around for a while now with docker buildx for cross compilation but gradle builds are very slow and for kotlin native there isn't much point as it's all java and the konan cross compilers.
So it shouldn't be difficult for someone to use the code directly if they are using linux and targeting linux, android or mingw,
using macos and targeting any apple platform,
using windows and ..dunno .. then they can run ubuntu and target linux,android or mingw.

So my hope is to have the kotlinxtras a project of utilities and demo code showing how to get your kotlin native cross compilation problem solved and also how to distribute your kotlin native library to third party developers using precompiled native libraries distributed via maven.

I haven't come across SQLDelight. It sounds pretty cool. I'll have a look at it.

Cheers, Dan.

@frichez
Copy link
Author

frichez commented Sep 26, 2022

Great answers! 😉Thks.
How do you compile libraries before publishing to your maven repo? If a library targets iOS, MacOS,... a macOS hardware is required? Docker is not helpful in this case, correct ?
You already provide all libraries we need for linuxarm32 except sqldelight.
If you could add sqldelight it would be awesome.

@danbrough
Copy link
Owner

The tweaked kotlin libraries are all in submodules under the "repos" folder.
It now includes sqldelight and it's dependencies sqliter and stately are in the "dev" branch.
I'm about to merge them into the main branch for a 0.0.1-beta04 release.
How it works is that the curl, openssl, sqlite sub-modules compile binaries using the konan cross-compilers (that kotlin uses)
to install into /usr/local/kotlinxtras/libs.
You can do that with "./gradlew curl:buildLinuxArm32Hfp ..etc" from the kotlinxtras source checked out to /usr/local/kotlinxtras/
The libraries in the repos (ktor, etc ..) then compile against that but also against a relative path to build/kotlinxtras/.
The standalone demos use a plugin to download pre-compiled binaries into build/kotlinxtras.
So ideally you wouldn't need to build any of my code.
Just checkout the source and try the standalone demos and they should download binaries to compile against into your $buildDir/kotlinxtras/ folder.
So you could use them as a guide for your own project.
You then run your cross-compiled binaries against your system curl,openssl,sqlite libraries on your target device.
(or your own versions that you've compiled, or copy across the ones in build/kotlinxtras/ if you trust them)
Obviously there could be lots of issues with that, but that's the point of this project.
To aggregate recipes that work when the upstream authors don't have the time to support your linux-arm32 device .. or even android native in many cases.

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

2 participants