$ sudo apt-get install libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang cmake make libprotobuf-dev protobuf-compiler
$ git clone https://github.com/solana-labs/solana
solana/cli
, solana/keygen
git://github.com/solana-labs/solana.git
05ffda9b16bfa9c784b22bbb0483f5a567373ae5
crate://
의 문제SRC_URI
에 crate://
에 명시해 가져오는데, 이는 cargo를 사용하지 않는다.cargo-update-recipe-crates.bbclass
는 이러한 업데이트를 지원케 한다.python3-bcrypt
tomllib
library와 관련있으며, 이는 Python 3.11
에 있음oe-core
에서 python3.11-rc2
로 먼저 업데이트해야한다.
1. 레시피의 ${S}를 가져와
2. Cargo.lock을 발견하면, (아래 예시는 solana의 Cargo.lock
)['package']
를 가져와서 source, source 내부에 crates.io가 있으면
crate://crates.io/<name>/<version>
를 줄줄이 단다.
cargo-update-recipe-crates.bbclass
를 사용하기 위해,patch: https://patchwork.yoctoproject.org/project/oe-core/patch/20220914120421.551923-1-alex@linutronix.de/
CARGO_LOC_SRC_DIR
to allow searching outside ${S}
${BPN}
in output file namediff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass
index f90938c734..c25fe8ef3e 100644
--- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass
+++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass
@@ -16,26 +16,30 @@
addtask do_update_crates after do_patch
do_update_crates[depends] = "python3-native:do_populate_sysroot"
+# The directory where to search for Cargo.lock files relative to the root directory ${S}
+CARGO_LOCK_SRC_DIR ??= ""
+
do_update_crates() {
nativepython3 - <<EOF
def get_crates(f):
import tomllib
- c_list = 'SRC_URI += " \\ \n'
+ c_list = '# from %s' % os.path.relpath(f, '${S}')
+ c_list += '\nSRC_URI += " \\\'
crates = tomllib.load(open(f, 'rb'))
for c in crates['package']:
if 'source' in c and 'crates.io' in c['source']:
- c_list += " crate://crates.io/{}/{} \\ \n".format(c['name'], c['version'])
- c_list += '"\n'
+ c_list += '\n crate://crates.io/%s/%s \\\' % (c['name'], c['version'])
+ c_list += '\n"\n'
return c_list
import os
crates = "# Autogenerated with 'bitbake -c update_crates ${PN}'\n\n"
-for root, dirs, files in os.walk('${S}'):
+for root, dirs, files in os.walk('${S}/${CARGO_LOCK_SRC_DIR}'):
for file in files:
if file == 'Cargo.lock':
crates += get_crates(os.path.join(root, file))
-open(os.path.join('${THISDIR}', '${PN}'+"-crates.inc"), 'w').write(crates)
+open(os.path.join('${THISDIR}', '${BPN}'+"-crates.inc"), 'w').write(crates)
EOF
}
DEBUG: Executing shell function do_compile
NOTE: cargo build -v --target aarch64-unknown-linux --release --manifest-path=TOPDIR/BUILD/work/raspberrypi4_64-unknown-linux/solana-program-library/2.1.1-r0/git/token/cli//Cargo.toml
error: failed to load manifest for workspace member `TOPDIR/BUILD/work/raspberrypi4_64-webos-linux/solana-program-library/2.1.1-r0/git/token-upgrade/cli`
Caused by:
failed to load manifest for dependency `spl-token-client`
Caused by:
failed to parse manifest at `TOPDIR/BUILD/work/raspberrypi4_64-unknown-linux/solana-program-library/2.1.1-r0/git/token/client/Cargo.toml`
Caused by:
namespaced features with the `dep:` prefix are only allowed on the nightly channel and requires the `-Z namespaced-features` flag on the command-line
WARNING: exit code 101 from a shell command.
rustc --print target-list
for a list of built-in targetsx86-64
로 사용TUNE_FEATURES
는 항상 target을 참조한다. 따라서 BUILD HOST(native)에서는 사용하길 원치않는다.TUNE_FEATURES
에 vfpv4
가 있으면, f
에 +vfp4
를 추가한다.rustlibdir = "${libdir}/rustlib/${RUST_HOST_SYS}/lib
FILES:${PN}
+=
"${rustlibdir}/
*.so"
FILES:${PN}-dev
+=
"${rustlibdir}/
*.rlib ${rustlibdir}/
*.rmeta "
FILES:${PN}-dbg
+=
"${rustlibdir}/
.debug"
RUSTLIB
= "-L ${STAGING_DIR_HOST}${rustlibdir}
"RUST_DEBUG_REMAP
= "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}
"RUSTFALGS
+= "${RUSTLIB}
${RUST_DEBUG_REMAP}
"RUSTLIB_DEP
?= "libstd-rs
"RUST_PANIC_STRATEGY
?= "unwind
"PREFERRED
될 것이기 때문에 결국엔 사용되지는 않을 것임rust-crosssdk_1.59.0.bb
Mangle bitbake's *_SYS into something that rust might support (see rust/mk/cfg/* for a list
Note that os is assumed to be some linux form
"x86_64"
BUILD_SYS
: Yocto triple of the build environmentHOST_SYS
: What we're building for in YoctoTARGET_SYS
: What we're building for in Yocto-native
BUILD_SYS == HOST_SYS == TARGET_SYS
HOST_SYS == TARGET_SYS
TARGET
: the system where the binary will runHOST
: the system whrere the binary is being builtbuild-rust-cc
#!/usr/bin/env python3
import os, sys
orig_binary = "gcc "
extras = ""
binary = orig_binary.split()[0]
args = orig_binary.split() + sys.argv[1:]
if extras:
args.append(extras)
os.execvp(binary, args)
target-rust-cc
#!/usr/bin/env python3
import os, sys
orig_binary = "aarch64-webos-linux-gcc -mcpu=cortex-a72 -march=armv8-a+crc -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type --sysroot=/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-webos-linux/solana-cli/1.14.5-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-webos-linux/solana-cli/1.14.5-r0=/usr/src/debug/solana-cli/1.14.5-r0 -fdebug-prefix-map=/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-webos-linux/solana-cli/1.14.5-r0=/usr/src/debug/solana-cli/1.14.5-r0 -fdebug-prefix-map=/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-webos-linux/solana-cli/1.14.5-r0/recipe-sysroot= -fdebug-prefix-map=/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-webos-linux/solana-cli/1.14.5-r0/recipe-sysroot-native= -Wl,-z,relro,-z,now"
extras = ""
binary = orig_binary.split()[0]
args = orig_binary.split() + sys.argv[1:]
if extras:
args.append(extras)
os.execvp(binary, args)
${CARGO_HOME}/config
# EXTRA_OECARGO_PATHS
paths = [
]
# Local mirror vendored by bitbake
[source.bitbake]
directory = "/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-<os>-linux/solana-cli/1.14.5-r0/cargo_home/bitbake"
[source.crates-io]
replace-with = "bitbake"
local-registry = "/nonexistant"
[http]
# Multiplexing can't be enabled because http2 can't be enabled
# in curl-native without dependency loops
multiplexing = false
# Ignore the hard coded and incorrect path to certificates
cainfo = "/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-<os>-linux/solana-cli/1.14.5-r0/recipe-sysroot-native/etc/ssl/certs/ca-certificates.crt"
# HOST_SYS
[target.aarch64-webos-linux-gnu]
linker = "/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-<os>-linux/solana-cli/1.14.5-r0/wrapper/target-rust-ccld"
# BUILD_SYS
[target.x86_64-linux-gnu]
linker = "/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-<os>-linux/solana-cli/1.14.5-r0/wrapper/build-rust-ccld"
[build]
# Use out of tree build destination to avoid poluting the source tree
target-dir = "/home/dhyang/workspace/build-webos/BUILD/work/raspberrypi4_64-<os>-linux/solana-cli/1.14.5-r0/build/target"
[term]
progress.when = 'always'
progress.width = 80
openssl-sys
문제solana-program-library
를 빌드할 때,error: failed to run custom build command for 'openssl-sys v0.9.60
가 뜬다.thread 'main' panicked at 'don't know how to configure OpenSSL for \
aarch64-webos-linux-gnu', \
TOPDIR/BUILD/work/raspberrypi4_64-<os>-linux/solana-program-library/2.1.1-r0/\
cargo_home/bitbake/openssl-src-111.22.0+1.1.1q/src/lib.rs:294:18
stack backtrace:
0: rust_begin_unwind
openssl
을 추가하고, export OPENSSL_NO_VENDOR = "1"
문장 추가.