Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'pub get' fails on Raspberry Pi 2 model B with Illegal instruction #24855

Closed
ginn13 opened this issue Nov 9, 2015 · 8 comments
Closed

'pub get' fails on Raspberry Pi 2 model B with Illegal instruction #24855

ginn13 opened this issue Nov 9, 2015 · 8 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@ginn13
Copy link

ginn13 commented Nov 9, 2015

I've built dart sdk according to instruction
https://github.com/dart-lang/sdk/wiki/Building-Dart-SDK-for-Raspberry-Pi
First time I used Ubuntu 15.10 to build dart-sdk, run install-build-deps.sh with --unsupported.
Second time I used Ubuntu 14.04.
Both builds lead to the same bug:
pub get fails with Illegal instruction.

Here is info about system and console output.
pi@raspberrypi ~/test $ uname -ap
Linux raspberrypi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux
pi@raspberrypi ~/test $ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

processor : 1
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

processor : 2
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

processor : 3
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

Hardware : BCM2709
Revision : a21041
Serial : 00000000cfdfd66f
pi@raspberrypi ~/test $ dart --version
Dart VM version: 1.13.0-edge.a825ac73f888886d36d2b3a3644ad602f8134f8a (Sun Nov 8 14:53:14 2015) on "linux_arm"
pi@raspberrypi ~/test $ ls -la
total 16
drwxr-xr-x 2 pi pi 4096 Nov 9 06:53 .
drwxr-xr-x 24 pi pi 4096 Nov 9 06:52 ..
-rw-r--r-- 1 pi pi 104 Nov 9 06:53 pubspec.yaml
-rw-r--r-- 1 pi pi 43 Nov 9 06:47 test.dart
pi@raspberrypi ~/test $ cat test.dart
void main() {
print("hello, dart!");
}
pi@raspberrypi ~/test $ cat pubspec.yaml
name: test
version: 0.0.1
author: tester
environment:
sdk: '>1.12.0 <2.0.0'
dependencies:
yaml: any

pi@raspberrypi ~/test $ dart test.dart
hello, dart!
pi@raspberrypi ~/test $ pub get
Resolving dependencies... Illegal instruction
pi@raspberrypi ~/test $ ulimit -c unlimited
pi@raspberrypi ~/test $ pub get
Resolving dependencies... Illegal instruction (core dumped)
pi@raspberrypi ~/test $ gdb /home/pi/dart-sdk/bin/dart core
GNU gdb (Raspbian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/pi/dart-sdk/bin/dart...(no debugging symbols found)...done.
[New LWP 20285]
[New LWP 20283]
[New LWP 20280]
[New LWP 20284]
[New LWP 20286]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `/home/pi/dart-sdk/bin/dart /home/pi/dart-sdk/bin/snapshots/pub.dart.snapshot ge'.
Program terminated with signal SIGILL, Illegal instruction.
#0 0x760366e0 in ?? ()

(gdb) bt
#0 0x760366e0 in ?? ()
#1 0x7556df34 in ?? ()

Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) disassemble 0x760366d0,+32
Dump of assembler code from 0x760366d0 to 0x760366f0:
0x760366d0: add r11, sp, #8
0x760366d4: ldr r5, [r6, #15]
0x760366d8: push {pc} ; (str pc, [sp, #-4]!)
0x760366dc: push {lr} ; (str lr, [sp, #-4]!)
=> 0x760366e0: push {sp} ; (str sp, [sp, #-4]!)
0x760366e4: push {r12} ; (str r12, [sp, #-4]!)
0x760366e8: push {r11} ; (str r11, [sp, #-4]!)
0x760366ec: push {r10} ; (str r10, [sp, #-4]!)
End of assembler dump.
(gdb)

Additional Info
If it is useful, pub get with no deps runs well and creates needed files/folders:
pi@raspberrypi ~/test $ ls -la
total 16
drwxr-xr-x 2 pi pi 4096 Nov 9 07:24 .
drwxr-xr-x 24 pi pi 4096 Nov 9 06:52 ..
-rw-r--r-- 1 pi pi 78 Nov 9 07:22 pubspec.yaml
-rw-r--r-- 1 pi pi 43 Nov 9 06:47 test.dart
pi@raspberrypi ~/test $ cat pubspec.yaml
name: test
version: 0.0.1
author: tester
environment:
sdk: '>1.12.0 <2.0.0'
pi@raspberrypi ~/test $ pub get
Resolving dependencies...
Got dependencies!
pi@raspberrypi ~/test $ ls -la
total 28
drwxr-xr-x 3 pi pi 4096 Nov 9 07:24 .
drwxr-xr-x 24 pi pi 4096 Nov 9 06:52 ..
drwxr-xr-x 2 pi pi 4096 Nov 9 07:24 packages
-rw-r--r-- 1 pi pi 57 Nov 9 07:24 .packages
-rw-r--r-- 1 pi pi 89 Nov 9 07:24 pubspec.lock
-rw-r--r-- 1 pi pi 78 Nov 9 07:22 pubspec.yaml
-rw-r--r-- 1 pi pi 43 Nov 9 06:47 test.dart

@ginn13 ginn13 changed the title 'pub get' fails on Raspberry Pi with Illegal instruction 'pub get' fails on Raspberry Pi model B with Illegal instruction Nov 9, 2015
@ginn13 ginn13 changed the title 'pub get' fails on Raspberry Pi model B with Illegal instruction 'pub get' fails on Raspberry Pi 2 model B with Illegal instruction Nov 9, 2015
@mit-mit mit-mit added the closed-not-planned Closed as we don't intend to take action on the reported issue label Nov 11, 2015
@mit-mit
Copy link
Member

mit-mit commented Nov 11, 2015

Raspberry Pi is not an officially supported platform for the Dart SDK, so closing this issue. I recommend you take a look at the Fletch project: https://github.com/dart-lang/fletch

@mit-mit mit-mit closed this as completed Nov 11, 2015
@fsc8000
Copy link
Contributor

fsc8000 commented Nov 11, 2015

There is no reason why the SDK should not work on an Raspberry Pi which is ARMv7. I don't have a Raspberry Pi at hand to reproduce it myself Can you try building a debug build (build.py -m debug) of the SDK and see what happens?

@fsc8000 fsc8000 reopened this Nov 11, 2015
@fsc8000 fsc8000 added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. and removed closed-not-planned Closed as we don't intend to take action on the reported issue labels Nov 11, 2015
@ginn13
Copy link
Author

ginn13 commented Nov 11, 2015

I've successfully built dart sdk with parameters:

./tools/build.py -m debug -a arm --toolchain=/home/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf create_sdk

pub get still behaves the same way:

pi@raspberrypi ~/test $ cat pubspec.yaml
name: test
version: 0.0.1
author: tester
environment:
  sdk: '>1.12.0 <2.0.0'
dependencies:
  yaml: any
pi@raspberrypi ~/test $ pub get -v
FINE: Pub 1.13.0-edge.a825ac73f888886d36d2b3a3644ad602f8134f8a
MSG : Resolving dependencies...
SLVR: Solving dependencies:
    | - yaml any from hosted (yaml)
IO  : Get versions from https://pub.dartlang.org/api/packages/yaml.
Illegal instruction (core dumped)

gdb output is similar:

pi@raspberrypi ~/test $ gdb /home/pi/dart-sdk/bin/dart core
GNU gdb (Raspbian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/pi/dart-sdk/bin/dart...(no debugging symbols found)..  .done.
[New LWP 2117]
[New LWP 2116]
[New LWP 2115]
[New LWP 2119]
[New LWP 2112]
[New LWP 2120]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `/home/pi/dart-sdk/bin/dart /home/pi/dart-sdk/bin/snapshot  s/pub.dart.snapshot ge'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x76053a28 in ?? ()
(gdb) disassemble 0x76053a20,+32
Dump of assembler code from 0x76053a20 to 0x76053a40:
   0x76053a20:  push    {pc}            ; (str pc, [sp, #-4]!)
   0x76053a24:  push    {lr}            ; (str lr, [sp, #-4]!)
=> 0x76053a28:  push    {sp}            ; (str sp, [sp, #-4]!)
   0x76053a2c:  push    {r12}           ; (str r12, [sp, #-4]!)
   0x76053a30:  push    {r11}           ; (str r11, [sp, #-4]!)
   0x76053a34:  push    {r10}           ; (str r10, [sp, #-4]!)
   0x76053a38:  push    {r9}            ; (str r9, [sp, #-4]!)
   0x76053a3c:  push    {r8}            ; (str r8, [sp, #-4]!)
End of assembler dump.
(gdb) Quit

Behavior is the same while compiling with default toolchain

@fsc8000
Copy link
Contributor

fsc8000 commented Nov 12, 2015

@zanderso, @rmacnak-google: Is there any known issue on Raspberry Pi? Is {sp} not allowed in a push instruction there?

@zanderso
Copy link
Member

The Raspberry Pi 2 has an ARMv7 processor. Those instructions from the wiki, and the cross-compiler mentioned there, are for the ARMv6 Raspberry Pi. I believe the default ARM cross compiler you get with Ubuntu 14.04 should generate an ARMv7 SDK that will run on the Pi2. I think @rmacnak-google has tried this more recently. You can just follow the generic ARM instructions from the Wiki.

About where this fault is happening. It looks like the deopt sequence. In ARM mode rather than THUMB mode, a push of SP should be allowed, and if it weren't allowed neither would a push of PC, so this is weird place to see such a fault. If we still hit it after using the correct cross-compiler, we'll have to investigate more carefully.

@mit-mit we have some customers using the VM on ARMv7, so we must be sure we are working on these platforms. Please get in touch with me or @iposva-google for clarification.

@zanderso
Copy link
Member

Check that. I was looking at the docs for STM. PUSH does an STR with writeback. The docs say STR with writeback is unpredictable when the source register and the base register are the same. @rmacnak-google is taking a look.

@rmacnak-google
Copy link
Contributor

I couldn't reproduce this on my Raspberry Pi 2. Can you try again after syncing past c315da5?

@ginn13
Copy link
Author

ginn13 commented Nov 15, 2015

Seems to be fixed, thanks. pub get works. So does other code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

5 participants