Skip to content

Can't built on linux #4

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

Open
timbod7 opened this issue Jan 5, 2025 · 2 comments · May be fixed by #5
Open

Can't built on linux #4

timbod7 opened this issue Jan 5, 2025 · 2 comments · May be fixed by #5

Comments

@timbod7
Copy link

timbod7 commented Jan 5, 2025

When I build with the following:

git clone --recurse git@github.com:thekakkun/rust_slvs.git
cd rust_slvs
cargo build

cargo initially proceeds as expected:

    Updating crates.io index
     Locking 52 packages to latest compatible versions
      Adding bindgen v0.64.0 (latest: v0.71.1)
      Adding bitflags v1.3.2 (latest: v2.6.0)
      Adding linux-raw-sys v0.4.14 (latest: v0.6.5)
      Adding peeking_take_while v0.1.2 (latest: v1.0.0)
      Adding rustc-hash v1.1.0 (latest: v2.1.0)
      Adding syn v1.0.109 (latest: v2.0.94)
      Adding which v4.4.2 (latest: v7.0.1)
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling glob v0.3.2
   Compiling rustix v0.38.42
   Compiling libc v0.2.169
   Compiling memchr v2.7.4
   Compiling bitflags v2.6.0
   Compiling minimal-lexical v0.2.1
   Compiling regex-syntax v0.8.5
   Compiling syn v1.0.109
   Compiling linux-raw-sys v0.4.14
   Compiling cfg-if v1.0.0
   Compiling shlex v1.3.0
   Compiling either v1.13.0
   Compiling autocfg v1.4.0
   Compiling bindgen v0.64.0
   Compiling home v0.5.11
   Compiling lazycell v1.3.0
   Compiling log v0.4.22
   Compiling peeking_take_while v0.1.2
   Compiling libloading v0.8.6
   Compiling rustc-hash v1.1.0
   Compiling lazy_static v1.5.0
   Compiling bitflags v1.3.2
   Compiling cc v1.2.7
   Compiling dunce v1.0.5
   Compiling serde v1.0.217
   Compiling clang-sys v1.8.1
   Compiling num-traits v0.2.19
   Compiling nom v7.1.3
   Compiling quote v1.0.38
   Compiling syn v2.0.94
   Compiling euclid v0.22.11
   Compiling which v4.4.2
   Compiling regex-automata v0.4.9
   Compiling serde_derive v1.0.217
   Compiling cexpr v0.6.0
   Compiling regex v1.11.1
   Compiling slvs v0.6.0 (/tmp/rust_slvs)

then there are some warnings related to deprecations:

warning: slvs@0.6.0: In file included from /tmp/rust_slvs/solvespace/src/util.cpp:7:
warning: slvs@0.6.0: /tmp/rust_slvs/solvespace/src/solvespace.h:182:28: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations]
warning: slvs@0.6.0:   182 | class utf8_iterator : std::iterator<std::forward_iterator_tag, char32_t> {
warning: slvs@0.6.0:       |                            ^~~~~~~~
warning: slvs@0.6.0: In file included from /usr/include/c++/14/bits/stl_algobase.h:65,
warning: slvs@0.6.0:                  from /usr/include/c++/14/bits/hashtable_policy.h:36,
warning: slvs@0.6.0:                  from /usr/include/c++/14/bits/hashtable.h:35,
warning: slvs@0.6.0:                  from /usr/include/c++/14/bits/unordered_map.h:33,
warning: slvs@0.6.0:                  from /usr/include/c++/14/unordered_map:41,
warning: slvs@0.6.0:                  from /usr/include/c++/14/functional:63,
warning: slvs@0.6.0:                  from /tmp/rust_slvs/solvespace/src/resource.h:10,
warning: slvs@0.6.0:                  from /tmp/rust_slvs/solvespace/src/solvespace.h:10:
warning: slvs@0.6.0: /usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note: declared here
warning: slvs@0.6.0:   127 |     struct _GLIBCXX17_DEPRECATED iterator
warning: slvs@0.6.0:       |                                  ^~~~~~~~
warning: slvs@0.6.0: In file included from /tmp/rust_slvs/solvespace/src/entity.cpp:8:
warning: slvs@0.6.0: /tmp/rust_slvs/solvespace/src/solvespace.h:182:28: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations]
warning: slvs@0.6.0:   182 | class utf8_iterator : std::iterator<std::forward_iterator_tag, char32_t> {
warning: slvs@0.6.0:       |                            ^~~~~~~~
warning: slvs@0.6.0: In file included from /usr/include/c++/14/bits/stl_algobase.h:65,
warning: slvs@0.6.0:                  from /usr/include/c++/14/bits/hashtable_policy.h:36,
warning: slvs@0.6.0:                  from /usr/include/c++/14/bits/hashtable.h:35,
warning: slvs@0.6.0:                  from /usr/include/c++/14/bits/unordered_map.h:33,
warning: slvs@0.6.0:                  from /usr/include/c++/14/unordered_map:41,
warning: slvs@0.6.0:                  from /usr/include/c++/14/functional:63,
warning: slvs@0.6.0:                  from /tmp/rust_slvs/solvespace/src/resource.h:10,
warning: slvs@0.6.0:                  from /tmp/rust_slvs/solvespace/src/solvespace.h:10:
warning: slvs@0.6.0: /usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note: declared here
warning: slvs@0.6.0:   127 |     struct _GLIBCXX17_DEPRECATED iterator
warning: slvs@0.6.0:       |                                  ^~~~~~~~
...

but then fails with many errors like:

error[E0432]: unresolved imports `crate::bindings::Slvs_hEntity`, `crate::bindings::Slvs_hGroup`
 --> src/constraint/angle.rs:5:16
  |
5 |     bindings::{Slvs_hEntity, Slvs_hGroup, SLVS_C_ANGLE},
  |                ^^^^^^^^^^^^  ^^^^^^^^^^^ no `Slvs_hGroup` in `bindings`
  |                |
  |                no `Slvs_hEntity` in `bindings`

error[E0432]: unresolved imports `crate::bindings::Slvs_hEntity`, `crate::bindings::Slvs_hGroup`
 --> src/constraint/arc_arc_difference.rs:5:16
  |
5 |     bindings::{Slvs_hEntity, Slvs_hGroup, SLVS_C_ARC_ARC_DIFFERENCE},
  |                ^^^^^^^^^^^^  ^^^^^^^^^^^ no `Slvs_hGroup` in `bindings`
  |                |
  |                no `Slvs_hEntity` in `bindings`

error[E0432]: unresolved imports `crate::bindings::Slvs_hEntity`, `crate::bindings::Slvs_hGroup`
 --> src/constraint/arc_arc_len_ratio.rs:5:16
  |
5 |     bindings::{Slvs_hEntity, Slvs_hGroup, SLVS_C_ARC_ARC_LEN_RATIO},
  |                ^^^^^^^^^^^^  ^^^^^^^^^^^ no `Slvs_hGroup` in `bindings`
  |                |
  |                no `Slvs_hEntity` in `bindings`
...

It would appear that bindgen is not correctly generating all the definition required from solvespace.h. It only includes the constant values:

16:27:17 (main) /tmp/rust_slvs$ cat $(find target -name bindings.rs)
/* automatically generated by rust-bindgen 0.64.0 */

pub const SLVS_FREE_IN_3D: u32 = 0;
pub const SLVS_E_POINT_IN_3D: u32 = 50000;
pub const SLVS_E_POINT_IN_2D: u32 = 50001;
pub const SLVS_E_NORMAL_IN_3D: u32 = 60000;
pub const SLVS_E_NORMAL_IN_2D: u32 = 60001;
pub const SLVS_E_DISTANCE: u32 = 70000;
pub const SLVS_E_WORKPLANE: u32 = 80000;
pub const SLVS_E_LINE_SEGMENT: u32 = 80001;
pub const SLVS_E_CUBIC: u32 = 80002;
pub const SLVS_E_CIRCLE: u32 = 80003;
pub const SLVS_E_ARC_OF_CIRCLE: u32 = 80004;
pub const SLVS_C_POINTS_COINCIDENT: u32 = 100000;
pub const SLVS_C_PT_PT_DISTANCE: u32 = 100001;
pub const SLVS_C_PT_PLANE_DISTANCE: u32 = 100002;
pub const SLVS_C_PT_LINE_DISTANCE: u32 = 100003;
pub const SLVS_C_PT_FACE_DISTANCE: u32 = 100004;
pub const SLVS_C_PT_IN_PLANE: u32 = 100005;
pub const SLVS_C_PT_ON_LINE: u32 = 100006;
pub const SLVS_C_PT_ON_FACE: u32 = 100007;
pub const SLVS_C_EQUAL_LENGTH_LINES: u32 = 100008;
pub const SLVS_C_LENGTH_RATIO: u32 = 100009;
pub const SLVS_C_EQ_LEN_PT_LINE_D: u32 = 100010;
pub const SLVS_C_EQ_PT_LN_DISTANCES: u32 = 100011;
pub const SLVS_C_EQUAL_ANGLE: u32 = 100012;
pub const SLVS_C_EQUAL_LINE_ARC_LEN: u32 = 100013;
pub const SLVS_C_SYMMETRIC: u32 = 100014;
pub const SLVS_C_SYMMETRIC_HORIZ: u32 = 100015;
pub const SLVS_C_SYMMETRIC_VERT: u32 = 100016;
pub const SLVS_C_SYMMETRIC_LINE: u32 = 100017;
pub const SLVS_C_AT_MIDPOINT: u32 = 100018;
pub const SLVS_C_HORIZONTAL: u32 = 100019;
pub const SLVS_C_VERTICAL: u32 = 100020;
pub const SLVS_C_DIAMETER: u32 = 100021;
pub const SLVS_C_PT_ON_CIRCLE: u32 = 100022;
pub const SLVS_C_SAME_ORIENTATION: u32 = 100023;
pub const SLVS_C_ANGLE: u32 = 100024;
pub const SLVS_C_PARALLEL: u32 = 100025;
pub const SLVS_C_PERPENDICULAR: u32 = 100026;
pub const SLVS_C_ARC_LINE_TANGENT: u32 = 100027;
pub const SLVS_C_CUBIC_LINE_TANGENT: u32 = 100028;
pub const SLVS_C_EQUAL_RADIUS: u32 = 100029;
pub const SLVS_C_PROJ_PT_DISTANCE: u32 = 100030;
pub const SLVS_C_WHERE_DRAGGED: u32 = 100031;
pub const SLVS_C_CURVE_CURVE_TANGENT: u32 = 100032;
pub const SLVS_C_LENGTH_DIFFERENCE: u32 = 100033;
pub const SLVS_C_ARC_ARC_LEN_RATIO: u32 = 100034;
pub const SLVS_C_ARC_LINE_LEN_RATIO: u32 = 100035;
pub const SLVS_C_ARC_ARC_DIFFERENCE: u32 = 100036;
pub const SLVS_C_ARC_LINE_DIFFERENCE: u32 = 100037;
pub const SLVS_RESULT_OKAY: u32 = 0;
pub const SLVS_RESULT_INCONSISTENT: u32 = 1;
pub const SLVS_RESULT_DIDNT_CONVERGE: u32 = 2;
pub const SLVS_RESULT_TOO_MANY_UNKNOWNS: u32 = 3;
16:29:39 (main) /tmp/rust_slvs$ 

Any suggestions?

@timbod7
Copy link
Author

timbod7 commented Jan 5, 2025

Actually it works ok if I comment out the flags that tell bindgen to use c++. In build.rs:

        // .clang_arg("-x")
        // .clang_arg("c++")
        // .clang_arg("-std=c++11")

unsure why this fixes the build.

@timbod7
Copy link
Author

timbod7 commented Jan 5, 2025

Seems to be this problem:

rust-lang/rust-bindgen#2707

@timbod7 timbod7 linked a pull request Jan 5, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant