Closed 17steen closed 1 year ago
these are my configure flags: ./configure --enable-generic --disable-8139too --disable-e100 --disable-e1000 --disable-e1000e --disable-igb --disable-r8169 --disable-ccat --sysconfdir=/etc
Can you share more details about your checkout of the master repo? You should switch to the stable-1.5
branch.
I just realized this is not documented (except on IgH's site) and pushed an addition to README.
Sorry forgot to mention that, but I checked the stable branch out aswell
* stable-1.5
Hm. Can you set the RUST_BACKTRACE=1
env var and post the traceback?
I cannot reproduce with a fresh Ubuntu 22.04. Below is the Dockerfile I used...
FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y autoconf libtool pkg-config make systemd git cargo linux-headers-generic libclang-dev
RUN git clone https://gitlab.com/etherlab.org/ethercat
RUN cd ethercat && git checkout stable-1.5 && ./bootstrap \
&& ./configure --enable-generic --disable-8139too --disable-e100 --disable-e1000 --disable-e1000e --disable-igb --disable-r8169 --disable-ccat --sysconfdir=/etc --with-linux-dir=/usr/src/linux-headers-*-generic
RUN git clone https://github.com/ethercat-rs/ethercat ethercat-rs
RUN cd ethercat-rs && ETHERCAT_PATH=/ethercat cargo build
Edit: now also checked with your configure flags.
maybe i should start with a clean repo, i had configured with other flags before
EDIT: still got the same error with that identifier
RUST_BACKTRACE=1 cargo build Compiling ethercat-sys v0.2.0 error: failed to run custom build command for `ethercat-sys v0.2.0` note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation. Caused by: process didn't exit successfully: `/home/student/Sources/rust/ethercat-connection-rs/target/debug/build/ethercat-sys-3ae150160a12e9a6/build-script-build` (exit status: 101) --- stderr thread 'main' panicked at '"ec_ioctl_slave_t_struct_(unnamed_at_/home/student/Downloads/ethercat/master/ioctl_h_228_5)" is not a valid Ident', /home/student/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.51/src/fallback.rs:752:9 stack backtrace: 0: rust_begin_unwind at /rustc/5b8f284536d00ba649ca968584bedab4820d8527/library/std/src/panicking.rs:575:5 1: core::panicking::panic_fmt at /rustc/5b8f284536d00ba649ca968584bedab4820d8527/library/core/src/panicking.rs:64:14 2: proc_macro2::fallback::validate_ident 3: proc_macro2::fallback::Ident::_new 4: proc_macro2::fallback::Ident::new 5: proc_macro2::imp::Ident::new 6: proc_macro2::Ident::new 7: bindgen::ir::context::BindgenContext::rust_ident_raw 8: bindgen::ir::context::BindgenContext::rust_ident 9: <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen 10: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen 11: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen 12: <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen 13: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen 14: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen 15: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}} 16: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen 17: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen 18: bindgen::codegen::codegen::{{closure}} 19: bindgen::ir::context::BindgenContext::gen 20: bindgen::codegen::codegen 21: bindgen::Bindings::generate 22: bindgen::Builder::generate 23: build_script_build::main 24: core::ops::function::FnOnce::call_once note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[package]
name = "ethercat-connection-rs"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ethercat = "0.2.3"
this is my Cargo.toml
EDIT: i noticed the package is 3 months old on crates.io, this might be why
EDIT: changed to
[dependencies]
ethercat = { git = "https://github.com/ethercat-rs/ethercat" }
still get the same error
bindgen seems to get stuck at the anonymous sub-struct in master/ioctl.h
line 228. I can only imagine an incompatibility with clang (bindgen uses libclang
to parse the C code). Which clang/libclang do you have installed? Can you try with the latest one, like is installed in my Docker example?
I am using clang-17 from LLVM's ppa's this might be it, I do not exactly know how I can instruct the build process to use the ones provided by the ubuntu repositories instead
EDIT: ppa i use , probably pretty unstable
clang --version Ubuntu clang version 17.0.0 (++20230217042301+7c9df7743521-1~exp1~20230217042417.752) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
maybe i can LD_PRELOAD an older version of libclang
managed to build it using a fresh container as well. Once the sys package is built i can go forth outside the container, I assume, so this resolves the issue.
The unstable version of clang on my system must be the cause of the problem. Thanks for helping me find that out.
Thanks for confirming! We also have the pregenerated-bindings
feature which removes the need for the C checkout completely, however it is tied to a specific (and now outdated) revision.
Since IgH don't do release versions anymore, it's kind of hard to decide when to update them :(
using latest stable revision of the recommended ethercat repo, all works when using the c library, getting this error while compiling:
using Ubuntu 22.04.1 LTS kernel: 5.19.0-32-generic