You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bindgen fails to generate the bindings due of memcpy begin undeclared in stb_dxt.h:
Compiling stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)
error: failed to run custom build command for `stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)`
Caused by:
process didn't exit successfully: `/home/victor/repos/stb/target/debug/build/stb-sys-664a37f75d337bdc/build-script-build` (exit status: 101)
--- stderr
./src/../vendor/stb/stb_dxt.h:608:7: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
./src/../vendor/stb/stb_dxt.h:608:7: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
./src/../vendor/stb/stb_dxt.h:608:7: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration], err: true
thread 'main' panicked at stb-sys/build.rs:40:10:
Failed to generate bindings: ()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Even after upgrading bindgen to the latest version, the generation still fails. However, this time the error returns a ClangDiagnostic related to memcpy not being declared:
Compiling stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)
error: failed to run custom build command for `stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)`
Caused by:
process didn't exit successfully: `/home/victor/repos/stb/target/debug/build/stb-sys-1a4a25a1890304b6/build-script-build` (exit status: 101)
--- stderr
./src/../vendor/stb/stb_dxt.h:608:7: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
./src/../vendor/stb/stb_dxt.h:608:7: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
thread 'main' panicked at stb-sys/build.rs:40:10:
Failed to generate bindings: ClangDiagnostic("./src/../vendor/stb/stb_dxt.h:608:7: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]\n")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
To work around this, I changed the order in which headers are added to the bindgen builder:
with this change, the bindings generation works, but the compilation still fails for the same reason.
Compiling stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)
The following warnings were emitted during compilation:
warning: stb-sys@0.6.0: In file included from src/stb_dxt.c:2:
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h: In function 'stb_compress_dxt_block':
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h:608:7: error: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
warning: stb-sys@0.6.0: 608 | memcpy(data, src, 4*16);
warning: stb-sys@0.6.0: | ^~~~~~
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h:89:1: note: include '<string.h>' or provide a declaration of 'memcpy'
warning: stb-sys@0.6.0: 88 | #include <math.h>
warning: stb-sys@0.6.0: +++ |+#include <string.h>
warning: stb-sys@0.6.0: 89 | #endif
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h:608:7: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch]
warning: stb-sys@0.6.0: 608 | memcpy(data, src, 4*16);
warning: stb-sys@0.6.0: | ^~~~~~
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h:608:7: note: include '<string.h>' or provide a declaration of 'memcpy'
error: failed to run custom build command for `stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)`
Caused by:
process didn't exit successfully: `/home/victor/repos/stb/target/debug/build/stb-sys-1a4a25a1890304b6/build-script-build` (exit status: 1)
--- stdout
OUT_DIR = Some(/home/victor/repos/stb/target/debug/build/stb-sys-3f0f7332534016a8/out)
OPT_LEVEL = Some(0)
TARGET = Some(x86_64-unknown-linux-gnu)
HOST = Some(x86_64-unknown-linux-gnu)
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
CC_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
CC_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(true)
CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
CARGO_ENCODED_RUSTFLAGS = Some()
cargo:warning=In file included from src/stb_dxt.c:2:
cargo:warning=src/../vendor/stb/stb_dxt.h: In function 'stb_compress_dxt_block':
cargo:warning=src/../vendor/stb/stb_dxt.h:608:7: error: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
cargo:warning= 608 | memcpy(data, src, 4*16);
cargo:warning= | ^~~~~~
cargo:warning=src/../vendor/stb/stb_dxt.h:89:1: note: include '<string.h>' or provide a declaration of 'memcpy'
cargo:warning= 88 | #include <math.h>
cargo:warning= +++ |+#include <string.h>
cargo:warning= 89 | #endif
cargo:warning=src/../vendor/stb/stb_dxt.h:608:7: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch]
cargo:warning= 608 | memcpy(data, src, 4*16);
cargo:warning= | ^~~~~~
cargo:warning=src/../vendor/stb/stb_dxt.h:608:7: note: include '<string.h>' or provide a declaration of 'memcpy'
--- stderr
error occurred in cc-rs: Command LC_ALL="C" "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-o" "/home/victor/repos/stb/target/debug/build/stb-sys-3f0f7332534016a8/out/ea708c7824d36062-stb_dxt.o" "-c" "src/stb_dxt.c" with args cc did not execute successfully (status code exit status: 1).
Finally, the build works when using clang-14 as the compiler, but still fails with clang-19:
$ CC=clang-14 cargo build
Compiling stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)
warning: stb-sys@0.6.0: In file included from src/stb_dxt.c:2:
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h:608:7: warning: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Wimplicit-function-declaration]
warning: stb-sys@0.6.0: memcpy(data, src, 4*16);
warning: stb-sys@0.6.0: ^
warning: stb-sys@0.6.0: src/../vendor/stb/stb_dxt.h:608:7: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
warning: stb-sys@0.6.0: 1 warning generated.
Compiling stb v0.3.2 (/home/victor/repos/stb/stb)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.81s
If I only include the header <string.h> in stb-sys/src/stb_dxt.c, without upgrading bindgen, the generation still fails:
Compiling stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)
error: failed to run custom build command for `stb-sys v0.6.0 (/home/victor/repos/stb/stb-sys)`
Caused by:
process didn't exit successfully: `/home/victor/repos/stb/target/debug/build/stb-sys-664a37f75d337bdc/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at /home/victor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.54.0/src/ir/ty.rs:1165:22:
Not able to resolve vector element?: Continue
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The text was updated successfully, but these errors were encountered:
bindgen
fails to generate the bindings due ofmemcpy
begin undeclared instb_dxt.h
:Even after upgrading
bindgen
to the latest version, the generation still fails. However, this time the error returns aClangDiagnostic
related tomemcpy
not being declared:To work around this, I changed the order in which headers are added to the
bindgen
builder:with this change, the bindings generation works, but the compilation still fails for the same reason.
Finally, the build works when using
clang-14
as the compiler, but still fails withclang-19
:If I only include the header
<string.h>
instb-sys/src/stb_dxt.c
, without upgradingbindgen
, the generation still fails:The text was updated successfully, but these errors were encountered: