georust / geos

Rust bindings for GEOS
https://docs.rs/geos/
MIT License
122 stars 42 forks source link

I need to statically compile the geos and package it into my project. How can I set it up? #142

Open allenlu2008 opened 10 months ago

allenlu2008 commented 10 months ago

I can use dynamic compilation to implement functions after installing libgeos on Ubuntu, but after the program is sent to other environments, if other machines do not have lib Geo, static compilation is required. I have already configured gcc, cmake, etc. on my machine, but I still don't know how to implement static compilation. What are the specific steps for static compilation?

I have been engaged in GIS development, but I am a novice in Rust. I hope to receive more detailed step-by-step instructions. Thank you.

GuillaumeGomez commented 10 months ago

I'm not sure either as I never needed to do it. I suppose if you provide a statically compiled libgeos, it should just work?

EDIT: By that I meant not a .so in short, but maybe I'm completely wrong.

allenlu2008 commented 10 months ago

I see you write in the readme that if you need static compilation, you can use --feature static. I would like to know how to use this... I'm mainly a Rust novice。

If not, it's fine. You can directly set the system environment variable for Geos during deployment, but it's a bit more cumbersome.

kylebarron commented 10 months ago

Just a note that people often shy away from statically linking to GEOS because then you probably have to open up your own code under the LGPL license. E.g. shapely, which is Python bindings to GEOS, ships its own dynamically linked copy of GEOS with its Python bindings when distributing. You might consider shipping a copy of GEOS (dynamically linked) with your rust binary?

allenlu2008 commented 10 months ago

Yes, in some cases, we need to distribute copies of GeoS directly in the software, because many users do not have IT-related knowledge. For them, how to run the software as quickly as possible is what we need to consider. Therefore, static distribution has become a specifically emphasized requirement of customers. As for the LGPL, it is originally an academic project and is open source.