GithubHelp home page GithubHelp logo

clipper-sys's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar drbartling avatar jsadusk avatar lelongg avatar mkovaxx avatar nevsden avatar quentinperez avatar svenlinden avatar turnage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clipper-sys's Issues

Cannot compile clipper-sys to WASM on Mac M1

I am trying to compile some basic clipper functions to WASM, to use as a bridge to Javascript. This is on a Mac M1, which might have something to do with the issue I am seeing.

(FYI, I have compiled various other Rust code and crates to WASM without issue on this same M1 computer, so I think I have the basics down. Just not sure how to address this compiler error.)

When using the default Mac clang compiler, I get this error:

[INFO]: ๐ŸŒ€ Compiling to Wasm...
Compiling clipper-sys v0.7.2
The following warnings were emitted during compilation:

warning: In file included from clipper/clipper.cpp:41:
warning: clipper/clipper.hpp:52:10: fatal error: 'vector' file not found
warning: #include
warning: ^~~~~~~~
warning: 1 error generated.

error: failed to run custom build command for clipper-sys v0.7.2

Caused by:
process didn't exit successfully: /Users/rhead/git/fvtt-test-ccw/intersections/target/release/build/clipper-sys-6c959c9fe2b70968/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-changed=clipper
TARGET = Some("wasm32-unknown-unknown")
HOST = Some("aarch64-apple-darwin")
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-o" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/clipper/clipper.o" "-c" "clipper/clipper.cpp"
cargo:warning=In file included from clipper/clipper.cpp:41:
cargo:warning=clipper/clipper.hpp:52:10: fatal error: 'vector' file not found
cargo:warning=#include
cargo:warning= ^~~~~~~~
cargo:warning=1 error generated.
exit status: 1

--- stderr

error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-o" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/clipper/clipper.o" "-c" "clipper/clipper.cpp" with args "clang" did not execute successfully (status code exit status: 1).

Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute cargo build: exited with exit status: 101
full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

I would guess that clang is trying to compile "clipper/clipper.hpp" as a c file, not a c++ file. But if so, I don't know why, and don't know how to fix it.

I also tried installing gcc in homebrew, and then forced it to use that compiler instead, i.e, by passing environmental variables to the compile script: CC=/opt/homebrew/bin/gcc-11 CXX=/opt/homebrew/bin/g++-11 ./build_wasm.sh
I still get a compile error, albeit a different one:

[INFO]: ๐ŸŒ€ Compiling to Wasm...
Compiling clipper-sys v0.7.2
error: failed to run custom build command for clipper-sys v0.7.2

Caused by:
process didn't exit successfully: /Users/rhead/git/fvtt-test-ccw/intersections/target/release/build/clipper-sys-6c959c9fe2b70968/build-script-build (exit status: 101)
--- stdout
cargo:rerun-if-changed=clipper
TARGET = Some("wasm32-unknown-unknown")
HOST = Some("aarch64-apple-darwin")
CXX_wasm32-unknown-unknown = None
CXX_wasm32_unknown_unknown = None
TARGET_CXX = None
CXX = Some("/opt/homebrew/bin/g++-11")
CXXFLAGS_wasm32-unknown-unknown = None
CXXFLAGS_wasm32_unknown_unknown = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = None
running: "/opt/homebrew/bin/g++-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/clipper/clipper.o" "-c" "clipper/clipper.cpp"
exit status: 0
running: "/opt/homebrew/bin/g++-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/clipper/wrapper.o" "-c" "clipper/wrapper.cpp"
exit status: 0
AR_wasm32-unknown-unknown = None
AR_wasm32_unknown_unknown = None
TARGET_AR = None
AR = None
CROSS_COMPILE = None
running: "ar" "cq" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/libclipper.a" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/clipper/clipper.o" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/clipper/wrapper.o"
exit status: 0
running: "ar" "s" "/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out/libclipper.a"
exit status: 0
cargo:rustc-link-lib=static=clipper
cargo:rustc-link-search=native=/Users/rhead/git/fvtt-test-ccw/intersections/target/wasm32-unknown-unknown/release/build/clipper-sys-527f62cc4ff17778/out
CXXSTDLIB_wasm32-unknown-unknown = None
CXXSTDLIB_wasm32_unknown_unknown = None
TARGET_CXXSTDLIB = None
CXXSTDLIB = None
cargo:rustc-link-lib=stdc++

--- stderr
thread 'main' panicked at 'not implemented: target_os: unknown, target_env: ', /Users/rhead/.cargo/registry/src/github.com-1ecc6299db9ec823/clipper-sys-0.7.2/build.rs:23:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute cargo build: exited with exit status: 101
full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

Any insights would be much appreciated! Thanks!

Fails to build on Mac x86_64

I'm getting a failure to build on an x86_64 mac, Macos 12.3.1.

It looks like it's not using the right C++ version when compiling:

  cargo:warning=clipper/wrapper.cpp:201:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  cargo:warning=        auto &polygon = polygons.polygons[i];
  cargo:warning=        ^
  cargo:warning=clipper/wrapper.cpp:202:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  cargo:warning=        auto paths_closed = get_polygon_paths(polygon);
  cargo:warning=        ^
  cargo:warning=13 warnings and 1 error generated.
  exit status: 1

  --- stderr

  error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/derek/workspace/creative/aoer-plotty-rs/target/debug/build/clipper-sys-aa4025f4709bc662/out/clipper/wrapper.o" "-c" "clipper/wrapper.cpp" with args "c++" did not execute successfully (status code exit status: 1).

I can get this to compile fairly easily with a one-line change:
armyofevilrobots@0271a5a

I do wonder if I am missing some obvious setup step though...

Difference with Wagyu clipping lib

Hi, I noticed your lib wraps Angus Johnson clipping lib (unchanged since 2014?), and that seems to be the same lib that was used as the basis of Mapbox's wagyu. Moreover, Postgis has switched to Wagyu for their clipping needs as well. Would it make sense to migrate to Wagyu as it is far more recent and maintained? I am trying to re-implement some Postgis-based code in Rust, and clipping is a big part of that. Thanks!

Create license

This crate and geo-sys specify a license in the Cargo.toml, but have no license file in the repositories.

I think they should have clear license files and a CLA to ensure contributions are consistent with the license.

Segfaults when offsetting polygon

OS: Windows 10 x64

I'm attempting to offset a polygon, and am receiving a segfault when doing so. If LLDB is to be trusted, I believe this is due to size_t not mapping correctly; looking at bindings.rs, size_t ultimately resolves to u32, whereas in C++ the size_t is considered u64 (unsigned long long):

image

image

The failure is occurring here, I believe due to inflated count values as indicated in the second screenshot. This issue does not present when the same application is run in Linux.

Extend library to support simplification and cleaning of polygons

In an issue related to the here requested extension it has been pointed out, that the offset operator alone can lead to disfigured polygons, which do not yield a valid area.

In order to overcome this problem I propose to extend this library to support the SimplifyPolygons as well as the CleanPolygons function of the clipper library. The use of this can be examined in the issue mentioned above.

Todo

  • Add wrapper function for the SimplifyPolygons method.

  • Add wrapper function for the CleanPolygons method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.