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

Statically linking arrayfire #192

Open
vadixidav opened this issue Feb 28, 2019 · 9 comments
Open

Statically linking arrayfire #192

vadixidav opened this issue Feb 28, 2019 · 9 comments

Comments

@vadixidav
Copy link
Contributor

@vadixidav vadixidav commented Feb 28, 2019

Right now arrayfire has to be used by linking to the DLL. Since the only parts of arrayfire that are included in the Rust bindings are BSD 3-clause, there should be no problem statically linking arrayfire. Is it possible that we could choose whether or not arrayfire is statically linked to ease distribution? Also, is there any downside to just always statically linking arrayfire? I feel like that would be more in-line with what the Rust community expects: adding a crate to your Cargo.toml should "just work".

@9prady9
Copy link
Member

@9prady9 9prady9 commented Feb 28, 2019

There is one major problem with doing that I think. Rust crates can't go beyond a certain size. ArrayFire binaries are big right now, definitely not in the range of crate size, the last time I checked it was 10MB

@9prady9
Copy link
Member

@9prady9 9prady9 commented Feb 28, 2019

Whether you use static or dynamic binaries of ArrayFire, the size can't go to 10MB for sure.

@9prady9
Copy link
Member

@9prady9 9prady9 commented Feb 28, 2019

Looks like per crate limits were added but I don't know yet if it's released.

@9prady9
Copy link
Member

@9prady9 9prady9 commented Feb 28, 2019

Also, I am not really sure if it's good idea to club binary along with crate using static linking. Because right now there is an advantage : user can install/modify ArrayFire installation independent of crate version and as long as crate <major.minor> version matches ArrayFire's <major.minor> version, it is ready for use.

@vadixidav
Copy link
Contributor Author

@vadixidav vadixidav commented Feb 28, 2019

A feature could be added to enable dynamic linking as well. By default it could be statically linked, but for deployment it could then be dynamically linked by enabling the feature.

@9prady9 9prady9 added this to the timeless milestone Mar 1, 2019
@9prady9
Copy link
Member

@9prady9 9prady9 commented Mar 1, 2019

@vadixidav I have no experience doing such packaging(involving static linking but handling all OSes) in rust crates. Can you please point to another crate that does this.

@vadixidav
Copy link
Contributor Author

@vadixidav vadixidav commented Mar 1, 2019

@9prady9 Sure, I actually just did this for the Rust flann bindings here. Check the flann-sys directory. This was being built using CMake, which it looks like ArrayFire is as well. If you would like, I can attempt this myself. This would make it so that, by default, ArrayFire would be built by Cargo and statically linked, but if you enabled the special dynamic link flag then it would try to use the shared library. Does this sound fine?

@9prady9
Copy link
Member

@9prady9 9prady9 commented Mar 1, 2019

I am concerned by build times of ArrayFire - it takes too much time to be honest. Let me check flann-sys. Sure, give it a try and feel free to contact on slack for quick response if you face problems during static build.

@9prady9 9prady9 added the Enhancement label Mar 12, 2019
@9prady9 9prady9 added this to Features in arrayfire-rust board May 21, 2019
@9prady9
Copy link
Member

@9prady9 9prady9 commented Mar 31, 2020

@9prady9 9prady9 moved this from Features to Improvements in arrayfire-rust board Jul 15, 2020
@9prady9 9prady9 moved this from Improvements to Features in arrayfire-rust board Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.