Cykooz / libheif-rs

Safe wrapper to libheif-sys for parsing heif/heic files
MIT License
34 stars 11 forks source link

statically linking libheif #20

Open woelper opened 6 months ago

woelper commented 6 months ago

Hi, and thank you for this great library!

I am trying to statically link libheif to make distribution of my program easier and not have the user install libheif individually. Is there a recommended or even built-in way of doing so?

Cykooz commented 6 months ago

I'm afraid, I don't know how to do it. I've never done it before.

neckaros commented 5 months ago

Hi, and thank you for this great library!

I am trying to statically link libheif to make distribution of my program easier and not have the user install libheif individually. Is there a recommended or even built-in way of doing so?

I'm pretty new to rust but doesn't rust embed libraries in executable at build time?

sophie-h commented 5 months ago

I'm pretty new to rust but doesn't rust embed libraries in executable at build time?

C libraries are manually dynamically linked. This has nothing to do with how rust crates work.

JokerAJP commented 5 months ago

How to support compiling into wasm?

Cykooz commented 4 months ago

How to support compiling into wasm?

According to the Internet it is a very painful task.

Cykooz commented 3 months ago

Also you have to consider that libheif is licensed under LGPL v3.

So if you want to distribute a combined work, you'll have to use the following license:

  • statically linked:
    • Either you must release both parts as LGPL.
    • Or provide everything that allow the user to relink the application with a different version of the LGPL source code. In this case the other requirements are the same as if it was dynamically linked.
  • dynamically linked: LGPL code stays LGPL, you can keep the proprietary code proprietary.

Source - https://stackoverflow.com/a/10179181

neckaros commented 1 month ago

Hi, and thank you for this great library!

I am trying to statically link libheif to make distribution of my program easier and not have the user install libheif individually. Is there a recommended or even built-in way of doing so?

@woelper Did you succeed in statically linking libheif ?

woelper commented 1 month ago

Not completely. I managed to get some success on windows, but not on other platforms.

ForestJohnson commented 1 month ago

I know this is not Rust, but someone got it working by compiling libheif to WASM using emscripten and running it that way https://github.com/jerbob92/goheif/blob/feature/webassembly/libde265/libde265.go

Thanks to this guy, now my mom can access her photos

vincent-herlemont commented 1 month ago

Also you have to consider that libheif is licensed under LGPL v3.

@Cykooz, has the license changed since then, or did I miss something?

C.f. libheif/README.md#license

The libheif is distributed under the terms of the GNU Lesser General Public License. The sample applications are distributed under the terms of the MIT License.

Cykooz commented 1 month ago

has the license changed since then, or did I miss something?

GNU Lesser General Public License - LGPL. Nothing has changed.