Closed duanyytop closed 1 year ago
How is your project structured? You may try some alternative ways to configure cross: https://github.com/cross-rs/cross#configuration
This issue occurs when the project is incorrectly migrated, with the Cross.toml file missing in the migration process. I believe it would be beneficial to include a checking mechanism in the capsule to detect the presence of the Cross.toml file.
Any updates? Do we need to do additional cross configuration separately?
I guess this error occurs when using capsule v0.10.1 and the contract depends on the dynamic link library? Maybe you guys can try.
How is your project structured? Is there a cargo workspace in the root directory like the template? In which directory did you run capsule build
or cross build
?
Any updates? Do we need to do additional cross configuration separately?
I guess this error occurs when using capsule v0.10.1 and the contract depends on the dynamic link library? Maybe you guys can try.
Your project was incorrectly migrated. That's why the cross.toml is missing.
How is your project structured? Is there a cargo workspace in the root directory like the template? In which directory did you run
capsule build
orcross build
?
ll
total 128K
drwxrwxr-x 3 dylan dylan 4.0K Jul 28 17:25 build
drwxrwxr-x 4 dylan dylan 4.0K Jul 28 16:36 c
-rw-rw-r-- 1 dylan dylan 108 Aug 21 13:45 capsule.toml
-rw-rw-r-- 1 dylan dylan 49K Aug 21 17:19 Cargo.lock
-rw-rw-r-- 1 dylan dylan 231 Jul 31 09:31 Cargo.toml
drwxrwxr-x 3 dylan dylan 4.0K Jul 28 16:36 ckb-lib-rsa
drwxrwxr-x 3 dylan dylan 4.0K Jul 28 16:36 ckb-lib-secp256k1
drwxrwxr-x 3 dylan dylan 4.0K Jul 28 16:36 ckb-lib-secp256r1
drwxrwxr-x 3 dylan dylan 4.0K Jul 28 16:36 ckb-lib-smt
drwxrwxr-x 11 dylan dylan 4.0K Jul 28 17:40 ckb-miscellaneous-scripts
drwxrwxr-x 10 dylan dylan 4.0K Jul 28 16:36 ckb-production-scripts
drwxrwxr-x 3 dylan dylan 4.0K Jul 28 16:36 contracts
-rw-rw-r-- 1 dylan dylan 590 Jul 28 16:36 deployment.toml
-rw-rw-r-- 1 dylan dylan 427 Jul 28 16:36 Makefile
drwxrwxr-x 2 dylan dylan 4.0K Jul 28 16:36 migrations
-rw-rw-r-- 1 dylan dylan 468 Jul 28 16:36 README.md
-rw-rw-r-- 1 dylan dylan 291 Jul 28 16:36 rustfmt.toml
-rw-rw-r-- 1 dylan dylan 18 Aug 21 17:25 rust-toolchain
drwxrwxr-x 4 dylan dylan 4.0K Aug 21 17:45 target
drwxrwxr-x 3 dylan dylan 4.0K Aug 11 09:27 tests
And the root Cargo.toml is as below:
[workspace]
members = ["tests", "contracts/joyid-lock", "ckb-lib-secp256r1", "ckb-lib-smt", "ckb-lib-secp256k1", "ckb-lib-rsa"]
I run capsule build
in root directory
Any updates? Do we need to do additional cross configuration separately? I guess this error occurs when using capsule v0.10.1 and the contract depends on the dynamic link library? Maybe you guys can try.
Your project was incorrectly migrated. That's why the cross.toml is missing.
Do I need to add Cross.toml to my project? Or does the capsule handle the absence of Cross.toml ?
You do need to add the Cross.toml
file in the project root. Does it work when the file exists?
The issue is fixed by adding Cross.toml to root directory, but the other issue occurs and the log is as below:
The ckb-std version is v0.14.2 for all sub modules except for
ckb-production-scripts
whose ckb-std version is v0.7.3
capsule build --release
Building contract joyid-lock
RUSTFLAGS=--remap-path-prefix=/home/dylan=~ --remap-path-prefix=/home/dylan/ckb/contracts/joyid-contract=
$ cross build -p joyid-lock --release
Compiling ckb-std v0.10.0
Compiling ckb-lib-rsa v0.1.0 (/home/dylan/ckb/contracts/joyid-contract/ckb-lib-rsa)
Compiling ckb-lib-smt v0.1.0 (/home/dylan/ckb/contracts/joyid-contract/ckb-lib-smt)
Compiling ckb-lib-secp256k1 v0.1.0 (/home/dylan/ckb/contracts/joyid-contract/ckb-lib-secp256k1)
Compiling ckb-lib-secp256r1 v0.1.0 (/home/dylan/ckb/contracts/joyid-contract/ckb-lib-secp256r1)
The following warnings were emitted during compilation:
warning: In file included from dl-c-impl/ckb-c-stdlib/libc/entry.h:5,
warning: from dl-c-impl/ckb-c-stdlib/libc/stddef.h:6,
warning: from dl-c-impl/ckb-c-stdlib/ckb_syscalls.h:4,
warning: from dl-c-impl/ckb-c-stdlib/ckb_dlfcn.h:4,
warning: from dl-c-impl/lib.c:5:
warning: dl-c-impl/ckb-c-stdlib/libc/src/impl.c: In function 'cycle':
warning: dl-c-impl/ckb-c-stdlib/libc/src/impl.c:391:9: error: storing the address of local variable 'tmp' in '*ar_32(D) + _2' [-Werror=dangling-pointer=]
warning: 391 | ar[n] = tmp;
warning: | ~~~~~~^~~~~
warning: dl-c-impl/ckb-c-stdlib/libc/src/impl.c:383:17: note: 'tmp' declared here
warning: 383 | unsigned char tmp[256];
warning: | ^~~
warning: dl-c-impl/ckb-c-stdlib/libc/src/impl.c:383:17: note: 'ar' declared here
warning: cc1: all warnings being treated as errors
error: failed to run custom build command for `ckb-std v0.10.0`
Caused by:
process didn't exit successfully: `/target/release/build/ckb-std-a905efdb213178f3/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("riscv64imac-unknown-none-elf")
OPT_LEVEL = Some("s")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_riscv64imac-unknown-none-elf
CC_riscv64imac-unknown-none-elf = None
cargo:rerun-if-env-changed=CC_riscv64imac_unknown_none_elf
CC_riscv64imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = None
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CFLAGS_riscv64imac-unknown-none-elf
CFLAGS_riscv64imac-unknown-none-elf = None
cargo:rerun-if-env-changed=CFLAGS_riscv64imac_unknown_none_elf
CFLAGS_riscv64imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("a,c,m")
running: "riscv64-unknown-elf-gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-march=rv64imac" "-mabi=lp64" "-mcmodel=medany" "-Wall" "-Wextra" "-o" "/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out/src/asm/syscall.o" "-c" "src/asm/syscall.S"
exit status: 0
cargo:rerun-if-env-changed=AR_riscv64imac-unknown-none-elf
AR_riscv64imac-unknown-none-elf = None
cargo:rerun-if-env-changed=AR_riscv64imac_unknown_none_elf
AR_riscv64imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_AR
TARGET_AR = None
cargo:rerun-if-env-changed=AR
AR = None
running: ZERO_AR_DATE="1" "riscv64-unknown-elf-ar" "cq" "/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out/libckb-syscall.a" "/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out/src/asm/syscall.o"
exit status: 0
running: "riscv64-unknown-elf-ar" "s" "/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out/libckb-syscall.a"
exit status: 0
cargo:rustc-link-lib=static=ckb-syscall
cargo:rustc-link-search=native=/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out
TARGET = Some("riscv64imac-unknown-none-elf")
OPT_LEVEL = Some("s")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_riscv64imac-unknown-none-elf
CC_riscv64imac-unknown-none-elf = None
cargo:rerun-if-env-changed=CC_riscv64imac_unknown_none_elf
CC_riscv64imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = None
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CFLAGS_riscv64imac-unknown-none-elf
CFLAGS_riscv64imac-unknown-none-elf = None
cargo:rerun-if-env-changed=CFLAGS_riscv64imac_unknown_none_elf
CFLAGS_riscv64imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "riscv64-unknown-elf-gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-march=rv64imac" "-mabi=lp64" "-mcmodel=medany" "-static" "-I" "dl-c-impl/ckb-c-stdlib" "-I" "dl-c-impl/ckb-c-stdlib/libc" "-Wall" "-Wextra" "-O3" "-fno-builtin-printf" "-fno-builtin-memcmp" "-nostdinc" "-nostdlib" "-fvisibility=hidden" "-fdata-sections" "-ffunction-sections" "-Wall" "-Werror" "-Wno-unused-parameter" "-Wno-nonnull" "-Wno-nonnull-compare" "-nostartfiles" "-D__SHARED_LIBRARY__" "-o" "/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out/dl-c-impl/lib.o" "-c" "dl-c-impl/lib.c"
cargo:warning=In file included from dl-c-impl/ckb-c-stdlib/libc/entry.h:5,
cargo:warning= from dl-c-impl/ckb-c-stdlib/libc/stddef.h:6,
cargo:warning= from dl-c-impl/ckb-c-stdlib/ckb_syscalls.h:4,
cargo:warning= from dl-c-impl/ckb-c-stdlib/ckb_dlfcn.h:4,
cargo:warning= from dl-c-impl/lib.c:5:
cargo:warning=dl-c-impl/ckb-c-stdlib/libc/src/impl.c: In function 'cycle':
cargo:warning=dl-c-impl/ckb-c-stdlib/libc/src/impl.c:391:9: error: storing the address of local variable 'tmp' in '*ar_32(D) + _2' [-Werror=dangling-pointer=]
cargo:warning= 391 | ar[n] = tmp;
cargo:warning= | ~~~~~~^~~~~
cargo:warning=dl-c-impl/ckb-c-stdlib/libc/src/impl.c:383:17: note: 'tmp' declared here
cargo:warning= 383 | unsigned char tmp[256];
cargo:warning= | ^~~
cargo:warning=dl-c-impl/ckb-c-stdlib/libc/src/impl.c:383:17: note: 'ar' declared here
cargo:warning=cc1: all warnings being treated as errors
exit status: 1
--- stderr
error occurred: Command "riscv64-unknown-elf-gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-march=rv64imac" "-mabi=lp64" "-mcmodel=medany" "-static" "-I" "dl-c-impl/ckb-c-stdlib" "-I" "dl-c-impl/ckb-c-stdlib/libc" "-Wall" "-Wextra" "-O3" "-fno-builtin-printf" "-fno-builtin-memcmp" "-nostdinc" "-nostdlib" "-fvisibility=hidden" "-fdata-sections" "-ffunction-sections" "-Wall" "-Werror" "-Wno-unused-parameter" "-Wno-nonnull" "-Wno-nonnull-compare" "-nostartfiles" "-D__SHARED_LIBRARY__" "-o" "/target/riscv64imac-unknown-none-elf/release/build/ckb-std-7f8999f73c4cf9f5/out/dl-c-impl/lib.o" "-c" "dl-c-impl/lib.c" with args "riscv64-unknown-elf-gcc" did not execute successfully (status code exit status: 1).
error: command exited with non-zero code `cross build -p joyid-lock --release`: 101
make: *** [Makefile:7: build-release] Error 255
Thanks a lot. All issues are fixed and I will close the issues
Bug description
Should not load x86 docker images for cross
The suggestion from xjd is adding Cross.toml file and upgrading ckb-std:
Environment