Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
qemu chroot to arm64 cannot run cc1
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
dongfangxunlei
n00b
n00b


Joined: 30 Jan 2013
Posts: 40

PostPosted: Tue Dec 23, 2014 8:16 am    Post subject: qemu chroot to arm64 cannot run cc1 Reply with quote

Hi,everyone!
I want to use qemu-aarch64 to chroot to a debian aarch64 envirenment.
According to https://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&chap=5
I have successfully chroot and can run bash shell and some other basic commands.But when I continue to use gcc to compile my project,I got "gcc: error trying to exec '/usr/lib/gcc/aarch64-linux-gnu/4.9/cc1': execv: Exec format error".
I don't know why.
Since /usr/lib/gcc/aarch64-linux-gnu/4.9/cc1 and /bin/bash are both ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.7.0
Back to top
View user's profile Send private message
dongfangxunlei
n00b
n00b


Joined: 30 Jan 2013
Posts: 40

PostPosted: Tue Dec 23, 2014 8:53 am    Post subject: 123 Reply with quote

My solution is
cd /usr/lib/gcc/aarch64-linux-gnu/4.9
mv cc1 qemu-cc1
mv cc1plus qemu-cc1plus
cat > cc1 <<EOF
#!/bin/sh
exec qemu-aarch64 /usr/lib/gcc/aarch64-linux-gnu/4.9/qemu-cc1 "$@"
EOF

cat > cc1plus <<EOF
#!/bin/sh
exec qemu-aarch64 /usr/lib/gcc/aarch64-linux-gnu/4.9/qemu-cc1plus "$@"
EOF

chmod 755 /usr/lib/gcc/aarch64-linux-gnu/4.9/qemu-cc1 /usr/lib/gcc/aarch64-linux-gnu/4.9/qemu-cc1plus

Does anyone have more elegant idea?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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