arm64 대응

This commit is contained in:
Sangbum Kim 2024-02-14 00:51:31 +09:00
parent 2160fcea46
commit 5e50b8a25d
2 changed files with 14 additions and 4 deletions

View File

@ -18,8 +18,8 @@ RUN set -x && \
libcap-dev \ libcap-dev \
lld \ lld \
musl-dev &&\ musl-dev &&\
cargo build --release && \ cargo build --release
ldd target/release/setcap-static # ldd target/release/setcap-static
# RUN --mount=type=bind,rw,source=.,target=/host \ # RUN --mount=type=bind,rw,source=.,target=/host \
# cp -avf target/release/setcap-static /host/setcap-static # cp -avf target/release/setcap-static /host/setcap-static
@ -27,3 +27,13 @@ RUN set -x && \
FROM scratch FROM scratch
COPY --from=build /app/target/release/setcap-static /setcap-static COPY --from=build /app/target/release/setcap-static /setcap-static
# buildah push e5bcd588c41f harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0.2-amd64
# podman push e051029260e7 harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0.2-arm64
# podman manifest create \
# harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0.2 \
# harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0.2-amd64 \
# harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0.2-arm64
# podman push 88cf0c74f harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0.2
# podman push 88cf0c74f harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:0.0-latest
# podman push 88cf0c74f harbor.repository.lb.home.dc.internal.amuz.es/infrastructure/setcap-static:latest

View File

@ -118,7 +118,7 @@ impl<'a> Iterator for IntoIter<'a> {
/// ///
///It is UB to pass non-C string as it requires \0 ///It is UB to pass non-C string as it requires \0
unsafe fn c_str_to_rust(ptr: *const u8) -> Result<&'static str, core::str::Utf8Error> { unsafe fn c_str_to_rust(ptr: *const u8) -> Result<&'static str, core::str::Utf8Error> {
let len = libc::strlen(ptr as *const i8); let len = libc::strlen(ptr as *const c_char);
let parts = core::slice::from_raw_parts(ptr, len); let parts = core::slice::from_raw_parts(ptr, len);
core::str::from_utf8(parts) core::str::from_utf8(parts)
} }
@ -127,7 +127,7 @@ unsafe fn c_str_to_rust(ptr: *const u8) -> Result<&'static str, core::str::Utf8E
/// ///
///It is UB to pass non-C string as it requires \0 ///It is UB to pass non-C string as it requires \0
unsafe fn c_str_to_rust_unchecked(ptr: *const u8) -> &'static str { unsafe fn c_str_to_rust_unchecked(ptr: *const u8) -> &'static str {
let len = libc::strlen(ptr as *const i8); let len = libc::strlen(ptr as *const c_char);
let parts = core::slice::from_raw_parts(ptr, len); let parts = core::slice::from_raw_parts(ptr, len);
core::str::from_utf8_unchecked(parts) core::str::from_utf8_unchecked(parts)
} }