Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Compiling Rust code under qemu user chroot environment
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Sat Aug 06, 2022 7:34 pm    Post subject: Compiling Rust code under qemu user chroot environment Reply with quote

I'm trying to compile a Rust application under a qemu user chroot environment. The chroot environment is ARM running on an AMD64 system. Cargo fails to fetch dependent crates in the environment as follows.

Code:
Updating crates.io index
error: failed to get `libc` as a dependency of package `newt v0.6.8 (/root/src/newt-rs)`

Caused by:
  failed to load source for dependency `libc`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  target OID for the reference doesn't exist on the repository; class=Reference (4)


Any ideas as to what could be happening?
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sun Aug 07, 2022 11:05 am    Post subject: Reply with quote

Do you have internet access?

Please execute the commands below:
Code:
cd /tmp
wget https://github.com/rust-lang/crates.io-index

Does it work? Or do you get an error?
Back to top
View user's profile Send private message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Wed Aug 10, 2022 3:01 am    Post subject: Reply with quote

The above works fine.

Code:
--2022-08-09 19:55:08--  https://github.com/rust-lang/crates.io-index
Resolving github.com... 192.30.255.113
Connecting to github.com|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘crates.io-index’

crates.io-index                                                          [            <=>                                                                                                                                                     ]   1.25M   385KB/s    in 3.3s

2022-08-09 19:55:12 (385 KB/s) - ‘crates.io-index’ saved [1308037]


Also ping and DNS lookups work fine.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Wed Aug 10, 2022 2:56 pm    Post subject: Reply with quote

Exactly what command are you using that leads to the cargo error? Is this being done by Portage or from a custom build system that you invoke by hand?
Back to top
View user's profile Send private message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Wed Aug 10, 2022 8:22 pm    Post subject: Reply with quote

I'm running
Code:
cargo build --features asm


I installed Rust using the arm-unknown-linux-gnueabi rust-init from https://forge.rust-lang.org/infra/other-installation-methods.html.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Wed Aug 10, 2022 10:11 pm    Post subject: Reply with quote

Do you know strace? You could run
Code:
strace -f -o /tmp/strace.log cargo build --features asm

and look for failing system calls directly before the output of the error message. But I worry that the strace.log will be loooong. It may be difficult to find the failing system call in strace.log.
Back to top
View user's profile Send private message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Thu Aug 11, 2022 1:16 am    Post subject: Reply with quote

strace fails immediately.

Code:
/usr/bin/strace: test_ptrace_get_syscall_info: PTRACE_TRACEME: Function not implemented
/usr/bin/strace: ptrace(PTRACE_TRACEME, ...): Function not implemented
/usr/bin/strace: PTRACE_SETOPTIONS: Function not implemented
/usr/bin/strace: detach: waitpid(22801): No child processes


*edit*
Okay, I set the environment variable QEMU_STRACE=1 and strace runs, but its threads/child processes fail with similar errors.

One failed with
Code:
/usr/bin/strace: ptrace(PTRACE_TRACEME, ...): Function not implemented


and another failed with
Code:
/usr/bin/strace: PTRACE_SETOPTIONS: Function not implemented


I'm going to continue looking into strace though.

*edit*
Actually that environment variable seems to cause every program run by qemu to be straced automatically by the emulator.
Back to top
View user's profile Send private message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Thu Aug 11, 2022 2:30 am    Post subject: Reply with quote

Under strace I'm seeing alot of

Code:
Unknown syscall 403
Back to top
View user's profile Send private message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Thu Aug 11, 2022 3:16 am    Post subject: Reply with quote

The error occurring just before the failed to get dependency errors is

Code:
openat(AT_FDCWD,"/root/src/newt-rs/target/.rustc_info.json",O_WRONLY|O_CREAT|O_LARGEFILE|O_TRUNC|O_CLOEXEC,0666) = -1 errno=2 (No such file or directory)


And before that it looks like something was downloaded and written to

Code:
/root/.cargo/registry/index/github.com-1285ae84e5963aae/.git/objects/pack/pack-8ec23db35fd1a7feb23e032a338bbba1108cfb76.idx
Back to top
View user's profile Send private message
XelKarin
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 82

PostPosted: Sun Aug 21, 2022 10:41 pm    Post subject: Reply with quote

I created an AARCH64 chroot and the build completes fine under that. Seems the issue only occurs with ARM32.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sun Aug 21, 2022 10:56 pm    Post subject: Reply with quote

Quote:
Under strace I'm seeing alot of

Code:
Unknown syscall 403


According to this post, that's clock_gettime64().
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum