Hello,
Currently I am trying to 'compiling' suricata 7.0.2-DEV git version for OpenWrt x86-64, currently I am stuck with somehow Suricata's Cargo.toml seems to be broken in one of the line?, as I am a rust newbie, I cann't quite figuring it out in which one of Cargo.toml is the problematic one :
Compiling bendy v0.3.3
Compiling asn1-rs v0.5.2
Compiling kerberos-parser v0.7.1
Compiling nom-derive v0.10.1
Compiling ntp-parser v0.6.0
Compiling num_enum v0.5.11
Compiling sawp-modbus v0.12.1
Compiling der-parser v8.2.0
Compiling snmp-parser v0.9.0
Compiling x509-parser v0.15.0
Compiling suricata v7.0.2-dev (/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust)
Finished dev [unoptimized + debuginfo] target(s) in 30.36s
if test -e ../rust/target/debug/suricata.lib; then \
cp -a ../rust/target/debug/suricata.lib \
../rust/target/debug/libsuricata_rust.a; \
fi
if test -e ../rust/target/debug/libsuricata.a; then \
cp -a ../rust/target/debug/libsuricata.a \
../rust/target/debug/libsuricata_rust.a; \
fi
make gen/rust-bindings.h
make[5]: Entering directory '/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust'
/home/username/works/openwrt/staging_dir/target-x86_64_glibc_custom/host/cargo/bin/cbindgen --config /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust/cbindgen.toml \
--quiet --verify --output /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust/gen/rust-bindings.h || true
ERROR: Couldn't execute `cargo metadata` with manifest "/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust/Cargo.toml": Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
ERROR: Couldn't generate bindings for /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust.
make[5]: Leaving directory '/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust'
make[4]: Leaving directory '/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust'
Making all in src
make[4]: Entering directory '/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/src'
make all-am
Now let's going directly at the issues :
ERROR: Couldn't execute `cargo metadata` with manifest "/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust/Cargo.toml": Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
ERROR: Couldn't generate bindings for /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/suricata-7.0.2/rust.
I am curious whether No such file or directory is about rust dependencies or just cbindgen runtime libraries is not found.
My Env :
export CARGO_HOME=$(STAGING_DIR)/host/cargo
export RUSTC=$(CARGO_HOME)/bin/rustc
export CBINDGEN=$(CARGO_HOME)/bin/cbindgen
I have tried the following :
By appending the LD_LIBRARY_PATH before the $(CBINDGEN) in ./rust/Makefile.am
diff -Naur a/rust/Makefile.am b/rust/Makefile.am
--- a/rust/Makefile.am
+++ b/rust/Makefile.am
@@ -81,7 +81,7 @@
if HAVE_CBINDGEN
gen/rust-bindings.h: $(RUST_SURICATA_LIB)
- cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
+ LD_LIBRARY_PATH=$(CARGO_HOME)/lib $(CBINDGEN) --config $(abs_top_srcdir)/rust/cbindgen.toml \
--quiet --verify --output $(abs_top_builddir)/rust/gen/rust-bindings.h || true
else
gen/rust-bindings.h:
@@ -92,7 +92,7 @@
if HAVE_CBINDGEN
dist/rust-bindings.h:
- cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
+ LD_LIBRARY_PATH=$(CARGO_HOME)/lib $(CBINDGEN) --config $(abs_top_srcdir)/rust/cbindgen.toml \
--quiet --output $(abs_top_builddir)/rust/dist/rust-bindings.h
else
dist/rust-bindings.h:
But still getting the same errors.
For references :
Suricata's Cargo.toml
Suricata's cbindgen.toml