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

Illegal Instruction ponyc Hello World example #1661

Closed
azzuwan opened this issue Mar 12, 2017 · 14 comments
Closed

Illegal Instruction ponyc Hello World example #1661

azzuwan opened this issue Mar 12, 2017 · 14 comments
Assignees

Comments

@azzuwan
Copy link

azzuwan commented Mar 12, 2017

I'm on Linux Deepin ( Debian Jessie) using the bintray DEB package

Stack trace:

_strace ponyc

execve("/usr/bin/ponyc", ["ponyc"], [/* 59 vars */]) = 0
brk(NULL)                               = 0x3187000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad9f33f000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=206760, ...}) = 0
mmap(NULL, 206760, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fad9f30c000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300!\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=105088, ...}) = 0
mmap(NULL, 2200072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9ef06000
mprotect(0x7fad9ef1f000, 2093056, PROT_NONE) = 0
mmap(0x7fad9f11e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fad9f11e000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\315\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=170776, ...}) = 0
mmap(NULL, 2267936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9ecdc000
mprotect(0x7fad9ed02000, 2093056, PROT_NONE) = 0
mmap(0x7fad9ef01000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7fad9ef01000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=135448, ...}) = 0
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9eabf000
mprotect(0x7fad9ead7000, 2093056, PROT_NONE) = 0
mmap(0x7fad9ecd6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fad9ecd6000
mmap(0x7fad9ecd8000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fad9ecd8000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14640, ...}) = 0
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9e8bb000
mprotect(0x7fad9e8bd000, 2097152, PROT_NONE) = 0
mmap(0x7fad9eabd000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fad9eabd000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\270\10\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1562040, ...}) = 0
mmap(NULL, 3670624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9e53a000
mprotect(0x7fad9e6ab000, 2097152, PROT_NONE) = 0
mmap(0x7fad9e8ab000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x171000) = 0x7fad9e8ab000
mmap(0x7fad9e8b7000, 12896, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fad9e8b7000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200V\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1063328, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad9f30a000
mmap(NULL, 3158248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9e236000
mprotect(0x7fad9e339000, 2093056, PROT_NONE) = 0
mmap(0x7fad9e538000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x102000) = 0x7fad9e538000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=89760, ...}) = 0
mmap(NULL, 2185552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9e020000
mprotect(0x7fad9e036000, 2093056, PROT_NONE) = 0
mmap(0x7fad9e235000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fad9e235000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\3\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1685264, ...}) = 0
mmap(NULL, 3791264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad9dc82000
mprotect(0x7fad9de17000, 2093056, PROT_NONE) = 0
mmap(0x7fad9e016000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x194000) = 0x7fad9e016000
mmap(0x7fad9e01c000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fad9e01c000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad9f308000
arch_prctl(ARCH_SET_FS, 0x7fad9f309380) = 0
mprotect(0x7fad9e016000, 16384, PROT_READ) = 0
mprotect(0x7fad9e538000, 4096, PROT_READ) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad9f306000
mprotect(0x7fad9e8ab000, 40960, PROT_READ) = 0
mprotect(0x7fad9eabd000, 4096, PROT_READ) = 0
mprotect(0x7fad9ecd6000, 4096, PROT_READ) = 0
mprotect(0x7fad9ef01000, 16384, PROT_READ) = 0
mprotect(0x7fad9f11e000, 4096, PROT_READ) = 0
mprotect(0x244c000, 2998272, PROT_READ) = 0
mprotect(0x7fad9f342000, 4096, PROT_READ) = 0
munmap(0x7fad9f30c000, 206760)          = 0
set_tid_address(0x7fad9f309650)         = 584
set_robust_list(0x7fad9f309660, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7fad9eac4b80, [], SA_RESTORER|SA_SIGINFO, 0x7fad9ead0100}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7fad9eac4c10, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fad9ead0100}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
brk(NULL)                               = 0x3187000
brk(0x31b9000)                          = 0x31b9000
futex(0x2766810, FUTEX_WAKE_PRIVATE, 2147483647) = 0
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPN, si_addr=0x7167d9} ---
+++ killed by SIGILL +++
Illegal instruction

_

@SeanTAllen
Copy link
Member

SeanTAllen commented Mar 12, 2017

@azzuwan can you try building from source and seeing if you have the same problem?

Also, what type of CPU do you have?

@azzuwan
Copy link
Author

azzuwan commented Mar 12, 2017

I'm on x86 64 bit intel CPU. I just compiled from source. The compilation process was smooth but executing hello world gives me this:
ponyc-error

@davidgiven
Copy link

This is happening to me, using the ponyc-release from the Debian archive. ponyc simply won't start. Bare metal, no virtualisation.

$ gdb ponyc
(gdb) run
Program received signal SIGILL, Illegal instruction.
0x00000000007167d9 in ponyint_next_pow2 ()
(gdb) bt
#0  0x00000000007167d9 in ponyint_next_pow2 ()
#1  0x000000000071691d in ponyint_hashmap_init ()
#2  0x0000000000613ec4 in main ()
(gdb) disas
Dump of assembler code for function ponyint_next_pow2:
   0x00000000007167b0 <+0>:	mov    $0x1,%eax
   0x00000000007167b5 <+5>:	sub    $0x1,%rdi
   0x00000000007167b9 <+9>:	je     0x7167c7 <ponyint_next_pow2+23>
   0x00000000007167bb <+11>:	lzcnt  %rdi,%rdi
   0x00000000007167c0 <+16>:	movslq %edi,%rdx
   0x00000000007167c3 <+19>:	test   %edi,%edi
   0x00000000007167c5 <+21>:	jne    0x7167d0 <ponyint_next_pow2+32>
   0x00000000007167c7 <+23>:	retq   
   0x00000000007167c8 <+24>:	nopl   0x0(%rax,%rax,1)
   0x00000000007167d0 <+32>:	mov    $0x40,%ecx
   0x00000000007167d5 <+37>:	sub    %edx,%ecx
   0x00000000007167d7 <+39>:	mov    %ecx,%edx
=> 0x00000000007167d9 <+41>:	shlx   %rdx,%rax,%rax
   0x00000000007167de <+46>:	retq   
End of assembler dump.

$ cat /proc/cpuinfo
(edited)
model name	: Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts

shlx is AVX2, right? I don't have that.

@SeanTAllen
Copy link
Member

@azzuwan do you know which specific cpu you have, AVX and AVX2 are somewhat regular sources of problems on certain CPUs.

@SeanTAllen
Copy link
Member

@davidgiven looks like you have an IvyBridge, I don't believe shlx is supported on it.

Sorry you are having difficulties getting started. Can you try building ponyc from source and seeing if that addresses the issue?

@SeanTAllen
Copy link
Member

@azzuwan try building the helloworld app from within the examples/helloworld directory

you would do that by running ponyc in the directory. with the pony compiler, it will compile everything in the directory so you don't give it the name of a specific file.

@azzuwan
Copy link
Author

azzuwan commented Mar 12, 2017

@SeanTAllen You are right the source compile works without the file name. A careless mistake on my side. Regarding the deb installer, I will try again on my other machines later. This one will do for me now. Thank you!

@SeanTAllen
Copy link
Member

@davidgiven @azzuwan sorry for the issues you hit. this has been a festering problem with AVX and prebuilts for a while. @sylvanc and I are figuring out the best "basic" prebuilts we can do that might sacrifice performance but should work across more machines. Once we get that figured out, I'll try updating our CI.

I'm going to leave this open and once Sylvan and I have a solution to try, will ping you both and ask you to try again.

@SeanTAllen
Copy link
Member

@davidgiven @azzuwan this should be fixed by #1663. And a new version of pony 0.11.1 will be released soon. Can you please give 0.11.1 a try after it is released and see if your issues are fixed. In the meantime, I'm going to close this issue under the assumption that its been fixed.

@SeanTAllen
Copy link
Member

@azzuwan did this fix the issue for you? i've received a couple of reports of continuing problems with "illegal instruction"

@davidgiven
Copy link

Debian updated my ponyc-release from the repository to 0.11.1-2870.922bed4 --- but it still dies. Stack dump and disassembly are identical to the previous report.

(Tangent: remember when you'd routinely install a floating point emulator on machines with no 387 coprocessor, so you could run programs that used floating point? Why don't they still do that? Being able to run binaries for other amd64 architectures, even if slowly, would be really useful...)

@SeanTAllen
Copy link
Member

@davidgiven yeah we did it incorrectly. there's a new release coming soon that should hopefully fix. sorry about that. we did pretty much the wrong thing.

#1686 should fix it

@davidgiven
Copy link

Updated to 0.11.3-917610c; now it works --- thanks!

(By 'working', I mean that I built the 'Hello World' sample and it worked (after adding --pic). That's all the Pony I know. Next step, work through the tutorials...)

@SeanTAllen
Copy link
Member

WOO-HOO! sorry about all the starts and stops on that.

If you want best performance, you'll want to build from source but its a good way to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants